#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) |
const coral::AttributeList & | data () const |
bool | isEmpty () const |
const std::vector< std::pair < std::string, std::string > > & | items () const |
Selection () | |
virtual | ~Selection () |
Static Public Member Functions | |
static std::string | indexVariable () |
static 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 | |
coral::AttributeList | m_data |
std::vector< std::pair < std::string, std::string > > | m_items |
Definition at line 15 of file Selection.h.
Definition at line 28 of file Selection.cc.
Definition at line 31 of file Selection.cc.
{ }
void Selection< Prim >::addDataItem | ( | const std::string & | dataMemberName, |
ora::SelectionItemType | stype, | ||
Prim | selectionData | ||
) |
Definition at line 51 of file Selection.h.
References m_data, m_items, selectionTypes(), and uniqueVariableName().
{ std::string varName = uniqueVariableName( dataMemberName ); m_items.push_back(std::make_pair(varName,selectionTypes()[stype])); m_data.extend<Prim>(varName); m_data[varName].data<Prim>()=selectionData; }
void Selection< C, Selector, StoreContainer >::addIndexItem | ( | int | startIndex, |
int | endIndex = endOfRange |
||
) |
Definition at line 54 of file Selection.cc.
References ora::EQ, ora::GE, ora::LE, and ora::throwException().
Referenced by ora::QueryableVector< Tp >::select().
{ if(endIndex<startIndex && endIndex>=0) { throwException("Cannot select with endIndex<startIndex.", "Selection::addIndexItem"); } else if( startIndex==endIndex && endIndex>=0){ std::string varName = uniqueVariableName( indexVariable() ); SelectionItemType selType = ora::EQ; m_items.push_back(std::make_pair(varName,selectionTypes()[selType])); m_data.extend<int>(varName); m_data[varName].data<int>() = startIndex; } else { if(startIndex>0){ std::string varName0 = uniqueVariableName( indexVariable() ); SelectionItemType firstType = ora::GE; m_items.push_back(std::make_pair(varName0,selectionTypes()[firstType])); m_data.extend<int>(varName0); m_data[varName0].data<int>() = startIndex; } if(endIndex>0){ std::string varName1 = uniqueVariableName( indexVariable() ); SelectionItemType secondType = ora::LE; m_items.push_back(std::make_pair(varName1,selectionTypes()[secondType])); m_data.extend<int>(varName1); m_data[varName1].data<int>() = endIndex; } } }
Definition at line 93 of file Selection.cc.
{ return m_data; }
Definition at line 23 of file Selection.cc.
Referenced by ora::QVReader::setQueryCondition().
{ static std::string s_var("ora::ContainerIndex"); return s_var; }
Definition at line 83 of file Selection.cc.
{ return m_items.empty(); }
const std::vector< std::pair< std::string, std::string > > & Selection< C, Selector, StoreContainer >::items | ( | ) | const |
Definition at line 88 of file Selection.cc.
{ return m_items; }
Definition at line 6 of file Selection.cc.
Referenced by addDataItem().
{ static std::vector<std::string> types; types.push_back("="); types.push_back("!="); types.push_back(">"); types.push_back(">="); types.push_back("<"); types.push_back("<="); return types; }
std::string Selection< C, Selector, StoreContainer >::uniqueVariableName | ( | const std::string & | varName | ) | const [private] |
Definition at line 35 of file Selection.cc.
References newFWLiteAna::found, and i.
Referenced by addDataItem().
{ std::stringstream uniqueVarName; unsigned int i = 0; bool notUnique = true; while(notUnique){ bool found = false; uniqueVarName.str(""); uniqueVarName << varName; uniqueVarName << "_" << i; for(coral::AttributeList::const_iterator iAttr = m_data.begin(); iAttr!=m_data.end() && !found; ++iAttr){ if( iAttr->specification().name() == uniqueVarName.str() ) found = true; } notUnique = found; i++; } return uniqueVarName.str(); }
std::string Selection< C, Selector, StoreContainer >::variableNameFromUniqueString | ( | const std::string & | uniqueString | ) | [static] |
Definition at line 17 of file Selection.cc.
Referenced by ora::QVReader::setQueryCondition().
{ size_t ind = uniqueString.rfind("_"); return uniqueString.substr(0,ind); }
const int ora::Selection::endOfRange = -1 [static] |
Definition at line 18 of file Selection.h.
coral::AttributeList ora::Selection::m_data [private] |
Definition at line 46 of file Selection.h.
Referenced by addDataItem().
std::vector<std::pair<std::string,std::string> > ora::Selection::m_items [private] |
Definition at line 45 of file Selection.h.
Referenced by addDataItem().