CFEL - ASG Software Suite  2.5.0
CASS
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cass::FormatConverter Class Reference

Format converter container. More...

#include <format_converter.h>

+ Collaboration diagram for cass::FormatConverter:

Public Types

typedef std::tr1::shared_ptr< FormatConvertershared_pointer
 a shared pointer of this type More...
 
typedef std::map< Pds::TypeId::Type, ConversionBackend::shared_pointerusedConverters_t
 typdef describing the map of used converters for easier readable code More...
 

Public Member Functions

bool operator() (CASSEvent *evt)
 function to process a datagram and turn it into a cassevent. More...
 
void loadSettings (size_t what)
 function to load the settings for the format converter More...
 
void saveSettings ()
 function to save the settings for the format converter More...
 

Static Public Member Functions

static shared_pointer instance ()
 Return a pointer to the single FormatConverter instance. More...
 

Static Public Attributes

static const unsigned int pvNumMax = 2
 

Protected Member Functions

 FormatConverter ()
 constructor is made protected, should only be called through instance More...
 

Protected Attributes

bool _configseen
 status whether a configure has already been seen More...
 
usedConverters_t _usedConverters
 map that contains all type id's of all known xtc in a transition. More...
 

Static Protected Attributes

static shared_pointer _instance
 pointer to the single instance More...
 
static QMutex _mutex
 Singleton operation locker in a multi-threaded environment. More...
 

Detailed Description

Format converter container.

Only one FormatConvert object must exist, therefore this is implemented as a singleton. It contains all available Format Converters and calls all requested ones.

List of possible converters

User definable Parameters:
Converter/{Used}
comma separated list of Converters that should be active. Default is "". Possible values are:
Author
Jochen Kuepper
Lutz Foucar

Definition at line 59 of file format_converter.h.

Member Typedef Documentation

a shared pointer of this type

Definition at line 65 of file format_converter.h.

typdef describing the map of used converters for easier readable code

Definition at line 99 of file format_converter.h.

Constructor & Destructor Documentation

FormatConverter::FormatConverter ( )
protected

constructor is made protected, should only be called through instance

Definition at line 46 of file format_converter.cpp.

Member Function Documentation

tr1::shared_ptr< FormatConverter > FormatConverter::instance ( )
static

Return a pointer to the single FormatConverter instance.

Definition at line 35 of file format_converter.cpp.

void FormatConverter::loadSettings ( size_t  what)

function to load the settings for the format converter

initialze all xtc ids with blank converters. Get the list of converters that should be used. Then create the requested converters and retrieve the list of pds ids that the individual converter is responsible for. Add the converter to used converters container for all retrieved ids

Definition at line 50 of file format_converter.cpp.

References _usedConverters, QSettings::beginGroup(), cass::ConversionBackend::instance(), and QSettings::value().

Referenced by cass::SharedMemoryInput::load(), and cass::XtcReader::loadSettings().

bool FormatConverter::operator() ( CASSEvent evt)

function to process a datagram and turn it into a cassevent.

this function will iterate through the xtc's contained in the datagram extract the information and put into the right device of the CASSEvent

Returns
returns true if the datagram was a L1Accept (an event) transition
Parameters
evtpointer to the CASSEvent which also contains the datagram

intialize the return value (the return value reflects the whether the datagram was a good L1Transition(an event))

get the datagram from the cassevent

if datagram is configuration or an event (L1Accept) then we will iterate through it otherwise we ignore the datagram

when it is a configuration transition then set the flag accordingly

if the datagram is an event, create the id from time and fiducial

extract the bunchId from the datagram

put the id into the cassevent

set the return value to true

prepare the cassevent

Note
maybe, when more converters need preparing the data, we will do it for all loaded converters, which will need another list that conatins the loaded converters

now iterate through the datagram and find the wanted information if the return value of the iterator is false, then the transition did not contain all information

finalize the epics conversion, so get the epics converter and finalize

Note
maybe, when more converters need finalizing the data, we will do it for all loaded converters, which will need another list that conatins the loaded converters

Definition at line 77 of file format_converter.cpp.

References _configseen, _usedConverters, cass::Log::add(), cass::CASSEvent::datagrambuffer(), cass::Log::DEBUG4, GoodData, cass::CASSEvent::id(), NoGoodData, and cass::toString().

void cass::FormatConverter::saveSettings ( )
inline

function to save the settings for the format converter

Definition at line 91 of file format_converter.h.

Member Data Documentation

bool cass::FormatConverter::_configseen
protected

status whether a configure has already been seen

Definition at line 103 of file format_converter.h.

Referenced by operator()().

FormatConverter::shared_pointer FormatConverter::_instance
staticprotected

pointer to the single instance

Definition at line 113 of file format_converter.h.

QMutex FormatConverter::_mutex
staticprotected

Singleton operation locker in a multi-threaded environment.

Definition at line 116 of file format_converter.h.

usedConverters_t cass::FormatConverter::_usedConverters
protected

map that contains all type id's of all known xtc in a transition.

the converter used by the xtc is the second. We add the appropriate converters at the right position

Definition at line 110 of file format_converter.h.

Referenced by loadSettings(), and operator()().

const unsigned int cass::FormatConverter::pvNumMax = 2
static

Definition at line 62 of file format_converter.h.


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