21 #include <boost/functional/hash.hpp> 37 Tuple::Tuple(
const string & type_name_in,
const string & description)
39 this->
data_ = std::make_shared<RecordData>(type_name_in, description);
46 boost::hash_combine(seed,
"Tuple");
47 data_->content_hash(seed);
54 ASSERT(
false)(this->
type_name()).error(
"Call of allow_auto_conversion method is forbidden for type Tuple");
60 {
return typeid(*this) ==
typeid(other) &&
84 bool obligatory_keys =
true;
90 if (
it !=
data_->keys.begin()) {
91 allow_auto_conversion =
false;
93 if ( !obligatory_keys ) {
94 THROW( ExcTupleWrongKeysOrder() << EI_TupleName(this->
type_name()) );
97 obligatory_keys =
false;
101 if (
typeid( *(
it->type_.get()) ) ==
typeid(
Instance)) {
103 it->type_ =
it->type_->make_instance().first;
106 THROW( ExcGenericWithoutInstance() << EI_Object(
it->type_->type_name()) );
107 it->type_->finish(finish_type);
108 ASSERT(
it->type_->is_finished()).error();
113 if (allow_auto_conversion) {
114 data_->auto_conversion_key_idx = 0;
115 data_->auto_conversion_key=
data_->keys.begin()->key_;
118 data_->finish_status_ = finish_type;
119 return (
data_->finish_status_);
125 ASSERT(
false)(this->
type_name()).error(
"Call of derive_from method is forbidden for type Tuple");
133 if (
it->default_.is_obligatory() ) ++obligatory_keys_count;
144 return std::make_pair( std::make_shared<Tuple>(tuple.
close()), parameter_map );
150 tuple.
data_ = std::make_shared<Record::RecordData>(*this->
data_);
151 tuple.
data_->closed_ =
false;
167 const Default &default_value,
const string &description,
175 template <
class KeyType>
177 const Default &default_value,
const string &description,
186 template <
class KeyType>
188 const string &description,
199 #define TUPLE_DECLARE_KEY(TYPE) \ 200 template Tuple & Tuple::declare_key<TYPE>(const string &key, const TYPE &type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes); \ 201 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.