From Marco Jez, "Problems fixed:
1. type converters created automatically by the I_BaseType macro use static_cast<> even for base-to-derived conversions. dynamic_cast<> should be used instead. 2. as a consequence of the above fix, I_BaseType must now differentiate between polymorphic and non-polymorphic base classes, because the latter can't be dynamic_cast'd to derived classes. Some template magic (see is_polymorphic<> in ReflectionMacros) is used to detect polymorphism at compile time (I'm NOT sure it works on all platforms as it's partly implementation-dependent. Please test!). 3. predefined custom property getters/setters/counters/etc. (as those defined for STL containers) only work on Value objects that contain non-pointer instances. This was an unwanted restriction that no longer exists. Wrappers will need to be recompiled. This is a good time to give them a fresh update with genwrapper. NOTE: fix #1 should get rid of those crashes and strange behaviours that some users noticed while using osgIntrospection through osgTcl or in their own code."
This commit is contained in:
@@ -46,6 +46,18 @@ namespace osgIntrospection
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> const T &getInstance(const Value &instance)
|
||||
{
|
||||
return instance.isTypedPointer() ?
|
||||
*variant_cast<const T*>(instance) : variant_cast<const T&>(instance);
|
||||
}
|
||||
|
||||
template<typename T> T &getInstance(Value &instance)
|
||||
{
|
||||
return instance.isTypedPointer() ?
|
||||
*variant_cast<T*>(instance) : variant_cast<T&>(instance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user