37 #ifndef H_OGF_GOM_REFLECTION_META_H
38 #define H_OGF_GOM_REFLECTION_META_H
122 MetaType* meta_type,
const std::string& typeid_name
140 return dynamic_cast<MetaClass*
>(resolve_meta_type(type_name));
151 const std::string& typeid_name
196 typedef std::map<std::string, MetaType_var> MetaTypesTable ;
197 typedef std::map<std::string, MetaType*> TypeidNamesTable ;
199 static Meta* instance_ ;
200 MetaTypesTable type_name_to_meta_type_ ;
201 TypeidNamesTable typeid_name_to_meta_type_ ;
266 if(result ==
nullptr) {
271 if(result ==
nullptr) {
272 Logger::err(
"Meta") <<
"No MetaType for typeid "
276 ogf_assert(result !=
nullptr) ;
289 if(result ==
nullptr) {
292 if(result ==
nullptr) {
293 Logger::err(
"Meta") <<
"MetaType for typeid "
295 <<
" is not a MetaClass"
298 ogf_assert(result !=
nullptr) ;
311 if(result ==
nullptr) {
312 Logger::err(
"Meta") <<
"No Serializer for typeid "
315 Logger::err(
"Meta") <<
"type name = " <<
type()->
name()
318 ogf_assert(result !=
nullptr) ;
344 const T& value, std::string&
string
346 std::ostringstream stream ;
348 stream, (
void*)(&value)
351 string = stream.str() ;
364 const std::string&
string, T& value
366 if(
string.length() == 0) {
370 std::istringstream stream(
string) ;
372 stream, (
void*)(&value)
Creates instances of a specific class.
Abstract base class for reading and writing values from/to streams.
virtual bool serialize_read(std::istream &stream, void *addr)=0
Reads a value from a stream.
virtual bool serialize_write(std::ostream &stream, void *addr)=0
Writes a value to a stream.
Global Graphite namespace.
bool ogf_is_a(const T &x, const MetaType *type)
Tests whether the type of a variable derives from another type.
bool ogf_convert_from_string(const std::string &string, T &value)
Converts a string to a variable using the reflection API.
bool ogf_convert_to_string(const T &value, std::string &string)
Converts a variable to a string using the reflection API.
MetaType * ogf_dynamic_type(const T &x)
Gets the MetaType associated with a variable.
MetaType * ogf_static_type(const T &x)
Gets the MetaType associated with a variable.
Definitions common to all include files in the gom library.