6 #include "CoralBase/AttributeList.h"
7 #include "CoralBase/Attribute.h"
10 static std::vector<std::string> types;
12 types.push_back(
"!=");
14 types.push_back(
">=");
16 types.push_back(
"<=");
22 size_t ind = uniqueString.rfind(
"_");
23 return uniqueString.substr(0,ind);
27 static std::string s_var(
"ora::ContainerIndex");
38 m_items( rhs.m_items ),
39 m_data( new coral::AttributeList( *rhs.m_data )){
44 m_data.reset(
new coral::AttributeList( *rhs.
m_data ) );
50 std::stringstream uniqueVarName;
52 bool notUnique =
true;
55 uniqueVarName.str(
"");
56 uniqueVarName << varName;
57 uniqueVarName <<
"_" <<
i;
58 for(coral::AttributeList::const_iterator iAttr = m_data->begin();
59 iAttr!=m_data->end() && !
found; ++iAttr){
60 if( iAttr->specification().name() == uniqueVarName.str() ) found =
true;
65 return uniqueVarName.str();
70 if(endIndex<startIndex && endIndex>=0) {
72 "Selection::addIndexItem");
73 }
else if( startIndex==endIndex && endIndex>=0){
74 std::string varName = uniqueVariableName( indexVariable() );
76 m_items.push_back(std::make_pair(varName,selectionTypes()[selType]));
77 m_data->extend<
int>(varName);
78 (*m_data)[varName].data<
int>() = startIndex;
81 std::string varName0 = uniqueVariableName( indexVariable() );
83 m_items.push_back(std::make_pair(varName0,selectionTypes()[firstType]));
84 m_data->extend<
int>(varName0);
85 (*m_data)[varName0].data<
int>() = startIndex;
88 std::string varName1 = uniqueVariableName( indexVariable() );
90 m_items.push_back(std::make_pair(varName1,selectionTypes()[secondType]));
91 m_data->extend<
int>(varName1);
92 (*m_data)[varName1].data<
int>() = endIndex;
99 const std::type_info& primitiveType,
101 std::string varName = uniqueVariableName( dataMemberName );
102 m_items.push_back(std::make_pair(varName,selectionTypes()[stype]));
103 m_data->extend( varName, primitiveType );
104 (*m_data)[varName].setValueFromAddress( data );
109 return m_items.empty();
112 const std::vector<std::pair<std::string,std::string> >&
117 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::vector< std::string > & selectionTypes()
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)
char data[epos_bytes_allocation]
void throwException(const std::string &message, const std::string &methodName)
const std::vector< std::pair< std::string, std::string > > & items() const