From 069adcf55501ccac6af8e250a03ccb9a7d0a11e8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 16 Mar 2007 14:28:27 +0000 Subject: [PATCH] From David Callu, " bug: Lost the functionality to find the real type pointed by a pointer. Ex: a osg::Node pointer point on a osg::Group, if I look for information on the pointer type, the introspection say it is a "osg::Node*". But if I want information on the pointed type, the introspection must return the "osg::Group". This bug come from the osgIntrospection::Value::Ptr_instance_box::ptype() function. In the original version, this function use the member "Instance_base *inst_" like this : typeof(*static_cast *>(inst_)->_data) But in the new version, this function use the template argument "T": typeof(typename remove_pointer::type) This is a good meta-programming use, but here we need a dynamic request. Moreover the "typeof" macro define in "Reflection" header accept only a type in parameter with the new version. fix: Add the macro "typeofvalue" in "Reflection" header which accept a value or a type in parameter. Restore original code in osgIntrospection::Value::Ptr_instance_box::ptype() function. " --- include/osgIntrospection/Reflection | 1 + include/osgIntrospection/Value | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/osgIntrospection/Reflection b/include/osgIntrospection/Reflection index 1025d9d4f..c4253a6ea 100644 --- a/include/osgIntrospection/Reflection +++ b/include/osgIntrospection/Reflection @@ -26,6 +26,7 @@ /// returning the Type object associated to the type of the given /// expression. #define typeof(type) osgIntrospection::Reflection::getType(extended_typeid< type >()) +#define typeofvalue(val) osgIntrospection::Reflection::getType(osgIntrospection::ExtendedTypeInfo(typeid(val), false, false)) namespace osgIntrospection { diff --git a/include/osgIntrospection/Value b/include/osgIntrospection/Value index 8424e4a4d..34183062d 100644 --- a/include/osgIntrospection/Value +++ b/include/osgIntrospection/Value @@ -303,7 +303,7 @@ namespace osgIntrospection virtual const Type* ptype() const { if (!static_cast *>(inst_)->_data) return 0; - return &typeof(typename remove_pointer::type); + return &typeofvalue(*static_cast *>(inst_)->_data); } virtual bool nullptr() const