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

#include <nxbuffer.h>

Inheritance diagram for nxcpp::DataStreamer:
Inheritance graph
[legend]
Collaboration diagram for nxcpp::DataStreamer:
Collaboration graph
[legend]

Classes

struct  Config
 DataStreamer configuration structure. More...
 
struct  Statistics
 Write statistices. More...
 

Public Types

enum  MemoryMode { COPY = 0, NO_COPY }
 Memory mode. More...
 
typedef enum nxcpp::DataStreamer::MemoryMode MemoryMode
 Memory mode. More...
 
typedef struct nxcpp::DataStreamer::Statistics Statistics
 Write statistices. More...
 
typedef struct NEXUSCPP_DECL nxcpp::DataStreamer::Config Config
 DataStreamer configuration structure. More...
 

Public Member Functions

 DataStreamer (const Config &cfg)
 
virtual ~DataStreamer ()
 Destructor. More...
 
void Initialize (const Config &cfg)
 
void SetWriteNotificationCallback (const WriteNotificationCallback &cb)
 
void SetExceptionHandler (IExceptionHandler *pHandler)
 
void SetMessageHandler (IMessageHandler *pHandler)
 
void SetDeviceName (const std::string &strDevice)
 
void Reset ()
 Reset buffer in order to start a new acquisition. More...
 
void Finalize ()
 Terminate the buffering process. More...
 
void Abort (bool bSynchronize=false)
 
void Stop ()
 Close the buffer and wait for synchronization. More...
 
bool IsDone ()
 Ask if all data have been flushed. More...
 
void Synchronize ()
 Wait the recording of all pushed data. More...
 
void Clean ()
 
void OnFlushData (DatasetWriter *pWriter)
 IFlushNotification. More...
 
bool IsExistingItem (const std::string &sItemName)
 Check if a data item has been declared. More...
 
IExceptionHandlerExceptionHandler () const
 Get exception handler. More...
 
IMessageHandlerMessageHandler () const
 Get message handler. More...
 
template<class TYPE >
void PushData (const std::string &sItemName, const TYPE *pData, unsigned int nCount)
 
template<class TYPE >
void PushAxisData (const std::string &sName, TYPE TValue)
 
void AddDataItem (const std::string &sItemName, const std::vector< int > &viDimSize, bool bDataSignal=true)
 
void AddDataItem0D (const std::string &sItemName, bool bDataSignal=true)
 
void AddDataItem1D (const std::string &sItemName, int iSizeDim, bool bDataSignal=true)
 
void AddDataItem2D (const std::string &sItemName, int iSizeDim1, int iSizeDim2, bool bDataSignal=true)
 
void AddDataAxis (const std::string &sItemName, int iDimension, int iOrder)
 
void SetDataItemMemoryMode (const std::string &sItemName, MemoryMode mode)
 
template<class TYPE >
void PushData (const std::string &sItemName, const TYPE *tData, unsigned int nCount=1)
 
template<class TYPE >
void PushAxisData (const std::string &sName, TYPE TValue)
 
void PushIntegerAttribute (const std::string &sItemName, const std::string &sName, long lValue)
 
void PushFloatAttribute (const std::string &sItemName, const std::string &sName, double dValue)
 
void PushStringAttribute (const std::string &sItemName, const std::string &sName, const std::string &strValue)
 
void SetWriteMode (const NexusFileWriter::WriteMode &mode)
 
void SetTargetFolder (const std::string &sPath)
 
NexusFileWriter::WriteMode WriteMode () const
 
const std::string & GetTargetFolder () const
 
int GetNbPushInFile () const
 
void ResetStatistics ()
 Reset all statistics. More...
 
Statistics GetStatistics () const
 Gets a copy of the statistics. More...
 
 DataStreamer (const std::string &, int, int)
 
 DataStreamer (const std::string &, int)
 
 DataStreamer (const std::string &, std::size_t, std::size_t)
 
 DataStreamer (const std::string &, std::size_t)
 
void Initialize (const std::string &x, const std::string &y="")
 
void SetDataItemNodeName (const std::string &, const std::string &)
 
void SetPath (const std::string &, const std::string &)
 
void SetWriteNotificationCallback (WriteNotificationCallback &cb)
 
void SetWorkingFolder (const std::string &)
 
const std::string & GetWorkingFolder () const
 

Static Public Member Functions

static void ResetBufferIndex ()
 
static std::string GenerateBufferName (const std::string &sBaseName, long lIndex, const std::string &strPrefix="")
 

Detailed Description

DataStreamer

This is a utility classe aimed to allow streaming data into NeXus files

Member Typedef Documentation

◆ Config

DataStreamer configuration structure.

◆ MemoryMode

Memory mode.

◆ Statistics

Write statistices.

Member Enumeration Documentation

◆ MemoryMode

Memory mode.

Enumerator
COPY 

Using COPY mode (default), data is internally copied so input data buffer can be reused§deallocated immmadiately after pushing data

NO_COPY 

NO_COPY allow faster streaming but you can't deallocate or reuse pushed data buffer immediately, you have to be sure the data was properly written (you can use a WriteNotificationCallBack in that purpose)

Constructor & Destructor Documentation

◆ DataStreamer() [1/5]

nxcpp::DataStreamer::DataStreamer ( const Config cfg)

Constructor

Parameters
cfgConfiguration

◆ ~DataStreamer()

virtual nxcpp::DataStreamer::~DataStreamer ( )
virtual

Destructor.

◆ DataStreamer() [2/5]

nxcpp::DataStreamer::DataStreamer ( const std::string &  ,
int  ,
int   
)

◆ DataStreamer() [3/5]

nxcpp::DataStreamer::DataStreamer ( const std::string &  ,
int   
)

◆ DataStreamer() [4/5]

nxcpp::DataStreamer::DataStreamer ( const std::string &  ,
std::size_t  ,
std::size_t   
)

◆ DataStreamer() [5/5]

nxcpp::DataStreamer::DataStreamer ( const std::string &  ,
std::size_t   
)

Member Function Documentation

◆ Abort()

void nxcpp::DataStreamer::Abort ( bool  bSynchronize = false)

Abort the bufferization process

Parameters
bSynchronizeif true wait for last pushed data to be recorder

◆ AddDataAxis()

void nxcpp::DataStreamer::AddDataAxis ( const std::string &  sItemName,
int  iDimension,
int  iOrder 
)

Add a axis-type data item

This type of data item is similar to 1-D data item but with additional dataset attributes

Parameters
sItemNameitem name
iDimensionrelated scan dimension for this axis (first is '1')
iOrderaxis order on the dimension

◆ AddDataItem()

void nxcpp::DataStreamer::AddDataItem ( const std::string &  sItemName,
const std::vector< int > &  viDimSize,
bool  bDataSignal = true 
)

Generic data item declaration

Use this method to declare a new item for which you ha ve to stream data

Parameters
sItemNameitem name
viDimSizeDimensions array of the canonical data
bDataSignalIf 'true' this item will ba marked as 'signal' in the Nexus files stream

◆ AddDataItem0D()

void nxcpp::DataStreamer::AddDataItem0D ( const std::string &  sItemName,
bool  bDataSignal = true 
)

Add a Scalar-type data item

Parameters
sItemNameitem name
bDataSignalIf 'true' this item will ba marked as 'signal' in

◆ AddDataItem1D()

void nxcpp::DataStreamer::AddDataItem1D ( const std::string &  sItemName,
int  iSizeDim,
bool  bDataSignal = true 
)

Add a 1-D (spectrum) data item

Parameters
sItemNameitem name
iSizeDimsize of the data item
bDataSignalIf 'true' this item will ba marked as 'signal' in

◆ AddDataItem2D()

void nxcpp::DataStreamer::AddDataItem2D ( const std::string &  sItemName,
int  iSizeDim1,
int  iSizeDim2,
bool  bDataSignal = true 
)

Add a 2-D (image) data item

Parameters
sItemNameitem name
iSizeDim1size of the 1st data item dimension
iSizeDim2size of the 2nd data item dimension
bDataSignalIf 'true' this item will ba marked as 'signal' in

◆ Clean()

void nxcpp::DataStreamer::Clean ( )

Clean Clean all buffers from destination folder

Warning
Don't use this method if you are in a multiple acquisition system (i.e: 1 acquisition for the whole system == n acquisition at device level)

◆ ExceptionHandler()

IExceptionHandler* nxcpp::DataStreamer::ExceptionHandler ( ) const
inline

Get exception handler.

◆ Finalize()

void nxcpp::DataStreamer::Finalize ( )

Terminate the buffering process.

◆ GenerateBufferName()

static std::string nxcpp::DataStreamer::GenerateBufferName ( const std::string &  sBaseName,
long  lIndex,
const std::string &  strPrefix = "" 
)
static

GenerateBufferName Generate a standard buffer file's name according to the base name and given indexes

Parameters
sBaseNamebuffer file base name
lIndexbuffer file index
strPrefixprefix used to ensure uniqueness of file name

◆ GetNbPushInFile()

int nxcpp::DataStreamer::GetNbPushInFile ( ) const
inline

◆ GetStatistics()

Statistics nxcpp::DataStreamer::GetStatistics ( ) const

Gets a copy of the statistics.

◆ GetTargetFolder()

const std::string& nxcpp::DataStreamer::GetTargetFolder ( ) const
inline

◆ GetWorkingFolder()

const std::string& nxcpp::DataStreamer::GetWorkingFolder ( ) const
inline
Here is the call graph for this function:

◆ Initialize() [1/2]

void nxcpp::DataStreamer::Initialize ( const Config cfg)

◆ Initialize() [2/2]

void nxcpp::DataStreamer::Initialize ( const std::string &  x,
const std::string &  y = "" 
)

◆ IsDone()

bool nxcpp::DataStreamer::IsDone ( )

Ask if all data have been flushed.

◆ IsExistingItem()

bool nxcpp::DataStreamer::IsExistingItem ( const std::string &  sItemName)

Check if a data item has been declared.

◆ MessageHandler()

IMessageHandler* nxcpp::DataStreamer::MessageHandler ( ) const
inline

Get message handler.

◆ OnFlushData()

void nxcpp::DataStreamer::OnFlushData ( DatasetWriter pWriter)
virtual

IFlushNotification.

Implements nxcpp::DatasetWriter::IFlushNotification.

◆ PushAxisData() [1/2]

template<class TYPE >
void nxcpp::DataStreamer::PushAxisData ( const std::string &  sName,
TYPE  TValue 
)

◆ PushAxisData() [2/2]

template<class TYPE >
void nxcpp::DataStreamer::PushAxisData ( const std::string &  sName,
TYPE  TValue 
)

PushAxisData

Parameters
sNameAxis name on which datas will be added
TValueMeasured position on the axis

◆ PushData() [1/2]

template<class TYPE >
void nxcpp::DataStreamer::PushData ( const std::string &  sItemName,
const TYPE *  pData,
unsigned int  nCount 
)

Synchrotron SOLEIL

Nexus API for Tango servers

Creation : 2011/01/12 Authors : Stephane Poirier, Clement Rodriguez

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

◆ PushData() [2/2]

template<class TYPE >
void nxcpp::DataStreamer::PushData ( const std::string &  sItemName,
const TYPE *  tData,
unsigned int  nCount = 1 
)

PushData

Parameters
sItemNamesensor's name to which data will be added
tDataAdded data
nCountcanonical data count

◆ PushFloatAttribute()

void nxcpp::DataStreamer::PushFloatAttribute ( const std::string &  sItemName,
const std::string &  sName,
double  dValue 
)

PushFloatAttribute Set an integer-type attribute belonging to the date item named sItemName.

Parameters
sItemNamename of the dataitem or axis which the attribute will belong to
sNamename of the attribute
dValuevalue of the attribute

◆ PushIntegerAttribute()

void nxcpp::DataStreamer::PushIntegerAttribute ( const std::string &  sItemName,
const std::string &  sName,
long  lValue 
)

PushIntegerAttribute Set an integer-type attribute belonging to the date item named sItemName.

Parameters
sItemNamename of the dataitem or axis which the attribute will belong to
sNamename of the attribute
lValuevalue of the attribute

◆ PushStringAttribute()

void nxcpp::DataStreamer::PushStringAttribute ( const std::string &  sItemName,
const std::string &  sName,
const std::string &  strValue 
)

PushStringAttribute Set an std::string-type attribute belonging to the date item named sItemName.

Parameters
sItemNamename of the dataitem or axis which the attribute will belong to
sNamename of the attribute
strValuevalue of the attribute

◆ Reset()

void nxcpp::DataStreamer::Reset ( )

Reset buffer in order to start a new acquisition.

◆ ResetBufferIndex()

static void nxcpp::DataStreamer::ResetBufferIndex ( )
static

Tell the streamer we start a new acquisition sequence, therefore the first file index of every stream will be reset to '1' This method whould not be called for all subsequent DataStreamer objects

◆ ResetStatistics()

void nxcpp::DataStreamer::ResetStatistics ( )

Reset all statistics.

◆ SetDataItemMemoryMode()

void nxcpp::DataStreamer::SetDataItemMemoryMode ( const std::string &  sItemName,
MemoryMode  mode 
)

Set dataitem memory management mode

Parameters
sItemNameitem name
modeWriting mode (COPY/NO_COPY)

◆ SetDataItemNodeName()

void nxcpp::DataStreamer::SetDataItemNodeName ( const std::string &  ,
const std::string &   
)

◆ SetDeviceName()

void nxcpp::DataStreamer::SetDeviceName ( const std::string &  strDevice)
inline

Sets the name of the tango device

◆ SetExceptionHandler()

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

Set exception handler

Parameters
pHandlerThe exception handler

◆ SetMessageHandler()

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

Set message handler

Parameters
pHandlerThe message handler

◆ SetPath()

void nxcpp::DataStreamer::SetPath ( const std::string &  ,
const std::string &   
)

◆ SetTargetFolder()

void nxcpp::DataStreamer::SetTargetFolder ( const std::string &  sPath)
inline

◆ SetWorkingFolder()

void nxcpp::DataStreamer::SetWorkingFolder ( const std::string &  )
inline

◆ SetWriteMode()

void nxcpp::DataStreamer::SetWriteMode ( const NexusFileWriter::WriteMode mode)
inline

◆ SetWriteNotificationCallback() [1/2]

void nxcpp::DataStreamer::SetWriteNotificationCallback ( const WriteNotificationCallback &  cb)

Set the write notification callback

Parameters
cbWritenotificationCallBack method

◆ SetWriteNotificationCallback() [2/2]

void nxcpp::DataStreamer::SetWriteNotificationCallback ( WriteNotificationCallback &  cb)
inline

◆ Stop()

void nxcpp::DataStreamer::Stop ( )

Close the buffer and wait for synchronization.

◆ Synchronize()

void nxcpp::DataStreamer::Synchronize ( )

Wait the recording of all pushed data.

◆ WriteMode()

NexusFileWriter::WriteMode nxcpp::DataStreamer::WriteMode ( ) const
inline

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