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) &&
76 if (
it->default_.is_obligatory() ) {
77 if (
it !=
data_->keys.begin()) {
78 allow_auto_conversion =
false;
81 if (allow_auto_conversion) {
82 data_->auto_conversion_key_idx = 0;
83 data_->auto_conversion_key=
data_->keys.begin()->key_;
103 bool obligatory_keys =
true;
108 if ( !obligatory_keys ) {
109 THROW( ExcTupleWrongKeysOrder() << EI_TupleName(this->
type_name()) );
112 obligatory_keys =
false;
116 if (
typeid( *(
it->type_.get()) ) ==
typeid(
Instance)) {
118 it->type_ =
it->type_->make_instance().first;
121 THROW( ExcGenericWithoutInstance() << EI_Object(
it->type_->type_name()) );
122 it->type_->finish(finish_type);
123 ASSERT(
it->type_->is_finished()).error();
127 data_->finish_status_ = finish_type;
128 return (
data_->finish_status_);
134 ASSERT(
false)(this->
type_name()).error(
"Call of derive_from method is forbidden for type Tuple");
142 if (
it->default_.is_obligatory() ) ++obligatory_keys_count;
151 return std::make_pair( std::make_shared<Tuple>(instance_tuple.
close()), parameter_map );
157 tuple.
data_ = std::make_shared<Record::RecordData>(*this->
data_);
158 tuple.
data_->closed_ =
false;
174 const Default &default_value,
const string &description,
182 template <
class KeyType>
184 const Default &default_value,
const string &description,
193 template <
class KeyType>
195 const string &description,
206 #define TUPLE_DECLARE_KEY(TYPE) \ 207 template Tuple & Tuple::declare_key<TYPE>(const string &key, const TYPE &type, const Default &default_value, const string &description, TypeBase::attribute_map key_attributes); \ 208 template Tuple & Tuple::declare_key<TYPE>(const string &key, const TYPE &type, const string &description, TypeBase::attribute_map key_attributes)
#define ASSERT_GT(a, b)
Definition of comparative assert macro (Greater Than)
#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.