CFEL - ASG Software Suite  2.5.0
CASS
format_converter.h
Go to the documentation of this file.
1 // Copyright (C) 2009 Jochen Kuepper
2 // Copyright (C) 2009, 2010 Lutz Foucar
3 
4 /**
5  * @file format_converter.h file contains declaration of the container for all
6  * format converters
7  *
8  * @author Lutz Foucar
9  */
10 
11 #ifndef CASS_FORMATCONVERTER_H
12 #define CASS_FORMATCONVERTER_H
13 
14 #include <map>
15 
16 #include <QtCore/QMutex>
17 #include <QtCore/QObject>
18 
19 #include "pdsdata/xtc/TypeId.hh"
20 
21 #include "cass.h"
22 #include "conversion_backend.h"
23 #include "cass_settings.h"
24 
25 namespace cass
26 {
27 //forward delarations
28 class CASSEvent;
29 class ConversionBackend;
30 
31 /** Format converter container.
32  *
33  * Only one FormatConvert object must exist, therefore this is implemented
34  * as a singleton. It contains all available Format Converters and calls
35  * all requested ones.
36  *
37  * @section converter List of possible converters
38  * @cassttng Converter/{Used}\n
39  * comma separated list of Converters that should be active. Default
40  * is "". Possible values are:
41  * - Machine: access to Machine Data (Beamline and Epics data)
42  * (see cass::MachineData::Converter)
43  * - Acqiris: access to Acqiris Digitizer data
44  * (see cass::ACQIRIS::Converter)
45  * - AcqirisTDC: access to Acqiris TDC data
46  * (see cass::ACQIRISTDC::Converter)
47  * - CCD: access to Opal camera data
48  * (see cass::CCD::Converter)
49  * - pnCCD: access to pnCCD data
50  * (see cass::pnCCD::Converter)
51  * - pixeldetector: access to CCD and pnCCD data which will be put
52  * into the newer container for accessing it
53  * through the new analysis chain (omitting the
54  * preanalysis). see cass::pixeldetector::Converter
55  *
56  * @author Jochen Kuepper
57  * @author Lutz Foucar
58  */
60 {
61 public:
62  static const unsigned int pvNumMax = 2;
63 
64  /** a shared pointer of this type */
65  typedef std::tr1::shared_ptr<FormatConverter> shared_pointer;
66 
67  /** Return a pointer to the single FormatConverter instance */
68  static shared_pointer instance();
69 
70  /** function to process a datagram and turn it into a cassevent.
71  *
72  * this function will iterate through the xtc's contained in the datagram
73  * extract the information and put into the right device of the CASSEvent
74  *
75  * @return returns true if the datagram was a L1Accept (an event) transition
76  * @param evt pointer to the CASSEvent which also contains the datagram
77  */
78  bool operator()(CASSEvent*evt);
79 
80  /** function to load the settings for the format converter
81  *
82  * initialze all xtc ids with blank converters.
83  * Get the list of converters that should be used. Then create the requested
84  * converters and retrieve the list of pds ids that the individual converter
85  * is responsible for. Add the converter to used converters container for all
86  * retrieved ids
87  */
88  void loadSettings(size_t what);
89 
90  /** function to save the settings for the format converter */
91  void saveSettings() {}
92 
93 protected:
94  /** constructor is made protected, should only be called through instance*/
96 
97 public:
98  /** typdef describing the map of used converters for easier readable code */
99  typedef std::map<Pds::TypeId::Type, ConversionBackend::shared_pointer> usedConverters_t;
100 
101 protected:
102  /** status whether a configure has already been seen */
104 
105  /** map that contains all type id's of all known xtc in a transition.
106  *
107  * the converter used by the xtc is the second. We add the appropriate
108  * converters at the right position
109  */
110  usedConverters_t _usedConverters;
111 
112  /** pointer to the single instance */
113  static shared_pointer _instance;
114 
115  /** Singleton operation locker in a multi-threaded environment.*/
116  static QMutex _mutex;
117 };
118 
119 }//end namespace cass
120 
121 
122 #endif
static QMutex _mutex
Singleton operation locker in a multi-threaded environment.
Event to store all LCLS Data.
Definition: cass_event.h:32
FormatConverter()
constructor is made protected, should only be called through instance
static shared_pointer _instance
pointer to the single instance
file contains base class for all format converters
Format converter container.
bool _configseen
status whether a configure has already been seen
std::tr1::shared_ptr< FormatConverter > shared_pointer
a shared pointer of this type
file contains global definitions for project cass
static const unsigned int pvNumMax
file contains specialized class that do the settings for cass
static shared_pointer instance()
Return a pointer to the single FormatConverter instance.
void loadSettings(size_t what)
function to load the settings for the format converter
std::map< Pds::TypeId::Type, ConversionBackend::shared_pointer > usedConverters_t
typdef describing the map of used converters for easier readable code
usedConverters_t _usedConverters
map that contains all type id's of all known xtc in a transition.
void saveSettings()
function to save the settings for the format converter
bool operator()(CASSEvent *evt)
function to process a datagram and turn it into a cassevent.