CFEL - ASG Software Suite  2.5.0
CASS
cass_event.h
Go to the documentation of this file.
1 //Copyright (C) 2010,2013 Lutz Foucar
2 
3 /**
4  * @file cass_event.h file contains declaration of the CASSEvent
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _CASSEVENT_H_
10 #define _CASSEVENT_H_
11 
12 #include <map>
13 #include <vector>
14 #include <stdint.h>
15 
16 #include "cass.h"
17 #include "serializable.hpp"
18 #include "device_backend.hpp"
19 
20 
21 namespace cass
22 {
23 class SerializerBackend;
24 
25 /** Event to store all LCLS Data
26  *
27  * a cassevent that stores all information comming from
28  * the machine, and also some calculated information
29  *
30  * @author Lutz Foucar
31  */
32 class CASSEvent : public Serializable
33 {
34 public:
35  /** constructor will create all devices*/
36  CASSEvent();
37 
38  /** destroyes all devices */
40 
41 public:
42  /** known devices */
44 
45  /** mapping from device type to handler instance */
46  typedef std::map<Device, DeviceBackend::shared_pointer > devices_t;
47 
48  /** a buffer type */
49  typedef std::vector<char> buffer_t;
50 
51  /** define the id type */
52  typedef uint64_t id_t;
53 
54 public:
55  /** serialize a event to the Serializer*/
56  void serialize(SerializerBackend&) const;
57 
58  /** deserialize an event from the Serializer*/
60 
61 public:
62  //@{
63  /** setters */
64  id_t &id() {return _id;}
65  buffer_t &datagrambuffer() {return _datagrambuffer;}
66  devices_t &devices() {return _devices;}
67  void setFilename(const std::string& f) {_filename = f;}
68  //@}
69  //@{
70  /** getters */
71  id_t id()const {return _id;}
72  const buffer_t &datagrambuffer()const {return _datagrambuffer;}
73  const devices_t &devices()const {return _devices;}
74  const std::string filename()const {return _filename;}
75  //@}
76 
77 public:
78 // std::string pvControl;
79 
80 private:
81  /** id of the cassevent */
82  id_t _id;
83 
84  /** list of devices for this event */
85  devices_t _devices;
86 
87  /** buffer for the datagram that contains all LCLS information */
88  buffer_t _datagrambuffer;
89 
90  /** filename of file which this event came from (if offline) */
91  std::string _filename;
92 };
93 }//end namespace cass
94 
95 #endif // CASSEVENT_H
Event to store all LCLS Data.
Definition: cass_event.h:32
void setFilename(const std::string &f)
setters
Definition: cass_event.h:67
const devices_t & devices() const
getters
Definition: cass_event.h:73
uint64_t id_t
define the id type
Definition: cass_event.h:52
buffer_t _datagrambuffer
buffer for the datagram that contains all LCLS information
Definition: cass_event.h:88
const std::string filename() const
getters
Definition: cass_event.h:74
std::vector< char > buffer_t
a buffer type
Definition: cass_event.h:49
~CASSEvent()
destroyes all devices
Definition: cass_event.h:39
Device
known devices
Definition: cass_event.h:43
contains base class for all devices that are part of the cassevent.
std::string _filename
filename of file which this event came from (if offline)
Definition: cass_event.h:91
file contains base class all serializable classes
devices_t & devices()
setters
Definition: cass_event.h:66
void serialize(SerializerBackend &) const
serialize a event to the Serializer
Definition: cass_event.cpp:32
file contains global definitions for project cass
id_t & id()
setters
Definition: cass_event.h:64
bool deserialize(SerializerBackend &)
deserialize an event from the Serializer
Definition: cass_event.cpp:47
std::map< Device, DeviceBackend::shared_pointer > devices_t
mapping from device type to handler instance
Definition: cass_event.h:46
buffer_t & datagrambuffer()
setters
Definition: cass_event.h:65
id_t id() const
getters
Definition: cass_event.h:71
devices_t _devices
list of devices for this event
Definition: cass_event.h:85
Serializable.
id_t _id
id of the cassevent
Definition: cass_event.h:82
const buffer_t & datagrambuffer() const
getters
Definition: cass_event.h:72
CASSEvent()
constructor will create all devices
Definition: cass_event.cpp:20