test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
ora::Selection Class Reference

#include <Selection.h>

Public Member Functions

template<typename Prim >
void addDataItem (const std::string &dataMemberName, SelectionItemType stype, Prim selectionData)
 
void addIndexItem (int startIndex, int endIndex=endOfRange)
 
void addUntypedDataItem (const std::string &dataMemberName, SelectionItemType stype, const std::type_info &primitiveType, void *data)
 
const coral::AttributeList & data () const
 
bool isEmpty () const
 
const std::vector< std::pair
< std::string, std::string > > & 
items () const
 
Selectionoperator= (const Selection &rhs)
 
 Selection ()
 
 Selection (const Selection &rhs)
 
virtual ~Selection ()
 

Static Public Member Functions

static std::string indexVariable ()
 
static const std::vector
< std::string > & 
selectionTypes ()
 
static std::string variableNameFromUniqueString (const std::string &uniqueString)
 

Static Public Attributes

static const int endOfRange = -1
 

Private Member Functions

std::string uniqueVariableName (const std::string &varName) const
 

Private Attributes

std::auto_ptr
< coral::AttributeList > 
m_data
 
std::vector< std::pair
< std::string, std::string > > 
m_items
 

Detailed Description

Definition at line 18 of file Selection.h.

Constructor & Destructor Documentation

Selection< C, Selector, StoreContainer >::Selection ( )

Definition at line 25 of file Selection.cc.

25  :m_items(),m_data( new coral::AttributeList ){
26 }
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
std::auto_ptr< coral::AttributeList > m_data
Definition: Selection.h:55
Selection< C, Selector, StoreContainer >::~Selection ( )
virtual

Definition at line 28 of file Selection.cc.

28  {
29 }
Selection< C, Selector, StoreContainer >::Selection ( const Selection rhs)

Definition at line 31 of file Selection.cc.

31  :
32  m_items( rhs.m_items ),
33  m_data( new coral::AttributeList( *rhs.m_data )){
34 }
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
std::auto_ptr< coral::AttributeList > m_data
Definition: Selection.h:55

Member Function Documentation

template<typename Prim >
void Selection< Prim >::addDataItem ( const std::string &  dataMemberName,
ora::SelectionItemType  stype,
Prim  selectionData 
)

Definition at line 60 of file Selection.h.

References addUntypedDataItem().

60  {
61  addUntypedDataItem( dataMemberName, stype, typeid( Prim ), &selectionData );
62 }
void addUntypedDataItem(const std::string &dataMemberName, SelectionItemType stype, const std::type_info &primitiveType, void *data)
Definition: Selection.cc:91
void Selection< C, Selector, StoreContainer >::addIndexItem ( int  startIndex,
int  endIndex = endOfRange 
)

Definition at line 62 of file Selection.cc.

References ora::EQ, ora::GE, ora::LE, AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().

Referenced by ora::QueryableVector< Tp >::select().

63  {
64  if(endIndex<startIndex && endIndex>=0) {
65  throwException("Cannot select with endIndex<startIndex.",
66  "Selection::addIndexItem");
67  } else if( startIndex==endIndex && endIndex>=0){
69  SelectionItemType selType = ora::EQ;
70  m_items.push_back(std::make_pair(varName,selectionTypes()[selType]));
71  m_data->extend<int>(varName);
72  (*m_data)[varName].data<int>() = startIndex;
73  } else {
74  if(startIndex>0){
76  SelectionItemType firstType = ora::GE;
77  m_items.push_back(std::make_pair(varName0,selectionTypes()[firstType]));
78  m_data->extend<int>(varName0);
79  (*m_data)[varName0].data<int>() = startIndex;
80  }
81  if(endIndex>0){
83  SelectionItemType secondType = ora::LE;
84  m_items.push_back(std::make_pair(varName1,selectionTypes()[secondType]));
85  m_data->extend<int>(varName1);
86  (*m_data)[varName1].data<int>() = endIndex;
87  }
88  }
89 }
std::string uniqueVariableName(const std::string &varName) const
Definition: Selection.cc:43
static std::string indexVariable()
Definition: Selection.cc:20
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
std::auto_ptr< coral::AttributeList > m_data
Definition: Selection.h:55
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
static const std::vector< std::string > & selectionTypes()
Definition: Selection.cc:9
SelectionItemType
Definition: Selection.h:16
void Selection< C, Selector, StoreContainer >::addUntypedDataItem ( const std::string &  dataMemberName,
SelectionItemType  stype,
const std::type_info &  primitiveType,
void *  data 
)

Definition at line 91 of file Selection.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by addDataItem().

94  {
95  std::string varName = uniqueVariableName( dataMemberName );
96  m_items.push_back(std::make_pair(varName,selectionTypes()[stype]));
97  m_data->extend( varName, primitiveType );
98  (*m_data)[varName].setValueFromAddress( data );
99 }
std::string uniqueVariableName(const std::string &varName) const
Definition: Selection.cc:43
const coral::AttributeList & data() const
Definition: Selection.cc:112
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
std::auto_ptr< coral::AttributeList > m_data
Definition: Selection.h:55
static const std::vector< std::string > & selectionTypes()
Definition: Selection.cc:9
const coral::AttributeList & Selection< C, Selector, StoreContainer >::data ( ) const
std::string Selection< C, Selector, StoreContainer >::indexVariable ( )
static

Definition at line 20 of file Selection.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ora::QVQueryMaker::setQueryCondition().

20  {
21  static const std::string s_var("ora::ContainerIndex");
22  return s_var;
23 }
bool Selection< C, Selector, StoreContainer >::isEmpty ( ) const

Definition at line 102 of file Selection.cc.

102  {
103  return m_items.empty();
104 }
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
const std::vector< std::pair< std::string, std::string > > & Selection< C, Selector, StoreContainer >::items ( ) const

Definition at line 107 of file Selection.cc.

Referenced by python.rootplot.core.Options::kwarg_list(), and ora::QVQueryMaker::setQueryCondition().

107  {
108  return m_items;
109 }
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
ora::Selection & Selection< C, Selector, StoreContainer >::operator= ( const Selection rhs)

Definition at line 36 of file Selection.cc.

References m_data, and m_items.

36  {
37  m_items = rhs.m_items;
38  m_data.reset( new coral::AttributeList( *rhs.m_data ) );
39  return *this;
40 }
std::vector< std::pair< std::string, std::string > > m_items
Definition: Selection.h:54
std::auto_ptr< coral::AttributeList > m_data
Definition: Selection.h:55
const std::vector< std::string > & Selection< C, Selector, StoreContainer >::selectionTypes ( )
static

Definition at line 9 of file Selection.cc.

9  {
10  static const std::vector<std::string> types = { "=","!=",">",">=","<","<=" };
11  return types;
12 }
std::string Selection< C, Selector, StoreContainer >::uniqueVariableName ( const std::string &  varName) const
private

Definition at line 43 of file Selection.cc.

References newFWLiteAna::found, and i.

43  {
44  std::stringstream uniqueVarName;
45  unsigned int i = 0;
46  bool notUnique = true;
47  while(notUnique){
48  bool found = false;
49  uniqueVarName.str("");
50  uniqueVarName << varName;
51  uniqueVarName << "_" << i;
52  for(coral::AttributeList::const_iterator iAttr = m_data->begin();
53  iAttr!=m_data->end() && !found; ++iAttr){
54  if( iAttr->specification().name() == uniqueVarName.str() ) found = true;
55  }
56  notUnique = found;
57  i++;
58  }
59  return uniqueVarName.str();
60 }
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< coral::AttributeList > m_data
Definition: Selection.h:55
std::string Selection< C, Selector, StoreContainer >::variableNameFromUniqueString ( const std::string &  uniqueString)
static

Definition at line 14 of file Selection.cc.

Referenced by ora::QVQueryMaker::setQueryCondition().

15 {
16  size_t ind = uniqueString.rfind("_");
17  return uniqueString.substr(0,ind);
18 }

Member Data Documentation

const int ora::Selection::endOfRange = -1
static

Definition at line 21 of file Selection.h.

std::auto_ptr<coral::AttributeList> ora::Selection::m_data
private

Definition at line 55 of file Selection.h.

Referenced by operator=().

std::vector<std::pair<std::string,std::string> > ora::Selection::m_items
private

Definition at line 54 of file Selection.h.

Referenced by operator=().