CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_TotemRawToDigi_SimpleVFATFrameCollection
12 #define EventFilter_TotemRawToDigi_SimpleVFATFrameCollection
13 
15 
16 #include <map>
17 
22 {
23  protected:
24  typedef std::map<TotemFramePosition, VFATFrame> MapType;
25 
27 
28  virtual value_type BeginIterator() const;
29  virtual value_type NextIterator(const value_type&) const;
30  virtual bool IsEndIterator(const value_type&) const;
31 
32  public:
35 
36  const VFATFrame* GetFrameByID(unsigned int ID) const;
38 
39  virtual unsigned int Size() const
40  {
41  return data.size();
42  }
43 
44  virtual bool Empty() const
45  {
46  return (data.size() == 0);
47  }
48 
49  void Insert(const TotemFramePosition &index, const VFATFrame &frame)
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
const VFATFrame * GetFrameByID(unsigned int ID) const
returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with t...
uint32_t ID
Definition: Definitions.h:26
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
std::map< TotemFramePosition, VFATFrame > MapType
void Clear()
cleans completely the collection
const VFATFrame * GetFrameByIndex(TotemFramePosition index) const
returns frame at given position in Slink frame
VFATFrame * InsertEmptyFrame(TotemFramePosition index)
inserts an empty (default) frame to the given position and returns pointer to the frame ...
virtual value_type NextIterator(const value_type &) const
shifts the iterator
virtual unsigned int Size() const
return the number of VFAT frames in the collection
virtual bool IsEndIterator(const value_type &) const
checks whether the iterator points over the end of the collection
virtual value_type BeginIterator() const
returns the beginning of the collection
virtual bool Empty() const
returns whether the collection is empty
void Insert(const TotemFramePosition &index, const VFATFrame &frame)