CMS 3D CMS Logo

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 
21 class VFATFrameCollection {
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 
67  void Next() { value = collection->NextIterator(value); }
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
VFATFrameCollection::VFATFrameCollection
VFATFrameCollection()
Definition: VFATFrameCollection.h:27
VFATFrameCollection::Iterator
the VFATFrameCollection interator
Definition: VFATFrameCollection.h:49
VFATFrameCollection::GetFrameByIndex
virtual const VFATFrame * GetFrameByIndex(TotemFramePosition index) const =0
returns frame at given position in Slink frame
VFATFrameCollection::GetFrameByID
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...
VFATFrameCollection::NextIterator
virtual value_type NextIterator(const value_type &) const =0
shifts the iterator
VFATFrameCollection::Iterator::Data
const VFATFrame * Data()
returns the frame data of the current element
Definition: VFATFrameCollection.h:68
VFATFrameCollection::Iterator::IsEnd
bool IsEnd()
returns whether the iterator points over the end of the collection
Definition: VFATFrameCollection.h:74
VFATFrameCollection::Iterator::Position
TotemFramePosition Position()
returns the DAQ position of the current element
Definition: VFATFrameCollection.h:65
VFATFrameCollection::value_type
std::pair< TotemFramePosition, const VFATFrame * > value_type
pair: frame DAQ position, frame data
Definition: VFATFrameCollection.h:46
VFATFrameCollection::Iterator::collection
const VFATFrameCollection * collection
the pointer to the collection
Definition: VFATFrameCollection.h:55
VFATFrameCollection::Size
virtual unsigned int Size() const =0
return the number of VFAT frames in the collection
VFATFrameCollection::IsEndIterator
virtual bool IsEndIterator(const value_type &) const =0
checks whether the iterator points over the end of the collection
VFATFrameCollection::Empty
virtual bool Empty() const =0
returns whether the collection is empty
align::ID
uint32_t ID
Definition: Definitions.h:24
TotemFramePosition
Definition: TotemFramePosition.h:31
VFATFrame.h
VFATFrameCollection::BeginIterator
virtual value_type BeginIterator() const =0
returns the beginning of the collection
TotemFramePosition.h
value
Definition: value.py:1
VFATFrameCollection::~VFATFrameCollection
virtual ~VFATFrameCollection()
Definition: VFATFrameCollection.h:28
VFATFrameCollection::Iterator::Iterator
Iterator(const VFATFrameCollection *c=nullptr)
constructor, automatically sets the iterator to the beginning
Definition: VFATFrameCollection.h:59
VFATFrame
Definition: VFATFrame.h:18
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
VFATFrameCollection::Iterator::value
value_type value
interator value
Definition: VFATFrameCollection.h:52
VFATFrameCollection::Iterator::Next
void Next()
shifts the iterator
Definition: VFATFrameCollection.h:71
VFATFrameCollection
Definition: VFATFrameCollection.h:20
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
VFATFrameCollection::GetFrameByIndexID
virtual const VFATFrame * GetFrameByIndexID(TotemFramePosition index, unsigned int ID)
returns frame at given position in Slink frame and checks 12bit ID
Definition: VFATFrameCollection.cc:10