OpenSceneGraph
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
osgDB::ClassInterface Class Reference

ClassInterface provides a general means of checking for supported properties of classes, and getting/setting those properties. More...

Public Types

typedef std::map< std::string, osgDB::BaseSerializer::TypePropertyMap
 Properties supported for a single class. More...
 
typedef std::map< std::string, PropertyMapObjectPropertyMap
 Properties supported for a range of classes, used for white and black lists. More...
 

Public Member Functions

 ClassInterface ()
 
bool getPropertyType (const osg::Object *object, const std::string &propertyName, osgDB::BaseSerializer::Type &type) const
 get the Type of the specified property, return true if property is supported, otherwise false. More...
 
bool areTypesCompatible (osgDB::BaseSerializer::Type lhs, osgDB::BaseSerializer::Type rhs) const
 return type of two types are compatible More...
 
osg::ObjectcreateObject (const std::string &compoundClassdName) const
 create an object of specified type for provided compound class name in the form libraryName::className. More...
 
template<typename T >
bool getProperty (const osg::Object *object, const std::string &propertyName, T &value)
 template method for getting property data, return true if property available and the type is compatible, otherwise returns false. More...
 
template<typename T >
bool setProperty (osg::Object *object, const std::string &propertyName, const T &value)
 template method for setting property data, return true if property available and the type is compatible, otherwise returns false. More...
 
std::string getTypeName (osgDB::BaseSerializer::Type type) const
 get the human readable name of type. More...
 
osgDB::BaseSerializer::Type getType (const std::string &typeName) const
 get the enum value of type given the human readable name. More...
 
bool getSupportedProperties (const osg::Object *object, PropertyMap &properties, bool searchAssociates=true) const
 Get the list of of properties supported by object. More...
 
bool isObjectOfType (const osg::Object *object, const std::string &compoundClassName) const
 return true if the object can be cast to the specified class specified by compoundClassName More...
 
bool run (void *objectPtr, const std::string &compoundClassName, const std::string &methodName, osg::Parameters &inputParameters, osg::Parameters &outputParameters) const
 run method of object More...
 
bool run (osg::Object *object, const std::string &methodName, osg::Parameters &inputParameters, osg::Parameters &outputParameters) const
 run method of object More...
 
bool hasMethod (const std::string &compoundClassName, const std::string &methodName) const
 checked for support of specified method More...
 
bool hasMethod (const osg::Object *object, const std::string &methodName) const
 checked for support of specified method More...
 
ObjectPropertyMapgetWhiteList ()
 Get the list of properties that are explicitly defined as supported. More...
 
const ObjectPropertyMapgetWhiteList () const
 Get the const list of properties that are explicitly defined as supported. More...
 
ObjectPropertyMapgetBlackList ()
 Get the list of properties that are explicitly defined as not supported. More...
 
const ObjectPropertyMapgetBlackList () const
 Get the const list of properties that are explicitly defined as not supported. More...
 
osgDB::ObjectWrappergetObjectWrapper (const osg::Object *object) const
 
osgDB::BaseSerializergetSerializer (const osg::Object *object, const std::string &propertyName, osgDB::BaseSerializer::Type &type) const
 
template<>
bool getProperty (const osg::Object *object, const std::string &propertyName, ObjectPtr &value)
 
template<>
bool setProperty (osg::Object *object, const std::string &propertyName, const ObjectPtr &value)
 

Protected Types

typedef std::map< std::string, osgDB::BaseSerializer::TypeTypeNameToTypeMap
 
typedef std::map< osgDB::BaseSerializer::Type, std::string > TypeToTypeNameMap
 

Protected Member Functions

bool copyPropertyDataFromObject (const osg::Object *object, const std::string &propertyName, void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
 
bool copyPropertyDataToObject (osg::Object *object, const std::string &propertyName, const void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
 
bool copyPropertyObjectFromObject (const osg::Object *object, const std::string &propertyName, void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
 
bool copyPropertyObjectToObject (osg::Object *object, const std::string &propertyName, const void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
 

Protected Attributes

osgDB::OutputStream _outputStream
 
PropertyOutputIterator * _poi
 
osgDB::InputStream _inputStream
 
PropertyInputIterator * _pii
 
TypeNameToTypeMap _typeNameToTypeMap
 
TypeToTypeNameMap _typeToTypeNameMap
 
ObjectPropertyMap _whiteList
 
ObjectPropertyMap _blackList
 

Detailed Description

ClassInterface provides a general means of checking for supported properties of classes, and getting/setting those properties.

Uses the osgDB serializers to do the actual object query/get/set.

Member Typedef Documentation

◆ ObjectPropertyMap

typedef std::map<std::string, PropertyMap> osgDB::ClassInterface::ObjectPropertyMap

Properties supported for a range of classes, used for white and black lists.

◆ PropertyMap

Properties supported for a single class.

◆ TypeNameToTypeMap

◆ TypeToTypeNameMap

Constructor & Destructor Documentation

◆ ClassInterface()

osgDB::ClassInterface::ClassInterface ( )

Member Function Documentation

◆ areTypesCompatible()

bool osgDB::ClassInterface::areTypesCompatible ( osgDB::BaseSerializer::Type  lhs,
osgDB::BaseSerializer::Type  rhs 
) const

return type of two types are compatible

◆ copyPropertyDataFromObject()

bool osgDB::ClassInterface::copyPropertyDataFromObject ( const osg::Object object,
const std::string &  propertyName,
void *  valuePtr,
unsigned int  valueSize,
osgDB::BaseSerializer::Type  valueType 
)
protected

◆ copyPropertyDataToObject()

bool osgDB::ClassInterface::copyPropertyDataToObject ( osg::Object object,
const std::string &  propertyName,
const void *  valuePtr,
unsigned int  valueSize,
osgDB::BaseSerializer::Type  valueType 
)
protected

◆ copyPropertyObjectFromObject()

bool osgDB::ClassInterface::copyPropertyObjectFromObject ( const osg::Object object,
const std::string &  propertyName,
void *  valuePtr,
unsigned int  valueSize,
osgDB::BaseSerializer::Type  valueType 
)
protected

◆ copyPropertyObjectToObject()

bool osgDB::ClassInterface::copyPropertyObjectToObject ( osg::Object object,
const std::string &  propertyName,
const void *  valuePtr,
unsigned int  valueSize,
osgDB::BaseSerializer::Type  valueType 
)
protected

◆ createObject()

osg::Object* osgDB::ClassInterface::createObject ( const std::string &  compoundClassdName) const

create an object of specified type for provided compound class name in the form libraryName::className.

◆ getBlackList() [1/2]

ObjectPropertyMap& osgDB::ClassInterface::getBlackList ( )
inline

Get the list of properties that are explicitly defined as not supported.

◆ getBlackList() [2/2]

const ObjectPropertyMap& osgDB::ClassInterface::getBlackList ( ) const
inline

Get the const list of properties that are explicitly defined as not supported.

◆ getObjectWrapper()

osgDB::ObjectWrapper* osgDB::ClassInterface::getObjectWrapper ( const osg::Object object) const

◆ getProperty() [1/2]

template<typename T >
bool osgDB::ClassInterface::getProperty ( const osg::Object object,
const std::string &  propertyName,
T &  value 
)

template method for getting property data, return true if property available and the type is compatible, otherwise returns false.

◆ getProperty() [2/2]

template<>
bool osgDB::ClassInterface::getProperty ( const osg::Object object,
const std::string &  propertyName,
ObjectPtr value 
)
inline

◆ getPropertyType()

bool osgDB::ClassInterface::getPropertyType ( const osg::Object object,
const std::string &  propertyName,
osgDB::BaseSerializer::Type type 
) const

get the Type of the specified property, return true if property is supported, otherwise false.

◆ getSerializer()

osgDB::BaseSerializer* osgDB::ClassInterface::getSerializer ( const osg::Object object,
const std::string &  propertyName,
osgDB::BaseSerializer::Type type 
) const

◆ getSupportedProperties()

bool osgDB::ClassInterface::getSupportedProperties ( const osg::Object object,
PropertyMap properties,
bool  searchAssociates = true 
) const

Get the list of of properties supported by object.

◆ getType()

osgDB::BaseSerializer::Type osgDB::ClassInterface::getType ( const std::string &  typeName) const

get the enum value of type given the human readable name.

◆ getTypeName()

std::string osgDB::ClassInterface::getTypeName ( osgDB::BaseSerializer::Type  type) const

get the human readable name of type.

◆ getWhiteList() [1/2]

ObjectPropertyMap& osgDB::ClassInterface::getWhiteList ( )
inline

Get the list of properties that are explicitly defined as supported.

◆ getWhiteList() [2/2]

const ObjectPropertyMap& osgDB::ClassInterface::getWhiteList ( ) const
inline

Get the const list of properties that are explicitly defined as supported.

◆ hasMethod() [1/2]

bool osgDB::ClassInterface::hasMethod ( const std::string &  compoundClassName,
const std::string &  methodName 
) const

checked for support of specified method

◆ hasMethod() [2/2]

bool osgDB::ClassInterface::hasMethod ( const osg::Object object,
const std::string &  methodName 
) const

checked for support of specified method

◆ isObjectOfType()

bool osgDB::ClassInterface::isObjectOfType ( const osg::Object object,
const std::string &  compoundClassName 
) const

return true if the object can be cast to the specified class specified by compoundClassName

◆ run() [1/2]

bool osgDB::ClassInterface::run ( void *  objectPtr,
const std::string &  compoundClassName,
const std::string &  methodName,
osg::Parameters inputParameters,
osg::Parameters outputParameters 
) const

run method of object

◆ run() [2/2]

bool osgDB::ClassInterface::run ( osg::Object object,
const std::string &  methodName,
osg::Parameters inputParameters,
osg::Parameters outputParameters 
) const

run method of object

◆ setProperty() [1/2]

template<typename T >
bool osgDB::ClassInterface::setProperty ( osg::Object object,
const std::string &  propertyName,
const T &  value 
)

template method for setting property data, return true if property available and the type is compatible, otherwise returns false.

◆ setProperty() [2/2]

template<>
bool osgDB::ClassInterface::setProperty ( osg::Object object,
const std::string &  propertyName,
const ObjectPtr value 
)
inline

Member Data Documentation

◆ _blackList

ObjectPropertyMap osgDB::ClassInterface::_blackList
protected

◆ _inputStream

osgDB::InputStream osgDB::ClassInterface::_inputStream
protected

◆ _outputStream

osgDB::OutputStream osgDB::ClassInterface::_outputStream
protected

◆ _pii

PropertyInputIterator* osgDB::ClassInterface::_pii
protected

◆ _poi

PropertyOutputIterator* osgDB::ClassInterface::_poi
protected

◆ _typeNameToTypeMap

TypeNameToTypeMap osgDB::ClassInterface::_typeNameToTypeMap
protected

◆ _typeToTypeNameMap

TypeToTypeNameMap osgDB::ClassInterface::_typeToTypeNameMap
protected

◆ _whiteList

ObjectPropertyMap osgDB::ClassInterface::_whiteList
protected

The documentation for this class was generated from the following file: