CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes
RecordHelper< TOutput > Class Template Reference

#include <RecordHelper.h>

Public Types

typedef coral::AttributeList AttributeList
 
typedef std::vector< FieldHandlerBase< TOutput > * > FieldVector
 

Public Member Functions

template<typename TField >
void addField (const std::string &fieldName, void(TOutput::*setter)(const TField))
 
virtual void extractRecord (const AttributeList &source, TOutput &dest)
 
virtual std::vector< std::string > getColumnList ()
 
virtual ~RecordHelper ()
 

Protected Attributes

FieldVector fields_
 

Detailed Description

template<class TOutput>
class RecordHelper< TOutput >

Description: A microframework to deal with the need to fill rather boring getter/setter classes from Coral classes.

Definition at line 151 of file RecordHelper.h.

Member Typedef Documentation

◆ AttributeList

template<class TOutput>
typedef coral::AttributeList RecordHelper< TOutput >::AttributeList

Definition at line 153 of file RecordHelper.h.

◆ FieldVector

template<class TOutput>
typedef std::vector<FieldHandlerBase<TOutput>*> RecordHelper< TOutput >::FieldVector

A list of field handlers that determine how to handle a record.

Definition at line 155 of file RecordHelper.h.

Constructor & Destructor Documentation

◆ ~RecordHelper()

template<class TOutput>
virtual RecordHelper< TOutput >::~RecordHelper ( )
inlinevirtual

Destructor: Wipe out all the field handlers.

Definition at line 185 of file RecordHelper.h.

References RecordHelper< TOutput >::fields_, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

185  {
186  for (typename FieldVector::iterator it = fields_.begin(); it < fields_.end(); ++it) {
187  delete *it;
188  }
189  }
FieldVector fields_
Definition: RecordHelper.h:193

Member Function Documentation

◆ addField()

template<class TOutput>
template<typename TField >
void RecordHelper< TOutput >::addField ( const std::string &  fieldName,
void(TOutput::*)(const TField)  setter 
)
inline

Definition at line 158 of file RecordHelper.h.

References gather_cfg::cout, RecordHelper< TOutput >::fields_, and Skims_PA_cff::name.

158  {
159 #ifdef RECORDHELPER_DEBUG
160  std::cout << "Adding field " << fieldName << ", type = " << typeid(TField).name() << std::endl;
161 #endif
162  this->fields_.push_back(
163  new typename GroupFieldHandler<TOutput, typename Group<TOutput>::Type, TField>::Type(fieldName, setter));
164  }
FieldVector fields_
Definition: RecordHelper.h:193
TStandardGroup Type
Definition: RecordHelper.h:126

◆ extractRecord()

template<class TOutput>
virtual void RecordHelper< TOutput >::extractRecord ( const AttributeList source,
TOutput &  dest 
)
inlinevirtual

Iterates over all known fields and extracts the fields of the record in source to the object in dest.

Definition at line 168 of file RecordHelper.h.

References mps_fire::dest, RecordHelper< TOutput >::fields_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and source.

168  {
169  for (typename FieldVector::const_iterator it = fields_.begin(); it != fields_.end(); ++it) {
170  (*it)->extractValue(source, dest);
171  }
172  }
FieldVector fields_
Definition: RecordHelper.h:193
static std::string const source
Definition: EdmProvDump.cc:49

◆ getColumnList()

template<class TOutput>
virtual std::vector<std::string> RecordHelper< TOutput >::getColumnList ( )
inlinevirtual

Returns a list of database column names for the added fields.

Definition at line 175 of file RecordHelper.h.

References RecordHelper< TOutput >::fields_, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it.

175  {
176  std::vector<std::string> colList;
177  for (typename FieldVector::const_iterator it = fields_.begin(); it != fields_.end(); ++it) {
178  colList.push_back((*it)->getColumnName());
179  }
180 
181  return colList;
182  }
FieldVector fields_
Definition: RecordHelper.h:193

Member Data Documentation

◆ fields_

template<class TOutput>
FieldVector RecordHelper< TOutput >::fields_
protected

List of known fields. TODO: Make private, add base type addField.

Definition at line 193 of file RecordHelper.h.

Referenced by RecordHelper< TOutput >::addField(), RecordHelper< TOutput >::extractRecord(), RecordHelper< TOutput >::getColumnList(), and RecordHelper< TOutput >::~RecordHelper().