14 const StorageBase *source_storage,
unsigned int vec_size)
15 : target_type_(target_type), source_type_(source_type), source_storage_(source_storage), vec_size_(vec_size)
25 const StorageBase *source_storage,
unsigned int index) {
27 if (
typeid(*source_storage) ==
typeid(
StorageNull)) {
33 return modify_storage(target_type, static_cast<const Type::Record *>(source_type),
34 source_storage, index);
37 return modify_storage(target_type, static_cast<const Type::Array *>(source_type),
38 source_storage, index);
41 ASSERT(
typeid(*target_type) ==
typeid(
Type::Integer),
"Incompatible type of target. Must be Type::Integer!\n");
42 ASSERT(
typeid(*source_storage) ==
typeid(
StorageInt),
"Incompatible type of storage. Must be Integer!\n");
46 ASSERT(
typeid(*target_type) ==
typeid(
Type::Double),
"Incompatible type of target. Must be Type::Double!\n");
47 ASSERT(
typeid(*source_storage) ==
typeid(
StorageDouble),
"Incompatible type of storage. Must be Double!\n");
50 if (
typeid(*source_type) ==
typeid(
Type::Bool)) {
51 ASSERT(
typeid(*target_type) ==
typeid(
Type::Bool),
"Incompatible type of target. Must be Type::Boolean!\n");
52 ASSERT(
typeid(*source_storage) ==
typeid(
StorageBool),
"Incompatible type of storage. Must be Boolean!\n");
56 ASSERT(
typeid(*target_type) ==
typeid(
Type::Selection),
"Incompatible type of target. Must be Type::Selection!\n");
57 ASSERT(
typeid(*source_storage) ==
typeid(
StorageInt),
"Incompatible type of storage. For selection must be Integer!\n");
61 if (abstract_record_type != NULL ) {
62 return modify_storage(target_type, abstract_record_type, source_storage, index);
66 if (source_string != NULL ) {
68 ASSERT( target_string != NULL,
"Incompatible type of target. Must be Type::String!\n");
69 ASSERT(
typeid(*source_storage) ==
typeid(
StorageString),
"Incompatible type of storage. Must be String!\n");
74 xprintf(
Err,
"Unknown descendant of TypeBase class, name: %s\n",
typeid(source_type).name());
81 const StorageBase *source_storage,
unsigned int index) {
83 ASSERT(
typeid(*target_type) ==
typeid(
Type::Record),
"Incompatible type of target type. Must be Record!\n");
84 ASSERT(
typeid(*source_storage) ==
typeid(
StorageArray),
"Incompatible type of storage. Must be Array!\n");
91 source_it != source_type->
end();
92 ++source_it, ++target_it) {
94 target_it->default_.has_same_type(source_it->default_);
95 ASSERT(target_it->default_.has_same_type(source_it->default_),
"Incompatible default value of source type and target type!\n");
98 source_storage->
get_item(source_it->key_index), index );
99 storage_array->
new_item(source_it->key_index, sb);
102 return storage_array;
107 const StorageBase *source_storage,
unsigned int index) {
110 ASSERT( target_arec != NULL,
"Incompatible type of target type. Must be AbstractRecord!\n");
111 ASSERT(
typeid(*source_storage) ==
typeid(
StorageArray),
"Incompatible type of storage. Must be Array!\n");
117 source_storage, index );
122 const StorageBase *source_storage,
unsigned int index) {
123 ASSERT(
typeid(*source_storage) ==
typeid(
StorageArray),
"Incompatible type of storage. Must be Array!\n");
125 if (
typeid(*target_type) ==
typeid(
Type::Array) ) {
131 for (
unsigned int i=0; i<array_size; i++) {
133 source_storage->
get_item(i), index );
137 return storage_array;
141 ASSERT(index <
vec_size_,
"Index of storage descendant is out of range.\n");
147 ASSERT(
false,
"Incompatible type of target type. Must be Array or same type as subtype of source!\n");
#define ASSERT_EQUAL(a, b)