CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
CondIter< DataT > Class Template Reference

#include <CondIter.h>

Inheritance diagram for CondIter< DataT >:
CondBasicIter

Public Member Functions

virtual void clear ()
 
 CondIter (bool cacheIt=false)
 
DataT const * next ()
 
void reset ()
 
void rewind ()
 
virtual ~CondIter ()
 
- Public Member Functions inherited from CondBasicIter
 CondBasicIter ()
 
 CondBasicIter (const std::string &NameDB, const std::string &Tag, const std::string &User, const std::string &Pass, const std::string &nameBlob="")
 
 CondBasicIter (const std::string &NameDB, const std::string &Tag, const std::string &auth="")
 
void create (const std::string &NameDB, const std::string &Tag, const std::string &User, const std::string &Pass, const std::string &nameBlob="")
 
void create (const std::string &NameDB, const std::string &Tag, const std::string &auth="")
 
bool forward ()
 
unsigned int getStartTime () const
 
unsigned int getStopTime () const
 
unsigned int getTime () const
 
std::string getToken () const
 
bool init ()
 
bool make ()
 
void setMax (unsigned int max)
 
void setMin (unsigned int min)
 
void setRange (unsigned int min, unsigned int max)
 
virtual ~CondBasicIter ()
 

Protected Member Functions

virtual bool load (cond::DbSession &sess, std::string const &itoken)
 

Private Attributes

std::vector< cond::PayloadRef
< DataT > > 
cache
 
cond::PayloadRef< DataT > data
 
bool initialized
 
size_t n
 
bool useCache
 

Additional Inherited Members

- Protected Attributes inherited from CondBasicIter
cond::CondDB db
 
cond::IOVProxy iov
 
cond::IOVProxy::const_iterator iter
 
cond::RDBMS rdbms
 

Detailed Description

template<class DataT>
class CondIter< DataT >

Definition at line 13 of file CondIter.h.

Constructor & Destructor Documentation

template<class DataT>
CondIter< DataT >::CondIter ( bool  cacheIt = false)
inline

Definition at line 35 of file CondIter.h.

35 : initialized(false), useCache(cacheIt),n(0){}
bool initialized
Definition: CondIter.h:26
size_t n
Definition: CondIter.h:30
bool useCache
Definition: CondIter.h:27
template<class DataT>
virtual CondIter< DataT >::~CondIter ( )
inlinevirtual

Definition at line 36 of file CondIter.h.

36 {}

Member Function Documentation

template<class DataT>
virtual void CondIter< DataT >::clear ( void  )
inlinevirtual
template<class DataT>
virtual bool CondIter< DataT >::load ( cond::DbSession sess,
std::string const &  itoken 
)
inlineprotectedvirtual

Implements CondBasicIter.

Definition at line 16 of file CondIter.h.

Referenced by MatrixToProcess.MatrixToProcess::getProcess(), and MatrixToProcess.MatrixToProcess::listAll().

16  {
17  if (useCache)
18  if (n>=cache.size()) {
19  cache.resize(n+1);
20  return cache.back().load(sess,itoken);
21  } else return true;
22  else return data.load(sess,itoken);
23  }
cond::PayloadRef< DataT > data
Definition: CondIter.h:28
size_t n
Definition: CondIter.h:30
std::vector< cond::PayloadRef< DataT > > cache
Definition: CondIter.h:29
bool useCache
Definition: CondIter.h:27
template<class DataT>
DataT const* CondIter< DataT >::next ( void  )
inline

Obtain the pointer to an object T. If it is the last T the method returns a null pointer.

Definition at line 52 of file CondIter.h.

Referenced by BeautifulSoup.PageElement::_invert().

52  {
53  bool ok=false;
54  if (!initialized) {
55  n=0;
56  ok =init();
57  initialized=true;
58  }
59  else {
60  ++n;
61  ok = forward();
62  }
63  if (!ok) return 0;
64  ok = make();
65  if (!ok) return 0;
66  return useCache ? &(*cache[n]) : &(*data);
67 
68  }
cond::PayloadRef< DataT > data
Definition: CondIter.h:28
bool initialized
Definition: CondIter.h:26
size_t n
Definition: CondIter.h:30
std::vector< cond::PayloadRef< DataT > > cache
Definition: CondIter.h:29
bool useCache
Definition: CondIter.h:27
template<class DataT>
void CondIter< DataT >::reset ( void  )
inline

Definition at line 39 of file CondIter.h.

Referenced by MatrixReader.MatrixReader::__init__(), CondIter< T >::clear(), CondIter< T >::rewind(), and MatrixReader.MatrixReader::showRaw().

39 { initialized=false; data.clear();}
cond::PayloadRef< DataT > data
Definition: CondIter.h:28
bool initialized
Definition: CondIter.h:26
template<class DataT>
void CondIter< DataT >::rewind ( )
inline

Definition at line 41 of file CondIter.h.

41 { reset();}
void reset()
Definition: CondIter.h:39

Member Data Documentation

template<class DataT>
std::vector<cond::PayloadRef<DataT> > CondIter< DataT >::cache
private

Definition at line 29 of file CondIter.h.

Referenced by CondIter< T >::clear(), CondIter< T >::load(), and CondIter< T >::next().

template<class DataT>
cond::PayloadRef<DataT> CondIter< DataT >::data
private
template<class DataT>
bool CondIter< DataT >::initialized
private

Definition at line 26 of file CondIter.h.

Referenced by CondIter< T >::next(), and CondIter< T >::reset().

template<class DataT>
size_t CondIter< DataT >::n
private

Definition at line 30 of file CondIter.h.

Referenced by CondIter< T >::load(), and CondIter< T >::next().

template<class DataT>
bool CondIter< DataT >::useCache
private

Definition at line 27 of file CondIter.h.

Referenced by CondIter< T >::load(), and CondIter< T >::next().