20 #include <boost/functional/hash.hpp>
36 :
Scalar(other), data_(other.data_)
42 : data_(std::make_shared<SelectionData>(name))
52 data_->add_value(value, key, description);
74 boost::hash_combine(seed,
"Selection");
76 boost::hash_combine(seed,
data_->description_);
78 boost::hash_combine(seed, key.
key_);
80 boost::hash_combine(seed, key.
value);
93 return data_->closed_;
97 return data_->type_name_;
112 if (it !=
data_->key_to_index_.end())
113 return (
data_->keys_[it->second].value);
115 throw ExcSelectionKeyNotFound() << EI_KeyName(key) << EI_Selection(*
this);
121 auto it =
data_->value_to_index_.find(val);
122 if (it !=
data_->value_to_index_.end())
123 return data_->keys_[it->second].key_;
125 throw ExcSelectionValueNotFound() << EI_Value(val) << EI_Selection(*
this);
131 for (
auto it = sel.
begin(); it != sel.
end(); ++it)
133 int value = it->value;
134 while (
data_->value_to_index_.find(value) !=
data_->value_to_index_.end()) value++;
135 add_value(value, it->key_, it->description_);
145 for(
unsigned int i=0; i<
size(); i++) os <<
"'" <<
data_->keys_[i].key_ <<
"' ";
153 return std::make_pair( std::make_shared<Selection>(*
this),
ParameterMap() );
162 const std::string &existing_key =
keys_[it->second].key_;
164 .error(
"Value of new key conflicts with value of existing key in Selection");
170 Key tmp_key = { new_idx, key, description, value };
171 keys_.push_back(tmp_key);
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...