Public Member Functions | Private Attributes | List of all members
lariov::Snapshot< T > Class Template Reference

#include <Snapshot.h>

Public Member Functions

 Snapshot ()
 Default constructor. More...
 
 ~Snapshot ()
 Default destructor. More...
 
void Clear ()
 
const IOVTimeStampStart () const
 
const IOVTimeStampEnd () const
 
void SetIoV (const IOVTimeStamp &start, const IOVTimeStamp &end)
 
bool IsValid (const IOVTimeStamp &ts) const
 
size_t NChannels () const
 
const std::vector< T > & Data () const
 
template<class U = T, typename std::enable_if< std::is_base_of< ChData, U >::value, int >::type = 0>
bool HasChannel (unsigned int ch) const
 Only included with class if T has base class ChData. More...
 
template<class U = T, typename std::enable_if< std::is_base_of< ChData, U >::value, int >::type = 0>
const T & GetRow (unsigned int ch) const
 
template<class U = T, typename std::enable_if< std::is_base_of< ChData, U >::value, int >::type = 0>
void AddOrReplaceRow (const T &data)
 

Private Attributes

IOVTimeStamp fStart
 
IOVTimeStamp fEnd
 
std::vector< T > fData
 

Detailed Description

template<class T>
class lariov::Snapshot< T >

Definition at line 31 of file Snapshot.h.

Constructor & Destructor Documentation

template<class T>
lariov::Snapshot< T >::Snapshot ( )
inline

Default constructor.

Definition at line 36 of file Snapshot.h.

36  :
37  fStart(0,0), fEnd(0,0) {}
IOVTimeStamp fEnd
Definition: Snapshot.h:100
IOVTimeStamp fStart
Definition: Snapshot.h:99
template<class T>
lariov::Snapshot< T >::~Snapshot ( )
inline

Default destructor.

Definition at line 40 of file Snapshot.h.

40 {}

Member Function Documentation

template<class T>
template<class U = T, typename std::enable_if< std::is_base_of< ChData, U >::value, int >::type = 0>
void lariov::Snapshot< T >::AddOrReplaceRow ( const T &  data)
inline

Definition at line 85 of file Snapshot.h.

85  {
86  typename std::vector<T>::iterator it = std::lower_bound(fData.begin(), fData.end(), data.Channel());
87  if (it == fData.end() || data.Channel() != it->Channel() ) {
88  bool sort = ( !(fData.empty()) && data < fData.back());
89  fData.push_back(data);
90  if (sort) std::sort(fData.begin(), fData.end());
91  }
92  else {
93  *it = data;
94  }
95  }
intermediate_table::iterator iterator
std::vector< T > fData
Definition: Snapshot.h:101
template<class T >
void lariov::Snapshot< T >::Clear ( void  )

Definition at line 108 of file Snapshot.h.

108  {
109  fData.clear();
112  }
void SetStamp(unsigned long stamp, unsigned int substamp=0)
Definition: IOVTimeStamp.h:41
std::vector< T > fData
Definition: Snapshot.h:101
IOVTimeStamp fEnd
Definition: Snapshot.h:100
unsigned long SubStamp() const
Definition: IOVTimeStamp.h:38
IOVTimeStamp fStart
Definition: Snapshot.h:99
unsigned long Stamp() const
Definition: IOVTimeStamp.h:37
static IOVTimeStamp MaxTimeStamp()
template<class T>
const std::vector<T>& lariov::Snapshot< T >::Data ( void  ) const
inline

Definition at line 52 of file Snapshot.h.

52 {return fData;}
std::vector< T > fData
Definition: Snapshot.h:101
template<class T>
const IOVTimeStamp& lariov::Snapshot< T >::End ( void  ) const
inline

Definition at line 45 of file Snapshot.h.

45 {return fEnd;}
IOVTimeStamp fEnd
Definition: Snapshot.h:100
template<class T>
template<class U = T, typename std::enable_if< std::is_base_of< ChData, U >::value, int >::type = 0>
const T& lariov::Snapshot< T >::GetRow ( unsigned int  ch) const
inline

Definition at line 70 of file Snapshot.h.

70  {
71 
72  typename std::vector<T>::const_iterator it = std::lower_bound(fData.begin(), fData.end(), ch);
73 
74  if ( it == fData.end() || it->Channel() != ch ) {
75  std::string msg("Channel not found: ");
76  msg += std::to_string(ch);
77  throw IOVDataError(msg);
78  }
79 
80  return *it;
81  }
void msg(const char *fmt,...)
Definition: message.cpp:107
std::string string
Definition: nybbler.cc:12
std::vector< T > fData
Definition: Snapshot.h:101
intermediate_table::const_iterator const_iterator
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
template<class T>
template<class U = T, typename std::enable_if< std::is_base_of< ChData, U >::value, int >::type = 0>
bool lariov::Snapshot< T >::HasChannel ( unsigned int  ch) const
inline

Only included with class if T has base class ChData.

Definition at line 59 of file Snapshot.h.

59  {
60 
61  typename std::vector<T>::const_iterator it = std::lower_bound(fData.begin(), fData.end(), ch);
62  if ( it == fData.end() || it->Channel() != ch) {
63  return false;
64  }
65  else return true;
66  }
std::vector< T > fData
Definition: Snapshot.h:101
intermediate_table::const_iterator const_iterator
template<class T >
bool lariov::Snapshot< T >::IsValid ( const IOVTimeStamp ts) const

Definition at line 125 of file Snapshot.h.

125  {
126  return (ts >= fStart && ts < fEnd);
127  }
IOVTimeStamp fEnd
Definition: Snapshot.h:100
IOVTimeStamp fStart
Definition: Snapshot.h:99
template<class T>
size_t lariov::Snapshot< T >::NChannels ( ) const
inline

Definition at line 50 of file Snapshot.h.

50 {return fData.size();}
std::vector< T > fData
Definition: Snapshot.h:101
template<class T >
void lariov::Snapshot< T >::SetIoV ( const IOVTimeStamp start,
const IOVTimeStamp end 
)

Definition at line 115 of file Snapshot.h.

115  {
116  if (start >= end) {
117  throw IOVDataError("Called Snapshot::SetIoV with start timestamp >= end timestamp!");
118  }
119 
120  fStart = start;
121  fEnd = end;
122  }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
IOVTimeStamp fEnd
Definition: Snapshot.h:100
IOVTimeStamp fStart
Definition: Snapshot.h:99
template<class T>
const IOVTimeStamp& lariov::Snapshot< T >::Start ( ) const
inline

Definition at line 44 of file Snapshot.h.

44 {return fStart;}
IOVTimeStamp fStart
Definition: Snapshot.h:99

Member Data Documentation

template<class T>
std::vector<T> lariov::Snapshot< T >::fData
private

Definition at line 101 of file Snapshot.h.

template<class T>
IOVTimeStamp lariov::Snapshot< T >::fEnd
private

Definition at line 100 of file Snapshot.h.

template<class T>
IOVTimeStamp lariov::Snapshot< T >::fStart
private

Definition at line 99 of file Snapshot.h.


The documentation for this class was generated from the following file: