CMS 3D CMS Logo

SimpleVFATFrameCollection.h
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Mate Csanad (mate.csanad@cern.ch)
6 * Jan Kašpar (jan.kaspar@gmail.com)
7 *
8 ****************************************************************************/
9 
10 
11 #ifndef EventFilter_CTPPSRawToDigi_SimpleVFATFrameCollection
12 #define EventFilter_CTPPSRawToDigi_SimpleVFATFrameCollection
13 
15 
16 #include <map>
17 
22 {
23  protected:
24  typedef std::map<TotemFramePosition, VFATFrame> MapType;
25 
26  MapType data;
27 
28  value_type BeginIterator() const override;
29  value_type NextIterator(const value_type&) const override;
30  bool IsEndIterator(const value_type&) const override;
31 
32  public:
34  ~SimpleVFATFrameCollection() override;
35 
36  const VFATFrame* GetFrameByID(unsigned int ID) const override;
37  const VFATFrame* GetFrameByIndex(TotemFramePosition index) const override;
38 
39  unsigned int Size() const override
40  {
41  return data.size();
42  }
43 
44  bool Empty() const override
45  {
46  return (data.empty());
47  }
48 
50  {
51  data.insert({index, frame});
52  }
53 
56  {
57  return &data.insert({index, VFATFrame()}).first->second;
58  }
59 
61  void Clear()
62  {
63  data.clear();
64  }
65 };
66 
67 #endif
unsigned int Size() const override
return the number of VFAT frames in the collection
const VFATFrame * GetFrameByIndex(TotemFramePosition index) const override
returns frame at given position in Slink frame
uint32_t ID
Definition: Definitions.h:26
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
bool Empty() const override
returns whether the collection is empty
std::map< TotemFramePosition, VFATFrame > MapType
void Clear()
cleans completely the collection
value_type NextIterator(const value_type &) const override
shifts the iterator
const VFATFrame * GetFrameByID(unsigned int ID) const override
returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with t...
VFATFrame * InsertEmptyFrame(TotemFramePosition index)
inserts an empty (default) frame to the given position and returns pointer to the frame ...
bool IsEndIterator(const value_type &) const override
checks whether the iterator points over the end of the collection
value_type BeginIterator() const override
returns the beginning of the collection
void Insert(const TotemFramePosition &index, const VFATFrame &frame)