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);
59 ASSERT(
false)(this->
type_name()).error(
"Call of allow_auto_conversion method is forbidden for type Tuple");
65 {
return typeid(*this) ==
typeid(other) &&
89 bool obligatory_keys =
true;
95 if (
it !=
data_->keys.begin()) {
96 allow_auto_conversion =
false;
98 if ( !obligatory_keys ) {
99 THROW( ExcTupleWrongKeysOrder() << EI_TupleName(this->
type_name()) );
102 obligatory_keys =
false;
106 if (
typeid( *(
it->type_.get()) ) ==
typeid(
Instance)) {
108 it->type_ =
it->type_->make_instance().first;
111 THROW( ExcGenericWithoutInstance() << EI_Object(
it->type_->type_name()) );
112 it->type_->finish(finish_type);
113 ASSERT(
it->type_->is_finished()).error();
118 if (allow_auto_conversion) {
119 data_->auto_conversion_key_idx = 0;
120 data_->auto_conversion_key=
data_->keys.begin()->key_;
123 data_->finish_status_ = finish_type;
124 return (
data_->finish_status_);
130 ASSERT(
false)(this->
type_name()).error(
"Call of derive_from method is forbidden for type Tuple");
138 if (
it->default_.is_obligatory() ) ++obligatory_keys_count;
147 return std::make_pair( std::make_shared<Tuple>(instance_tuple.
close()), parameter_map );
153 tuple.
data_ = std::make_shared<Record::RecordData>(*this->
data_);
154 tuple.
data_->closed_ =
false;
170 const Default &default_value,
const string &description,
178 template <
class KeyType>
180 const Default &default_value,
const string &description,
189 template <
class KeyType>
191 const string &description,
202 #define TUPLE_DECLARE_KEY(TYPE) \ 203 template Tuple & Tuple::declare_key<TYPE>(const string &key, const TYPE &type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes); \ 204 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.