File indexing completed on 2024-04-06 12:10:30
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef EventFilter_CTPPSRawToDigi_VFATFrameCollection
0010 #define EventFilter_CTPPSRawToDigi_VFATFrameCollection
0011
0012 #include "CondFormats/PPSObjects/interface/TotemFramePosition.h"
0013
0014 #include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h"
0015
0016 #include <string>
0017
0018
0019
0020
0021 class VFATFrameCollection {
0022 public:
0023 VFATFrameCollection() {}
0024 virtual ~VFATFrameCollection() {}
0025
0026
0027 virtual const VFATFrame* GetFrameByID(unsigned int ID) const = 0;
0028
0029
0030 virtual const VFATFrame* GetFrameByIndex(TotemFramePosition index) const = 0;
0031
0032
0033 virtual const VFATFrame* GetFrameByIndexID(TotemFramePosition index, unsigned int ID);
0034
0035
0036 virtual unsigned int Size() const = 0;
0037
0038
0039 virtual bool Empty() const = 0;
0040
0041
0042 typedef std::pair<TotemFramePosition, const VFATFrame*> value_type;
0043
0044
0045 class Iterator {
0046 protected:
0047
0048 value_type value;
0049
0050
0051 const VFATFrameCollection* collection;
0052
0053 public:
0054
0055 Iterator(const VFATFrameCollection* c = nullptr) : collection(c) {
0056 if (collection)
0057 value = collection->BeginIterator();
0058 }
0059
0060
0061 TotemFramePosition Position() { return value.first; }
0062
0063
0064 const VFATFrame* Data() { return value.second; }
0065
0066
0067 void Next() { value = collection->NextIterator(value); }
0068
0069
0070 bool IsEnd() { return collection->IsEndIterator(value); }
0071 };
0072
0073 protected:
0074
0075 virtual value_type BeginIterator() const = 0;
0076
0077
0078 virtual value_type NextIterator(const value_type&) const = 0;
0079
0080
0081 virtual bool IsEndIterator(const value_type&) const = 0;
0082 };
0083
0084 #endif