NexusCPP  3.5.0
Classes | Public Types | Public Member Functions | List of all members
nxcpp::NexusFileWriter Class Reference

#include <nxwriter.h>

Classes

class  INotify
 Write notification interface. More...
 
struct  Statistics
 Writing speed statistics. More...
 

Public Types

enum  WriteMode { SYNCHRONOUS = 0, ASYNCHRONOUS, IMMEDIATE, DELAYED }
 
typedef struct nxcpp::NexusFileWriter::Statistics Statistics
 Writing speed statistics. More...
 

Public Member Functions

 NexusFileWriter (const std::string &strFilePath, WriteMode eMode=ASYNCHRONOUS, unsigned int uiWritePeriod=2)
 
 ~NexusFileWriter ()
 Destructor. More...
 
void SetExceptionHandler (IExceptionHandler *pHandler)
 Set exception handler. More...
 
void SetMessageHandler (IMessageHandler *pHandler)
 Set message handler. More...
 
void SetNotificationHandler (INotify *pHandler)
 Set the notification handler. More...
 
void AddNotificationHandler (INotify *pHandler)
 Set the notification handler. More...
 
void SetCacheSize (yat::uint16 usCacheSize)
 Set cache size (in MB) for DELAYED mode. More...
 
void CreateDataSet (const std::string &strPath, NexusDataType eDataType, int iRank, int *piDim, CompressionFilter filter=CompressNone, FilterConfig filter_config=FilterConfig(), int *piChunk=0)
 
void PushDataSet (const std::string &strPath, NexusDataSetPtr ptrDataSet)
 
void PushDatasetAttr (const std::string &strPath, NexusAttrPtr ptrAttr)
 
void Abort ()
 
bool IsError ()
 True. More...
 
bool IsEmpty ()
 Returns true if there is no data to write. More...
 
bool Done ()
 Returns true when all job is done. More...
 
void Synchronize (bool bSendSyncMsg=true)
 Wait until all job is done. More...
 
void Hold (bool b=true)
 
bool IsHold () const
 
const std::string & File () const
 File name. More...
 
void SetFileAutoClose (bool b)
 The file will not be closed after each write action. More...
 
void CloseFile ()
 Close the nexus file. More...
 
void SetUseLock ()
 Engage the file lock mecanism. More...
 
void ResetStatistics ()
 Reset all statistics. More...
 
Statistics GetStatistics () const
 Gets a copy of the statistics. More...
 

Static Public Member Functions

static std::size_t AttemptMax ()
 Max attempts for write actions. More...
 
static std::size_t AttemptDelay ()
 delay (in ms) between to attempts More...
 
static void SetAttemptMax (std::size_t n)
 set max attempts for write actions More...
 
static void SetAttemptDelay (std::size_t ms)
 set (in ms) between to attempts More...
 

Detailed Description

Synchronous/Asynchronous NeXus Writer File Class

This class allow asynchronous writing into a nexus file

Remarks
This is wrapper class, the real job is make by a internal objet

Member Typedef Documentation

◆ Statistics

Writing speed statistics.

Member Enumeration Documentation

◆ WriteMode

Enumerator
SYNCHRONOUS 
ASYNCHRONOUS 

Synchronous mode.

IMMEDIATE 

Asynchronous mode.

Depracated modes

DELAYED 

Constructor & Destructor Documentation

◆ NexusFileWriter()

nxcpp::NexusFileWriter::NexusFileWriter ( const std::string &  strFilePath,
WriteMode  eMode = ASYNCHRONOUS,
unsigned int  uiWritePeriod = 2 
)

Constructor

Parameters
strFilePathpath + complete filename
eModeWriting mode
uiWritePeriodWrite period (seconds) in asynchronous mode

◆ ~NexusFileWriter()

nxcpp::NexusFileWriter::~NexusFileWriter ( )

Destructor.

Member Function Documentation

◆ Abort()

void nxcpp::NexusFileWriter::Abort ( )

Abort: delete all remaining data if any, no more access to file When this method returns

◆ AddNotificationHandler()

void nxcpp::NexusFileWriter::AddNotificationHandler ( INotify pHandler)

Set the notification handler.

◆ AttemptDelay()

static std::size_t nxcpp::NexusFileWriter::AttemptDelay ( )
inlinestatic

delay (in ms) between to attempts

◆ AttemptMax()

static std::size_t nxcpp::NexusFileWriter::AttemptMax ( )
inlinestatic

Max attempts for write actions.

◆ CloseFile()

void nxcpp::NexusFileWriter::CloseFile ( )

Close the nexus file.

◆ CreateDataSet()

void nxcpp::NexusFileWriter::CreateDataSet ( const std::string &  strPath,
NexusDataType  eDataType,
int  iRank,
int *  piDim,
CompressionFilter  filter = CompressNone,
FilterConfig  filter_config = FilterConfig(),
int *  piChunk = 0 
)

Create a dataset

Parameters
strPathDataset path and name (ex: "entry<NXentry>/sample<NXsample>/formula")
eDataTypeThe data type
iRanknumber of dimensions
piDimdimensions array
filterCompression filter (no compression is the default)
filter_configCompression filter parameters
piChunkdimensions array of compress chunks (null if no compression)

◆ Done()

bool nxcpp::NexusFileWriter::Done ( )

Returns true when all job is done.

◆ File()

const std::string& nxcpp::NexusFileWriter::File ( ) const

File name.

◆ GetStatistics()

Statistics nxcpp::NexusFileWriter::GetStatistics ( ) const

Gets a copy of the statistics.

◆ Hold()

void nxcpp::NexusFileWriter::Hold ( bool  b = true)

◆ IsEmpty()

bool nxcpp::NexusFileWriter::IsEmpty ( )

Returns true if there is no data to write.

◆ IsError()

bool nxcpp::NexusFileWriter::IsError ( )

True.

◆ IsHold()

bool nxcpp::NexusFileWriter::IsHold ( ) const

◆ PushDataSet()

void nxcpp::NexusFileWriter::PushDataSet ( const std::string &  strPath,
NexusDataSetPtr  ptrDataSet 
)

Push a dataset

Parameters
strPathDataset path and name (ex: "entry<NXentry>/sample<NXsample>/formula")
ptrDataSetShared pointer to the dataset to push

◆ PushDatasetAttr()

void nxcpp::NexusFileWriter::PushDatasetAttr ( const std::string &  strPath,
NexusAttrPtr  ptrAttr 
)

Push a attribute Dataset must already exists, otherwise a error is repported and action is canceled

Parameters
strPathDataset path and name (ex: "entry<NXentry>/sample<NXsample>/formula.attribute")
ptrAttrShared pointer to the attribute

◆ ResetStatistics()

void nxcpp::NexusFileWriter::ResetStatistics ( )

Reset all statistics.

◆ SetAttemptDelay()

static void nxcpp::NexusFileWriter::SetAttemptDelay ( std::size_t  ms)
static

set (in ms) between to attempts

◆ SetAttemptMax()

static void nxcpp::NexusFileWriter::SetAttemptMax ( std::size_t  n)
static

set max attempts for write actions

◆ SetCacheSize()

void nxcpp::NexusFileWriter::SetCacheSize ( yat::uint16  usCacheSize)

Set cache size (in MB) for DELAYED mode.

◆ SetExceptionHandler()

void nxcpp::NexusFileWriter::SetExceptionHandler ( IExceptionHandler pHandler)

Set exception handler.

◆ SetFileAutoClose()

void nxcpp::NexusFileWriter::SetFileAutoClose ( bool  b)

The file will not be closed after each write action.

◆ SetMessageHandler()

void nxcpp::NexusFileWriter::SetMessageHandler ( IMessageHandler pHandler)

Set message handler.

◆ SetNotificationHandler()

void nxcpp::NexusFileWriter::SetNotificationHandler ( INotify pHandler)

Set the notification handler.

◆ SetUseLock()

void nxcpp::NexusFileWriter::SetUseLock ( )

Engage the file lock mecanism.

◆ Synchronize()

void nxcpp::NexusFileWriter::Synchronize ( bool  bSendSyncMsg = true)

Wait until all job is done.


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