From Mike Wittman, "These changes add support for reflection of reference and const reference type representations via osgIntrospection::Type. This covers just the static type information; the dynamic behavior via Type::createInstance/Type::InvokeMethod should not be affected."
This commit is contained in:
@@ -8,6 +8,7 @@ CXXFILES =\
|
||||
MethodInfo.cpp\
|
||||
PropertyInfo.cpp\
|
||||
Reflection.cpp\
|
||||
Reflector.cpp\
|
||||
Type.cpp\
|
||||
Utility.cpp\
|
||||
Value.cpp\
|
||||
|
||||
@@ -39,18 +39,18 @@ Reflection::StaticData& Reflection::getOrCreateStaticData()
|
||||
if (!_static_data)
|
||||
{
|
||||
_static_data = new StaticData;
|
||||
std::auto_ptr<Type> tvoid(new Type(typeid(void)));
|
||||
_static_data->typemap.insert(std::make_pair(&typeid(void), tvoid.get()));
|
||||
std::auto_ptr<Type> tvoid(new Type(extended_typeid<void>()));
|
||||
_static_data->typemap.insert(std::make_pair(extended_typeid<void>(), tvoid.get()));
|
||||
_static_data->type_void = tvoid.release();
|
||||
}
|
||||
return *_static_data;
|
||||
}
|
||||
|
||||
const Type& Reflection::getType(const std::type_info& ti)
|
||||
const Type& Reflection::getType(const ExtendedTypeInfo &ti)
|
||||
{
|
||||
const TypeMap& types = getTypes();
|
||||
|
||||
TypeMap::const_iterator i = types.find(&ti);
|
||||
TypeMap::const_iterator i = types.find(ti);
|
||||
if (i == types.end())
|
||||
{
|
||||
return *registerType(ti);
|
||||
@@ -79,17 +79,17 @@ const Type& Reflection::type_void()
|
||||
return *getOrCreateStaticData().type_void;
|
||||
}
|
||||
|
||||
Type* Reflection::registerType(const std::type_info& ti)
|
||||
Type* Reflection::registerType(const ExtendedTypeInfo &ti)
|
||||
{
|
||||
std::auto_ptr<Type> type(new Type(ti));
|
||||
getOrCreateStaticData().typemap.insert(std::make_pair(&ti, type.get()));
|
||||
getOrCreateStaticData().typemap.insert(std::make_pair(ti, type.get()));
|
||||
return type.release();
|
||||
}
|
||||
|
||||
Type* Reflection::getOrRegisterType(const std::type_info& ti, bool replace_if_defined)
|
||||
Type* Reflection::getOrRegisterType(const ExtendedTypeInfo &ti, bool replace_if_defined)
|
||||
{
|
||||
TypeMap& tm = getOrCreateStaticData().typemap;
|
||||
TypeMap::iterator i = tm.find(&ti);
|
||||
TypeMap::iterator i = tm.find(ti);
|
||||
|
||||
if (i != tm.end())
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ bool Type::isSubclassOf(const Type& type) const
|
||||
check_defined();
|
||||
for (TypeList::const_iterator i=_base.begin(); i!=_base.end(); ++i)
|
||||
{
|
||||
if (**i == type.getStdTypeInfo())
|
||||
if ((*i)->getExtendedTypeInfo() == type.getExtendedTypeInfo())
|
||||
return true;
|
||||
if ((*i)->isSubclassOf(type))
|
||||
return true;
|
||||
|
||||
@@ -29,7 +29,7 @@ Value Value::convertTo(const Type& outtype) const
|
||||
{
|
||||
Value v = tryConvertTo(outtype);
|
||||
if (v.isEmpty())
|
||||
throw TypeConversionException(_type->getStdTypeInfo(), outtype.getStdTypeInfo());
|
||||
throw TypeConversionException(_type->getExtendedTypeInfo(), outtype.getExtendedTypeInfo());
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ std::string Value::toString() const
|
||||
throw StreamWriteErrorException();
|
||||
return oss.str();
|
||||
}
|
||||
throw StreamingNotSupportedException(StreamingNotSupportedException::ANY, _type->getStdTypeInfo());
|
||||
throw StreamingNotSupportedException(StreamingNotSupportedException::ANY, _type->getExtendedTypeInfo());
|
||||
}
|
||||
|
||||
std::wstring Value::toWString() const
|
||||
@@ -107,7 +107,7 @@ std::wstring Value::toWString() const
|
||||
throw StreamWriteErrorException();
|
||||
return woss.str();
|
||||
}
|
||||
throw StreamingNotSupportedException(StreamingNotSupportedException::ANY, _type->getStdTypeInfo());
|
||||
throw StreamingNotSupportedException(StreamingNotSupportedException::ANY, _type->getExtendedTypeInfo());
|
||||
}
|
||||
|
||||
void Value::check_empty() const
|
||||
@@ -137,7 +137,7 @@ bool Value::operator ==(const Value& other) const
|
||||
const Comparator* cmp = cmp1? cmp1: cmp2;
|
||||
|
||||
if (!cmp)
|
||||
throw ComparisonNotPermittedException(_type->getStdTypeInfo());
|
||||
throw ComparisonNotPermittedException(_type->getExtendedTypeInfo());
|
||||
|
||||
if (cmp1 == cmp2)
|
||||
return cmp->isEqualTo(*this, other);
|
||||
@@ -156,7 +156,7 @@ bool Value::operator <=(const Value& other) const
|
||||
const Comparator* cmp = cmp1? cmp1: cmp2;
|
||||
|
||||
if (!cmp)
|
||||
throw ComparisonNotPermittedException(_type->getStdTypeInfo());
|
||||
throw ComparisonNotPermittedException(_type->getExtendedTypeInfo());
|
||||
|
||||
if (cmp1 == cmp2)
|
||||
return cmp->isLessThanOrEqualTo(*this, other);
|
||||
@@ -185,7 +185,7 @@ bool Value::operator <(const Value& other) const
|
||||
const Comparator* cmp = cmp1? cmp1: cmp2;
|
||||
|
||||
if (!cmp)
|
||||
throw ComparisonNotPermittedException(_type->getStdTypeInfo());
|
||||
throw ComparisonNotPermittedException(_type->getExtendedTypeInfo());
|
||||
|
||||
if (cmp1 == cmp2)
|
||||
return cmp->isLessThanOrEqualTo(*this, other) && !cmp->isEqualTo(*this, other);
|
||||
@@ -208,7 +208,7 @@ bool Value::operator >=(const Value& other) const
|
||||
const Comparator* cmp = cmp1? cmp1: cmp2;
|
||||
|
||||
if (!cmp)
|
||||
throw ComparisonNotPermittedException(_type->getStdTypeInfo());
|
||||
throw ComparisonNotPermittedException(_type->getExtendedTypeInfo());
|
||||
|
||||
if (cmp1 == cmp2)
|
||||
return !cmp->isLessThanOrEqualTo(*this, other) || cmp->isEqualTo(*this, other);
|
||||
|
||||
Reference in New Issue
Block a user