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 #ifndef EventFilter_CTPPSRawToDigi_SimpleVFATFrameCollection
11 #define EventFilter_CTPPSRawToDigi_SimpleVFATFrameCollection
12 
14 
15 #include <map>
16 
21 protected:
22  typedef std::map<TotemFramePosition, VFATFrame> MapType;
23 
24  MapType data;
25 
26  value_type BeginIterator() const override;
27  value_type NextIterator(const value_type&) const override;
28  bool IsEndIterator(const value_type&) const override;
29 
30 public:
32  ~SimpleVFATFrameCollection() override;
33 
34  const VFATFrame* GetFrameByID(unsigned int ID) const override;
35  const VFATFrame* GetFrameByIndex(TotemFramePosition index) const override;
36 
37  unsigned int Size() const override { return data.size(); }
38 
39  bool Empty() const override { return (data.empty()); }
40 
41  void Insert(const TotemFramePosition& index, const VFATFrame& frame) { data.insert({index, frame}); }
42 
44  VFATFrame* InsertEmptyFrame(TotemFramePosition index) { return &data.insert({index, VFATFrame()}).first->second; }
45 
47  void Clear() { data.clear(); }
48 };
49 
50 #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:24
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)