15 #ifndef OSGDB_CLASSINTERFACE
16 #define OSGDB_CLASSINTERFACE 1
18 #include <osgDB/ObjectWrapper>
19 #include <osgDB/Registry>
20 #include <osg/ValueObject>
34 return getTypeEnum<T>();
38 static const char* getTypeString()
44 static 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; }
114 class PropertyOutputIterator;
115 class PropertyInputIterator;
135 osg::Object* createObject(
const std::string& compoundClassdName)
const;
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;
157 bool getSupportedProperties(
const osg::Object*
object, PropertyMap& properties,
bool searchAssociates=
true)
const;
160 bool isObjectOfType(
const osg::Object*
object,
const std::string& compoundClassName)
const;
164 bool run(
void* objectPtr,
const std::string& compoundClassName,
const std::string& methodName,
osg::Parameters& inputParameters,
osg::Parameters& outputParameters)
const;
170 bool hasMethod(
const std::string& compoundClassName,
const std::string& methodName)
const;
173 bool hasMethod(
const osg::Object*
object,
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;
259 value =
const_cast<ObjectPtr
>(ptr);
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;
osgDB::InputStream _inputStream
osgDB::OutputStream _outputStream
virtual unsigned int getUserObjectIndex(const osg::Object *obj, unsigned int startPos=0) const =0
BoundingSphereImpl< Vec3d > BoundingSphered
BoundingSphereImpl< Vec3f > BoundingSpheref
OSGDB_EXPORT osgDB::BaseSerializer::Type getTypeEnumFromPtr(const osg::Object *)
PropertyOutputIterator * _poi
OSGDB_EXPORT const char * getTypeStringFromPtr(const osg::Object *)
bool copyPropertyDataToObject(osg::Object *object, const std::string &propertyName, const void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
virtual unsigned int addUserObject(Object *obj)=0
BoundingBoxImpl< Vec3f > BoundingBoxf
TypeToTypeNameMap _typeToTypeNameMap
const ObjectPropertyMap & getWhiteList() const
Get the const list of properties that are explicitly defined as supported.
std::map< std::string, osgDB::BaseSerializer::Type > TypeNameToTypeMap
std::vector< osg::ref_ptr< osg::Object > > Parameters
std::map< std::string, PropertyMap > ObjectPropertyMap
Properties supported for a range of classes, used for white and black lists.
virtual Object * getUserObject(unsigned int i)=0
std::map< std::string, osgDB::BaseSerializer::Type > PropertyMap
Properties supported for a single class.
ObjectPropertyMap _whiteList
BoundingBoxImpl< Vec3d > BoundingBoxd
PropertyInputIterator * _pii
ObjectPropertyMap & getWhiteList()
Get the list of properties that are explicitly defined as supported.
virtual void setName(const std::string &name)
virtual const char * className() const =0
bool copyPropertyObjectFromObject(const osg::Object *object, const std::string &propertyName, void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
osg::UserDataContainer * getOrCreateUserDataContainer()
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...
osg::UserDataContainer * getUserDataContainer()
#define DECLARE_TYPE(A, B)
bool copyPropertyDataFromObject(const osg::Object *object, const std::string &propertyName, void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)
std::map< osgDB::BaseSerializer::Type, std::string > TypeToTypeNameMap
virtual void setUserObject(unsigned int i, Object *obj)=0
ObjectPropertyMap _blackList
const ObjectPropertyMap & getBlackList() const
Get the const list of properties that are explicitly defined as not supported.
ObjectPropertyMap & getBlackList()
Get the list of properties that are explicitly defined as not supported.
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...
TypeNameToTypeMap _typeNameToTypeMap
bool copyPropertyObjectToObject(osg::Object *object, const std::string &propertyName, const void *valuePtr, unsigned int valueSize, osgDB::BaseSerializer::Type valueType)