CFEL - ASG Software Suite  2.5.0
CASS
conversion_backend.h
Go to the documentation of this file.
1 // Copyright (C) 2009 Jochen Kuepper
2 // Copyright (C) 2009,2010,2011,2013 Lutz Foucar
3 
4 /**
5  * @file conversion_backend.h file contains base class for all format converters
6  *
7  * @author Lutz Foucar
8  */
9 
10 #ifndef CASS_CONVERSIONBACKEND_H
11 #define CASS_CONVERSIONBACKEND_H
12 
13 #include <list>
14 #include <string>
15 #include <tr1/memory>
16 
17 #include "pdsdata/xtc/TypeId.hh"
18 
19 #include "cass.h"
20 
21 namespace Pds
22 {
23 //forward declaration
24 class Xtc;
25 }
26 
27 namespace cass
28 {
29 class CASSEvent;
30 
31 /** Base class for Converters
32  *
33  * Inherit from this class if you would like to add a new Converter
34  *
35  * @author Lutz Foucar
36  * @author Jochen Kuepper
37  */
39 {
40 public:
41  /** typedef */
42  typedef std::tr1::shared_ptr<ConversionBackend> shared_pointer;
43 
44  /** typedef */
45  typedef std::list<Pds::TypeId::Type> pdstypelist_t;
46 
47 public:
48  /** virtual destructor to make clear this is a base class */
49  virtual ~ConversionBackend() {}
50 
51  /** prepare the cassevent
52  *
53  * @param evt the event shat shoul be prepared
54  */
55  virtual void prepare(cass::CASSEvent * /** evt*/) {}
56 
57  /** pure virtual operator.
58  *
59  * call this to convert the xtc to the cass event
60  *
61  * @param xtc the xtc that contains the data to convert
62  * @param evt the event where the converted data should be stored
63  */
64  virtual void operator()(const Pds::Xtc *xtc, cass::CASSEvent *evt);
65 
66  /** finalize the event
67  *
68  * @param evt the event that should be finalized
69  */
70  virtual void finalize(cass::CASSEvent * /** evt */) {}
71 
72  /** return the list of pds type ids the converter is responsible for */
73  const pdstypelist_t &pdsTypeList()const {return _pdsTypeList;}
74 
75  /** return the requested converter type
76  *
77  * @return shared pointer to the requested converter
78  * @param type the type of the requested converter
79  */
80  static shared_pointer instance(const std::string& type);
81 
82 protected:
83  /** the list of pds types that the converter is responsible for */
84  pdstypelist_t _pdsTypeList;
85 };
86 }//end namespace cass
87 
88 #endif
89 
Event to store all LCLS Data.
Definition: cass_event.h:32
#define CASSSHARED_EXPORT
Definition: cass.h:30
virtual ~ConversionBackend()
virtual destructor to make clear this is a base class
virtual void prepare(cass::CASSEvent *)
prepare the cassevent
virtual void finalize(cass::CASSEvent *)
finalize the event
file contains global definitions for project cass
std::tr1::shared_ptr< ConversionBackend > shared_pointer
typedef
pdstypelist_t _pdsTypeList
the list of pds types that the converter is responsible for
Base class for Converters.
const pdstypelist_t & pdsTypeList() const
return the list of pds type ids the converter is responsible for
std::list< Pds::TypeId::Type > pdstypelist_t
typedef