20 #include <boost/functional/hash.hpp> 43 :
data_(std::make_shared<SelectionData>(name))
55 data_->add_value(value, key, description, attributes);
78 data_->finish_status_ = finish_type;
79 return data_->finish_status_;
89 boost::hash_combine(seed,
"Selection");
91 boost::hash_combine(seed,
data_->description_);
93 boost::hash_combine(seed, key.
key_);
95 boost::hash_combine(seed, key.
value);
103 return data_->finish_status_;
113 return data_->closed_;
117 return data_->type_name_;
132 if (it !=
data_->key_to_index_.end())
133 return (
data_->keys_[it->second].value);
135 throw ExcSelectionKeyNotFound() << EI_KeyName(key) << EI_Selection(*
this);
141 auto it =
data_->value_to_index_.find(val);
142 if (
it !=
data_->value_to_index_.end())
143 return data_->keys_[
it->second].key_;
145 throw ExcSelectionValueNotFound() << EI_Value(val) << EI_Selection(*
this);
154 while (
data_->value_to_index_.find(value) !=
data_->value_to_index_.end()) value++;
165 for(
unsigned int i=0; i<
size(); i++) os <<
"'" <<
data_->keys_[i].key_ <<
"' ";
173 return std::make_pair( std::make_shared<Selection>(*
this),
ParameterMap() );
181 ASSERT(key_to_index_.find(key_h) == key_to_index_.end())(key)(type_name_).error(
"Key already exists in Selection.");
183 const std::string &existing_key = keys_[it->second].key_;
184 ASSERT(it == value_to_index_.end())(value)(key)(existing_key)(type_name_)
185 .error(
"Value of new key conflicts with value of existing key in Selection");
187 unsigned int new_idx = key_to_index_.size();
188 key_to_index_.insert(std::make_pair(key_h, new_idx));
189 value_to_index_.insert(std::make_pair(value, new_idx));
191 Key tmp_key = { new_idx, key, description,
value, attributes };
192 keys_.push_back(tmp_key);
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
static constexpr bool value