15#ifndef OSGDB_CLASSINTERFACE
16#define OSGDB_CLASSINTERFACE 1
34 return getTypeEnum<T>();
38static const char* getTypeString()
44static const char* getTypeStringFrom(T)
46 return getTypeString<T>();
56#define DECLARE_TYPE(A,B) \
57 template<> inline osgDB::BaseSerializer::Type getTypeEnum<A>() { return osgDB::BaseSerializer::RW_##B; } \
58 template<> inline const char* getTypeString<A>() { return #B; }
114class PropertyOutputIterator;
115class PropertyInputIterator;
139 bool getProperty(
const osg::Object*
object,
const std::string& propertyName, T& value);
143 bool setProperty(
osg::Object*
object,
const std::string& propertyName,
const T& value);
154 typedef std::map<std::string, osgDB::BaseSerializer::Type>
PropertyMap;
170 bool hasMethod(
const std::string& compoundClassName,
const std::string& methodName)
const;
228 else return object->getUserValue(propertyName, value);
238 object->setUserValue(propertyName, value);
251 OSG_INFO<<
"ClassInterface::getProperty("<<propertyName<<
", Checking UserDataContainer for object ptr"<<std::endl;
255 OSG_INFO<<
" Checking UserDataContainer for object ptr"<<std::endl;
278 if (objectIndex < udc->getNumUserObjects())
281 if (outgoingObject==value)
return true;
283 OSG_INFO<<
"ClassInterface::setProperty("<<propertyName<<
", "<<value->
className()<<
") replace object on UserDataContainer"<<std::endl;
289 OSG_INFO<<
"ClassInterface::setProperty("<<propertyName<<
", "<<value->
className()<<
") Adding object to UserDataContainer"<<std::endl;
#define DECLARE_TYPE(A, B)
Definition ClassInterface:56
#define OSG_INFO
Definition Notify:87
Definition Serializer:141
Type
Definition Serializer:145
@ RW_IMAGE
Definition Serializer:146
@ RW_UNDEFINED
Definition Serializer:146
Definition ClassInterface:122
osgDB::BaseSerializer::Type getType(const std::string &typeName) const
get the enum value of type given the human readable name.
ObjectPropertyMap _blackList
Definition ClassInterface:220
bool copyPropertyDataFromObject(const osg::Object *object, const std::string &propertyName, void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
const ObjectPropertyMap & getBlackList() const
Get the const list of properties that are explicitly defined as not supported.
Definition ClassInterface:189
std::map< std::string, osgDB::BaseSerializer::Type > PropertyMap
Properties supported for a single class.
Definition ClassInterface:154
osgDB::InputStream _inputStream
Definition ClassInterface:210
bool getSupportedProperties(const osg::Object *object, PropertyMap &properties, bool searchAssociates=true) const
Get the list of of properties supported by object.
std::map< std::string, osgDB::BaseSerializer::Type > TypeNameToTypeMap
Definition ClassInterface:213
PropertyInputIterator * _pii
Definition ClassInterface:211
bool copyPropertyObjectFromObject(const osg::Object *object, const std::string &propertyName, void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
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.
bool copyPropertyDataToObject(osg::Object *object, const std::string &propertyName, const void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
PropertyOutputIterator * _poi
Definition ClassInterface:208
osgDB::OutputStream _outputStream
Definition ClassInterface:207
osgDB::ObjectWrapper * getObjectWrapper(const osg::Object *object) const
bool run(osg::Object *object, const std::string &methodName, osg::Parameters &inputParameters, osg::Parameters &outputParameters) const
run method of object
osgDB::BaseSerializer * getSerializer(const osg::Object *object, const std::string &propertyName, osgDB::BaseSerializer::Type &type) const
ObjectPropertyMap _whiteList
Definition ClassInterface:219
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
std::map< osgDB::BaseSerializer::Type, std::string > TypeToTypeNameMap
Definition ClassInterface:214
bool run(void *objectPtr, const std::string &compoundClassName, const std::string &methodName, osg::Parameters &inputParameters, osg::Parameters &outputParameters) const
run method of object
bool hasMethod(const std::string &compoundClassName, const std::string &methodName) const
checked for support of specified method
ObjectPropertyMap & getBlackList()
Get the list of properties that are explicitly defined as not supported.
Definition ClassInterface:186
TypeToTypeNameMap _typeToTypeNameMap
Definition ClassInterface:217
TypeNameToTypeMap _typeNameToTypeMap
Definition ClassInterface:216
const ObjectPropertyMap & getWhiteList() const
Get the const list of properties that are explicitly defined as supported.
Definition ClassInterface:183
std::map< std::string, PropertyMap > ObjectPropertyMap
Properties supported for a range of classes, used for white and black lists.
Definition ClassInterface:177
std::string getTypeName(osgDB::BaseSerializer::Type type) const
get the human readable name of type.
bool areTypesCompatible(osgDB::BaseSerializer::Type lhs, osgDB::BaseSerializer::Type rhs) const
return type of two types are compatible
osg::Object * createObject(const std::string &compoundClassdName) const
bool copyPropertyObjectToObject(osg::Object *object, const std::string &propertyName, const void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
ObjectPropertyMap & getWhiteList()
Get the list of properties that are explicitly defined as supported.
Definition ClassInterface:180
bool hasMethod(const osg::Object *object, const std::string &methodName) const
checked for support of specified method
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 compatib...
Definition ClassInterface:225
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 compatib...
Definition ClassInterface:232
Definition ObjectWrapper:62
Definition OutputStream:57
Definition BoundingBox:34
Definition BoundingSphere:35
virtual void setName(const std::string &name)
Definition Object:203
virtual const char * className() const =0
osg::UserDataContainer * getUserDataContainer()
Definition Object:243
osg::UserDataContainer * getOrCreateUserDataContainer()
A plane class. It can be used to represent an infinite plane.
Definition Plane:34
Definition UserDataContainer:26
virtual unsigned int addUserObject(Object *obj)=0
virtual unsigned int getUserObjectIndex(const osg::Object *obj, unsigned int startPos=0) const =0
virtual void setUserObject(unsigned int i, Object *obj)=0
virtual Object * getUserObject(unsigned int i)=0
OSGDB_EXPORT const char * getTypeStringFromPtr(const osg::Object *)
osg::Object * ObjectPtr
Definition ClassInterface:243
OSGDB_EXPORT osgDB::BaseSerializer::Type getTypeEnumFromPtr(const osg::Object *)
std::vector< osg::ref_ptr< osg::Object > > Parameters
Definition Callback:130
#define OSGDB_EXPORT
Definition osgDB/Export:39