Flow123d
JS_before_hm-1884-g94bc49f8c
|
Go to the documentation of this file.
20 #include <boost/functional/hash.hpp>
37 :
Scalar(other), data_(other.data_)
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_;
87 boost::hash_combine(seed,
"Selection");
89 boost::hash_combine(seed,
data_->description_);
91 boost::hash_combine(seed, key.
key_);
93 boost::hash_combine(seed, key.
value);
101 return data_->finish_status_;
111 return data_->closed_;
115 return data_->type_name_;
134 if (
it !=
data_->key_to_index_.end())
135 return (
data_->keys_[
it->second].value);
137 throw ExcSelectionKeyNotFound() << EI_KeyName(key) << EI_Selection(*
this);
143 auto it =
data_->value_to_index_.find(val);
144 if (
it !=
data_->value_to_index_.end())
145 return data_->keys_[
it->second].key_;
147 throw ExcSelectionValueNotFound() << EI_Value(val) << EI_Selection(*
this);
167 for(
unsigned int i=0; i<
size(); i++) os <<
"'" <<
data_->keys_[i].key_ <<
"' ";
175 return std::make_pair( std::make_shared<Selection>(*
this),
ParameterMap() );
189 ASSERT(key_to_index_.find(key_h) == key_to_index_.end())(key)(type_name_).error(
"Key already exists in Selection.");
191 const std::string &existing_key = keys_[
it->second].key_;
192 ASSERT(
it == value_to_index_.end())(
value)(key)(existing_key)(type_name_)
193 .error(
"Value of new key conflicts with value of existing key in Selection");
195 unsigned int new_idx = key_to_index_.size();
196 key_to_index_.insert(std::make_pair(key_h, new_idx));
197 value_to_index_.insert(std::make_pair(
value, new_idx));
199 Key tmp_key = { new_idx, key, description,
value, attributes };
200 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