6 #include "CoralBase/AttributeList.h"
7 #include "CoralBase/Attribute.h"
10 static const std::vector<std::string> types = {
"=",
"!=",
">",
">=",
"<",
"<=" };
16 size_t ind = uniqueString.rfind(
"_");
17 return uniqueString.substr(0,ind);
21 static const std::string s_var(
"ora::ContainerIndex");
32 m_items( rhs.m_items ),
33 m_data( new coral::AttributeList( *rhs.m_data )){
38 m_data.reset(
new coral::AttributeList( *rhs.
m_data ) );
44 std::stringstream uniqueVarName;
46 bool notUnique =
true;
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;
59 return uniqueVarName.str();
64 if(endIndex<startIndex && endIndex>=0) {
66 "Selection::addIndexItem");
67 }
else if( startIndex==endIndex && endIndex>=0){
68 std::string varName = uniqueVariableName( indexVariable() );
70 m_items.push_back(std::make_pair(varName,selectionTypes()[selType]));
71 m_data->extend<
int>(varName);
72 (*m_data)[varName].data<
int>() = startIndex;
75 std::string varName0 = uniqueVariableName( indexVariable() );
77 m_items.push_back(std::make_pair(varName0,selectionTypes()[firstType]));
78 m_data->extend<
int>(varName0);
79 (*m_data)[varName0].data<
int>() = startIndex;
82 std::string varName1 = uniqueVariableName( indexVariable() );
84 m_items.push_back(std::make_pair(varName1,selectionTypes()[secondType]));
85 m_data->extend<
int>(varName1);
86 (*m_data)[varName1].data<
int>() = endIndex;
93 const std::type_info& primitiveType,
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 );
103 return m_items.empty();
106 const std::vector<std::pair<std::string,std::string> >&
111 const coral::AttributeList&
std::string uniqueVariableName(const std::string &varName) const
const coral::AttributeList & data() const
Selection & operator=(const Selection &rhs)
static std::string variableNameFromUniqueString(const std::string &uniqueString)
static std::string indexVariable()
std::vector< std::pair< std::string, std::string > > m_items
void addIndexItem(int startIndex, int endIndex=endOfRange)
std::auto_ptr< coral::AttributeList > m_data
void addUntypedDataItem(const std::string &dataMemberName, SelectionItemType stype, const std::type_info &primitiveType, void *data)
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
const std::vector< std::pair< std::string, std::string > > & items() const
static const std::vector< std::string > & selectionTypes()