CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VFATFrameCollection.h
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of the TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
9 #ifndef EventFilter_CTPPSRawToDigi_VFATFrameCollection
10 #define EventFilter_CTPPSRawToDigi_VFATFrameCollection
11 
13 
15 
16 #include <string>
17 
22 public:
24  virtual ~VFATFrameCollection() {}
25 
27  virtual const VFATFrame* GetFrameByID(unsigned int ID) const = 0;
28 
30  virtual const VFATFrame* GetFrameByIndex(TotemFramePosition index) const = 0;
31 
33  virtual const VFATFrame* GetFrameByIndexID(TotemFramePosition index, unsigned int ID);
34 
36  virtual unsigned int Size() const = 0;
37 
39  virtual bool Empty() const = 0;
40 
42  typedef std::pair<TotemFramePosition, const VFATFrame*> value_type;
43 
45  class Iterator {
46  protected:
49 
52 
53  public:
55  Iterator(const VFATFrameCollection* c = nullptr) : collection(c) {
56  if (collection)
58  }
59 
61  TotemFramePosition Position() { return value.first; }
62 
64  const VFATFrame* Data() { return value.second; }
65 
68 
70  bool IsEnd() { return collection->IsEndIterator(value); }
71  };
72 
73 protected:
75  virtual value_type BeginIterator() const = 0;
76 
78  virtual value_type NextIterator(const value_type&) const = 0;
79 
81  virtual bool IsEndIterator(const value_type&) const = 0;
82 };
83 
84 #endif
Iterator(const VFATFrameCollection *c=nullptr)
constructor, automatically sets the iterator to the beginning
void Next()
shifts the iterator
TotemFramePosition Position()
returns the DAQ position of the current element
virtual const VFATFrame * GetFrameByIndex(TotemFramePosition index) const =0
returns frame at given position in Slink frame
const edm::EventSetup & c
uint32_t ID
Definition: Definitions.h:24
virtual const VFATFrame * GetFrameByID(unsigned int ID) const =0
returns pointer to frame with ID, performs NO duplicity check (if there is precisely one frame with t...
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
virtual value_type BeginIterator() const =0
returns the beginning of the collection
virtual unsigned int Size() const =0
return the number of VFAT frames in the collection
the VFATFrameCollection interator
virtual const VFATFrame * GetFrameByIndexID(TotemFramePosition index, unsigned int ID)
returns frame at given position in Slink frame and checks 12bit ID
const VFATFrame * Data()
returns the frame data of the current element
virtual bool IsEndIterator(const value_type &) const =0
checks whether the iterator points over the end of the collection
value_type value
interator value
virtual value_type NextIterator(const value_type &) const =0
shifts the iterator
bool IsEnd()
returns whether the iterator points over the end of the collection
virtual bool Empty() const =0
returns whether the collection is empty
const VFATFrameCollection * collection
the pointer to the collection