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<Instance<T> *>(inst_)->_data) But in the new version, this function use the template argument "T": typeof(typename remove_pointer<T>::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. "
This commit is contained in:
parent
72b348ea91
commit
069adcf555
@ -26,6 +26,7 @@
|
|||||||
/// returning the Type object associated to the type of the given
|
/// returning the Type object associated to the type of the given
|
||||||
/// expression.
|
/// expression.
|
||||||
#define typeof(type) osgIntrospection::Reflection::getType(extended_typeid< type >())
|
#define typeof(type) osgIntrospection::Reflection::getType(extended_typeid< type >())
|
||||||
|
#define typeofvalue(val) osgIntrospection::Reflection::getType(osgIntrospection::ExtendedTypeInfo(typeid(val), false, false))
|
||||||
|
|
||||||
namespace osgIntrospection
|
namespace osgIntrospection
|
||||||
{
|
{
|
||||||
|
@ -303,7 +303,7 @@ namespace osgIntrospection
|
|||||||
virtual const Type* ptype() const
|
virtual const Type* ptype() const
|
||||||
{
|
{
|
||||||
if (!static_cast<Instance<T> *>(inst_)->_data) return 0;
|
if (!static_cast<Instance<T> *>(inst_)->_data) return 0;
|
||||||
return &typeof(typename remove_pointer<T>::type);
|
return &typeofvalue(*static_cast<Instance<T> *>(inst_)->_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool nullptr() const
|
virtual bool nullptr() const
|
||||||
|
Loading…
Reference in New Issue
Block a user