CFEL - ASG Software Suite  2.5.0
CASS
cass_event.cpp
Go to the documentation of this file.
1 //Copyright (C) 2010,2013 Lutz Foucar
2 
3 /**
4  * @file cass_event.cpp file contains defintion of the CASSEvent
5  *
6  * @author Lutz Foucar
7  */
8 
9 #include <iostream>
10 
11 #include "cass_event.h"
12 
13 #include "acqiris_device.hpp"
14 #include "acqiristdc_device.hpp"
15 #include "machine_device.hpp"
16 #include "pixeldetector.hpp"
17 
18 using namespace cass;
19 
21  : Serializable(1),
22  _id(0),
23  _datagrambuffer()
24 {
25  //add all devices that are available
30 }
31 
33 {
34  writeVersion(out);
35  /** write the id */
36  out.add(_id);
37  /** write the size of the container */
38  out.add(static_cast<size_t>(_devices.size()));
39  /** for each instrument in the map write the key and then the Instrument */
40  for (devices_t::const_iterator it(_devices.begin()); it != _devices.end(); ++it)
41  {
42  out.add(it->first);
43  it->second->serialize(out);
44  }
45 }
46 
48 {
49  checkVersion(in);
50  _id = in.retrieve<uint64_t>();
51  /** read the number of instruments */
52  size_t nDev(in.retrieve<size_t>());
53  /** read the key of the device and deserialize the right device from the list */
54  for(size_t i(0); i < nDev; ++i)
55  {
56  const devices_t::key_type key(in.retrieve<devices_t::key_type>());
57  _devices[key]->deserialize(in);
58  }
59  return true;
60 }
file contains declaration of the CASSEvent
virtual void writeVersion(SerializerBackend &out) const
write the version to the stream
The Acqiris device.
Container for all Machine related Data.
file contains the declaration of the acqiristdc part of the CASSEvent
The Acqiris TDC device.
void serialize(SerializerBackend &) const
serialize a event to the Serializer
Definition: cass_event.cpp:32
file contains the declaration of the acqiris part of the CASSEvent
bool deserialize(SerializerBackend &)
deserialize an event from the Serializer
Definition: cass_event.cpp:47
virtual void checkVersion(SerializerBackend &in) const
check the version
std::tr1::shared_ptr< DeviceBackend > shared_pointer
a shared pointer of this type
contains container for simple pixel detector data
definitions of a machine device
the device containing pixel detector data
Type retrieve()
read arbitrary value from stream
Definition: serializer.hpp:169
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
void add(const Type &value)
add arbitrary value to the stream
Definition: serializer.hpp:158
CASSEvent()
constructor will create all devices
Definition: cass_event.cpp:20