All Classes Namespaces Functions Enumerations Enumerator Modules Pages
Public Member Functions | List of all members
kvikio::CompatModeManager Class Reference

Store and manage the compatibility mode data associated with a FileHandle. More...

#include <compat_mode.hpp>

Public Member Functions

 CompatModeManager () noexcept=default
 Construct an empty compatibility mode manager.
 
 CompatModeManager (std::string const &file_path, std::string const &flags, mode_t mode, CompatMode compat_mode_requested, FileHandle *file_handle)
 Construct a compatibility mode manager associated with a FileHandle. More...
 
 CompatModeManager (const CompatModeManager &)=default
 
CompatModeManageroperator= (const CompatModeManager &)=default
 
 CompatModeManager (CompatModeManager &&) noexcept=default
 
CompatModeManageroperator= (CompatModeManager &&) noexcept=default
 
CompatMode infer_compat_mode_if_auto (CompatMode compat_mode) noexcept
 Functionally identical to defaults::infer_compat_mode_if_auto(CompatMode). More...
 
bool is_compat_mode_preferred (CompatMode compat_mode) noexcept
 Functionally identical to defaults::is_compat_mode_preferred(CompatMode). More...
 
bool is_compat_mode_preferred () const noexcept
 Check if the compatibility mode for synchronous I/O of the associated FileHandle is expected to be CompatMode::ON. More...
 
bool is_compat_mode_preferred_for_async () const noexcept
 Check if the compatibility mode for asynchronous I/O of the associated FileHandle is expected to be CompatMode::ON. More...
 
CompatMode compat_mode_requested () const noexcept
 Retrieve the original compatibility mode requested. More...
 
void validate_compat_mode_for_async () const
 Determine if asynchronous I/O can be performed or not (throw exceptions) according to the existing compatibility mode data in the manager. More...
 

Detailed Description

Store and manage the compatibility mode data associated with a FileHandle.

Definition at line 58 of file compat_mode.hpp.

Constructor & Destructor Documentation

◆ CompatModeManager()

kvikio::CompatModeManager::CompatModeManager ( std::string const &  file_path,
std::string const &  flags,
mode_t  mode,
CompatMode  compat_mode_requested,
FileHandle file_handle 
)

Construct a compatibility mode manager associated with a FileHandle.

According to the file path, requested compatibility mode, and the system configuration, the compatibility manager:

  • Infers the final compatibility modes for synchronous and asynchronous I/O paths, respectively.
  • Initializes the file wrappers and cuFile handle associated with a FileHandle.
Parameters
file_pathRefer to FileHandle::FileHandle(std::string const&, std::string const&, mode_t, CompatMode).
flagsSame as above.
modeSame as above.
compat_mode_requestedSame as above.
file_handlePointer to the FileHandle object that owns this compatibility mode manager.

Member Function Documentation

◆ compat_mode_requested()

CompatMode kvikio::CompatModeManager::compat_mode_requested ( ) const
noexcept

Retrieve the original compatibility mode requested.

Returns
The original compatibility mode requested.

◆ infer_compat_mode_if_auto()

CompatMode kvikio::CompatModeManager::infer_compat_mode_if_auto ( CompatMode  compat_mode)
noexcept

Functionally identical to defaults::infer_compat_mode_if_auto(CompatMode).

Parameters
compat_modeCompatibility mode.
Returns
If the given compatibility mode is CompatMode::AUTO, infer the final compatibility mode.

◆ is_compat_mode_preferred() [1/2]

bool kvikio::CompatModeManager::is_compat_mode_preferred ( ) const
noexcept

Check if the compatibility mode for synchronous I/O of the associated FileHandle is expected to be CompatMode::ON.

Returns
Boolean answer.

◆ is_compat_mode_preferred() [2/2]

bool kvikio::CompatModeManager::is_compat_mode_preferred ( CompatMode  compat_mode)
noexcept

Functionally identical to defaults::is_compat_mode_preferred(CompatMode).

Parameters
compat_modeCompatibility mode.
Returns
Boolean answer.

◆ is_compat_mode_preferred_for_async()

bool kvikio::CompatModeManager::is_compat_mode_preferred_for_async ( ) const
noexcept

Check if the compatibility mode for asynchronous I/O of the associated FileHandle is expected to be CompatMode::ON.

Returns
Boolean answer.

◆ validate_compat_mode_for_async()

void kvikio::CompatModeManager::validate_compat_mode_for_async ( ) const

Determine if asynchronous I/O can be performed or not (throw exceptions) according to the existing compatibility mode data in the manager.

Asynchronous I/O cannot be performed, for instance, when compat_mode_requested() is CompatMode::OFF, is_compat_mode_preferred() is CompatMode::OFF, but is_compat_mode_preferred_for_async() is CompatMode::ON (due to missing cuFile stream API or cuFile configuration file).


The documentation for this class was generated from the following file: