3 #ifndef DATATOOLS_THINGS_INL_H 4 #define DATATOOLS_THINGS_INL_H 16 const std::string& a_desc,
23 "Cannot allocate object '" << a_name <<
"' !");
25 = dynamic_cast<datatools::i_serializable*>(new_obj);
30 const std::type_info& ti =
typeid(T);
31 std::ostringstream message;
32 message <<
"datatools::things::add<T>: Request type '" 33 << ti.name() <<
"' does not inherit from the '" <<
"datatools::i_serializable" <<
"' base class !";
36 "Request type '" << ti.name() <<
"' does not inherit from the '" <<
"datatools::i_serializable" <<
"' base class !");
38 this->add_impl(a_name, new_cast, a_desc, a_const);
46 dict_type::iterator found = _things_.find(a_name);
49 "No stored object has name '" << a_name <<
"' !");
50 const std::type_info& ti =
typeid(T);
52 const std::type_info& tf =
typeid(cur);
56 "Request type '" << ti.name() <<
"' ('" << tmp.get_serial_tag()
57 <<
"') does not match the type '" << tf.name() <<
"' of the stored object named '" 58 << a_name <<
"' ('" << found->second.handle->get_serial_tag() <<
"') !");
59 T* ptr = dynamic_cast<T*>(found->second.handle);
60 found->second.handle = 0;
61 _things_.erase(found);
69 dict_type::iterator found = _things_.find(a_name);
72 "No stored object has name '" << a_name <<
"' !");
73 const std::type_info& ti =
typeid(T);
75 const std::type_info& tf =
typeid(cur);
79 "Request type '" << ti.name() << tmp.get_serial_tag() <<
"') does not match the type '" 80 << tf.name() <<
"' of the stored object named '" << a_name <<
"' ('" 81 << found->second.handle->get_serial_tag() <<
"') !");
84 "Object named '" << a_name <<
"' is constant !");
85 return *(dynamic_cast<T*>(found->second.handle));
91 dict_type::const_iterator found = _things_.find(a_name);
94 "No object named '" << a_name <<
"' !");
95 const std::type_info& ti =
typeid(T);
97 const std::type_info& tf =
typeid(cur);
105 dict_type::const_iterator found = _things_.find(a_name);
108 "No object named '" << a_name <<
"' !");
109 const std::type_info& ti =
typeid(T);
111 const std::type_info& tf =
typeid(cur);
115 "Request type '" << ti.name() <<
"' ('" << tmp.get_serial_tag()
116 <<
"') does not match the type '" << tf.name() <<
"' of the stored object named '" << a_name
117 <<
"' ('" << found->second.handle->get_serial_tag() <<
"') !");
118 return *(dynamic_cast<const T*>(found->second.handle));
123 #endif // DATATOOLS_THINGS_INL_H
Utility macros for exception handling.
#define DT_THROW_IF(Condition, ExceptionType, Message)
Definition: exception.h:76