CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
10 #ifndef EventFilter_CTPPSRawToDigi_VFATFrameCollection
11 #define EventFilter_CTPPSRawToDigi_VFATFrameCollection
12 
14 
16 
17 #include <string>
18 
23 {
24  public:
26  virtual ~VFATFrameCollection() {}
27 
29  virtual const VFATFrame* GetFrameByID(unsigned int ID) const = 0;
30 
32  virtual const VFATFrame* GetFrameByIndex(TotemFramePosition index) const = 0;
33 
35  virtual const VFATFrame* GetFrameByIndexID(TotemFramePosition index, unsigned int ID);
36 
38  virtual unsigned int Size() const = 0;
39 
41  virtual bool Empty() const = 0;
42 
44  typedef std::pair<TotemFramePosition, const VFATFrame*> value_type;
45 
47  class Iterator {
48  protected:
51 
54 
55  public:
59 
62  { return value.first; }
63 
65  const VFATFrame* Data()
66  { return value.second; }
67 
69  void Next()
71 
73  bool IsEnd()
74  { return collection->IsEndIterator(value); }
75  };
76 
77  protected:
79  virtual value_type BeginIterator() const = 0;
80 
82  virtual value_type NextIterator(const value_type&) const = 0;
83 
85  virtual bool IsEndIterator(const value_type&) const = 0;
86 };
87 
88 #endif
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
Iterator(const VFATFrameCollection *c=NULL)
constructor, automatically sets the iterator to the beginning
uint32_t ID
Definition: Definitions.h:26
#define NULL
Definition: scimark2.h:8
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