libpniio
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
pni::io::nx::nxfile< IMPID > Class Template Reference

File object. More...

#include <nxfile.hpp>

Collaboration diagram for pni::io::nx::nxfile< IMPID >:
Collaboration graph
[legend]

Public Types

typedef nximp_map< IMPID >
::file_imp 
imp_type
 implementation type More...
 
typedef nxfile< IMPID > file_type
 Nexus file type. More...
 

Public Member Functions

 nxfile ()
 default constructor More...
 
 nxfile (const file_type &file)
 copy constrcutor More...
 
 nxfile (file_type &&f)
 move constructor More...
 
 nxfile (imp_type &&imp)
 implemenetation move constructor More...
 
 ~nxfile ()
 destructor More...
 
file_typeoperator= (const file_type &f)
 copy assignment operator More...
 
file_typeoperator= (file_type &&f)
 move assignment operator More...
 
void flush () const
 flush the file More...
 
bool is_readonly () const
 check read only More...
 
void close ()
 close the file More...
 
nxobject_trait< IMPID >::group_type root () const
 get root group More...
 
bool is_valid () const noexcept
 check validity More...
 

Static Public Member Functions

static file_type open_file (const string &n, bool ro=true)
 open file More...
 
static file_type create_files (const string &n, ssize_t ssize, bool ow=false)
 create file family More...
 
static file_type create_file (const string &n, bool ow=false)
 create single file More...
 

Private Attributes

imp_type _imp
 implementation instance More...
 

Detailed Description

template<nximp_code IMPID>
class pni::io::nx::nxfile< IMPID >

nxfile represents a file for reading and writing data too. It is the basic data holding entity. You can use NXField to read from or write data to a file.

The copy and move constructors as well as the assignment operators must be implemented as the class has a non-trivial destructor.

Member Typedef Documentation

template<nximp_code IMPID>
typedef nxfile<IMPID> pni::io::nx::nxfile< IMPID >::file_type
template<nximp_code IMPID>
typedef nximp_map<IMPID>::file_imp pni::io::nx::nxfile< IMPID >::imp_type

Constructor & Destructor Documentation

template<nximp_code IMPID>
pni::io::nx::nxfile< IMPID >::nxfile ( )
inlineexplicit
template<nximp_code IMPID>
pni::io::nx::nxfile< IMPID >::nxfile ( const file_type file)
inline
template<nximp_code IMPID>
pni::io::nx::nxfile< IMPID >::nxfile ( file_type &&  f)
inline
template<nximp_code IMPID>
pni::io::nx::nxfile< IMPID >::nxfile ( imp_type &&  imp)
inlineexplicit
template<nximp_code IMPID>
pni::io::nx::nxfile< IMPID >::~nxfile ( )
inline

Member Function Documentation

template<nximp_code IMPID>
void pni::io::nx::nxfile< IMPID >::close ( )
inline
Exceptions
type_errorif there is an issue with the internal file object
object_errorin case of any other error
template<nximp_code IMPID>
static file_type pni::io::nx::nxfile< IMPID >::create_file ( const string &  n,
bool  ow = false 
)
inlinestatic

Creates a single file.

Exceptions
invalid_object_errorif the newly create file object is not valid
io_errorif attribute writing failed
object_errorif object creation failed (in any other case)
Parameters
nname of the file
owoverwrite flag
Returns
file instance
template<nximp_code IMPID>
static file_type pni::io::nx::nxfile< IMPID >::create_files ( const string &  n,
ssize_t  ssize,
bool  ow = false 
)
inlinestatic

Static method to create a set of files. In the case of the HDF5 backend the family driver is used and the data is distributed over a bunch of files.

Exceptions
invalid_object_errorif the newly created file object is not valid
io_errorif attribute writing or flush fails
object_errorin case of any other error
Parameters
nname of the file to create
ssizesplit size (not implemented yet)
owoverwrite existing file if true
Returns
instance of NXFile
template<nximp_code IMPID>
void pni::io::nx::nxfile< IMPID >::flush ( ) const
inline
Exceptions
io_errorif flush fails
object_errorin case of any other error
template<nximp_code IMPID>
bool pni::io::nx::nxfile< IMPID >::is_readonly ( ) const
inline
Exceptions
invalid_object_errorif file is not valid
file_errorif the file intent cannot be retrieved
object_errorin case of any other error
Returns
true if file is read-onlye, false otherwise
template<nximp_code IMPID>
bool pni::io::nx::nxfile< IMPID >::is_valid ( ) const
inlinenoexcept
Exceptions
object_errorif validity status check fails
Returns
true when file is valid, false otherwise
template<nximp_code IMPID>
static file_type pni::io::nx::nxfile< IMPID >::open_file ( const string &  n,
bool  ro = true 
)
inlinestatic

Static method opening an existing file.

Exceptions
invalid_object_errorif the new file object is not valid
object_errorin case of any other error
file_errorif the file is not an HDF5 file
Parameters
nname of the file
roopen read only if true
Returns
an instance of NXFile
template<nximp_code IMPID>
file_type& pni::io::nx::nxfile< IMPID >::operator= ( const file_type f)
inline
template<nximp_code IMPID>
file_type& pni::io::nx::nxfile< IMPID >::operator= ( file_type &&  f)
inline
template<nximp_code IMPID>
nxobject_trait<IMPID>::group_type pni::io::nx::nxfile< IMPID >::root ( ) const
inline

Return the root group of the file.

Exceptions
invalid_object_errorif the file is not valid
type_errorif the group type cannot be determined
object_errorin case of any other error
Returns
root group of the file

Field Documentation

template<nximp_code IMPID>
imp_type pni::io::nx::nxfile< IMPID >::_imp
private

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