21 #include <boost/functional/hash.hpp> 37 Tuple::Tuple(
const string & type_name_in,
const string & description)
38 :
Record(type_name_in, description) {}
44 boost::hash_combine(seed,
"Tuple");
45 data_->content_hash(seed);
52 ASSERT(
false)(this->
type_name()).error(
"Call of allow_auto_conversion method is forbidden for type Tuple");
58 {
return typeid(*this) ==
typeid(other) &&
71 if (
data_->finished)
return true;
75 data_->finished =
true;
78 bool obligatory_keys =
true;
84 if (
it !=
data_->keys.begin()) {
85 allow_auto_conversion =
false;
87 if ( !obligatory_keys ) {
88 THROW( ExcTupleWrongKeysOrder() << EI_TupleName(this->
type_name()) );
91 obligatory_keys =
false;
95 if (
typeid( *(
it->type_.get()) ) ==
typeid(
Instance))
it->type_ =
it->type_->make_instance().first;
96 if (!is_generic &&
it->type_->is_root_of_generic_subtree())
THROW( ExcGenericWithoutInstance() << EI_Object(
it->type_->type_name()) );
97 data_->finished =
data_->finished &&
it->type_->finish(is_generic);
101 if (allow_auto_conversion) {
102 data_->auto_conversion_key_idx = 0;
103 data_->auto_conversion_key=
data_->keys.begin()->key_;
106 return (
data_->finished);
112 ASSERT(
false)(this->
type_name()).error(
"Call of derive_from method is forbidden for type Tuple");
120 if (
it->default_.is_obligatory() ) ++obligatory_keys_count;
131 return std::make_pair( std::make_shared<Tuple>(tuple.
close()), parameter_map );
137 tuple.
data_ = std::make_shared<Record::RecordData>(*this->
data_);
138 tuple.
data_->closed_ =
false;
139 tuple.
data_->finished =
false;
154 const Default &default_value,
const string &description,
162 template <
class KeyType>
164 const Default &default_value,
const string &description,
173 template <
class KeyType>
175 const string &description,
186 #define TUPLE_DECLARE_KEY(TYPE) \ 187 template Tuple & Tuple::declare_key<TYPE>(const string &key, const TYPE &type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes); \ 188 template Tuple & Tuple::declare_key<TYPE>(const string &key, const TYPE &type, const string &description, TypeBase::attribute_map key_attributes)
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.