Serializer
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
#ifndef OSGDB__SERIALIZER
#define OSGDB__SERIALIZER
#include <osg/ref_ptr>
#include <osg/Notify>
#include <osg/Object>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
#include <string>
#include <sstream>
#include <limits.h>
namespace osgDB
{
typedef std::vector<std::string> StringList;
extern OSGDB_EXPORT void split( const std::string& src, StringList& list, char separator=' ' );
#ifndef OBJECT_CAST
#define OBJECT_CAST static_cast
#endif
class IntLookup
{
public:
typedef int Value;
typedef std::map<std::string, Value> StringToValue;
typedef std::map<Value, std::string> ValueToString;
IntLookup() {}
unsigned int size() const { return static_cast<unsigned int>(_stringToValue.size()); }
void add( const char* str, Value value )
{
if ( _valueToString.find(value)!=_valueToString.end() )
{
osg::notify(osg::INFO) << "Duplicate enum value " << value
<< " with old string: " << _valueToString[value]
<< " and new string: " << str << std::endl;
}
_valueToString[value] = str;
_stringToValue[str] = value;
}
void add2(const char* str, const char* newStr, Value value) {
if (_valueToString.find(value) != _valueToString.end())
{
osg::notify(osg::INFO) << "Duplicate enum value " << value
<< " with old string: " << _valueToString[value]
<< " and new strings: " << str << " and " << newStr << std::endl;
}
_valueToString[value] = newStr;
_stringToValue[newStr] = value;
_stringToValue[str] = value;
}
Value getValue( const char* str )
{
StringToValue::iterator itr = _stringToValue.find(str);
if ( itr==_stringToValue.end() )
{
Value value;
std::stringstream stream;
stream << str; stream >> value;
_stringToValue[str] = value;
return value;
}
return itr->second;
}
const std::string& getString( Value value )
{
ValueToString::iterator itr = _valueToString.find(value);
if ( itr==_valueToString.end() )
{
std::string str;
std::stringstream stream;
stream << value; stream >> str;
_valueToString[value] = str;
return _valueToString[value];
}
return itr->second;
}
StringToValue& getStringToValue() { return _stringToValue; }
const StringToValue& getStringToValue() const { return _stringToValue; }
ValueToString& getValueToString() { return _valueToString; }
const ValueToString& getValueToString() const { return _valueToString; }
protected:
StringToValue _stringToValue;
ValueToString _valueToString;
};
class UserLookupTableProxy
{
public:
typedef void (*AddValueFunc)( IntLookup* lookup );
UserLookupTableProxy( AddValueFunc func ) { if ( func ) (*func)(&_lookup); }
IntLookup _lookup;
};
#define BEGIN_USER_TABLE(NAME, CLASS) \
static void add_user_value_func_##NAME(osgDB::IntLookup*); \
static osgDB::UserLookupTableProxy s_user_lookup_table_##NAME(&add_user_value_func_##NAME); \
static void add_user_value_func_##NAME(osgDB::IntLookup* lookup) { typedef CLASS MyClass
#define ADD_USER_VALUE(VALUE) lookup->add(#VALUE, MyClass::VALUE)
#define END_USER_TABLE() }
#define USER_READ_FUNC(NAME, FUNCNAME) \
static int FUNCNAME(osgDB::InputStream& is) { \
int value; if (is.isBinary()) is >> value; \
else { std::string str; is >> str; \
value = (s_user_lookup_table_##NAME)._lookup.getValue(str.c_str()); } \
return value; }
#define USER_WRITE_FUNC(NAME, FUNCNAME) \
static void FUNCNAME(osgDB::OutputStream& os, int value) { \
if (os.isBinary()) os << value; \
else os << (s_user_lookup_table_##NAME)._lookup.getString(value); } \
class BaseSerializer : public osg::Referenced
{
friend class ObjectWrapper;
public:
enum Type
{
RW_UNDEFINED = 0, RW_USER, RW_OBJECT, RW_IMAGE, RW_LIST,
RW_BOOL, RW_CHAR, RW_UCHAR, RW_SHORT, RW_USHORT, RW_INT, RW_UINT, RW_FLOAT, RW_DOUBLE,
RW_VEC2F, RW_VEC2D, RW_VEC3F, RW_VEC3D, RW_VEC4F, RW_VEC4D, RW_QUAT, RW_PLANE,
RW_MATRIXF, RW_MATRIXD, RW_MATRIX, RW_GLENUM, RW_STRING, RW_ENUM,
RW_VEC2B, RW_VEC2UB, RW_VEC2S, RW_VEC2US, RW_VEC2I, RW_VEC2UI,
RW_VEC3B, RW_VEC3UB, RW_VEC3S, RW_VEC3US, RW_VEC3I, RW_VEC3UI,
RW_VEC4B, RW_VEC4UB, RW_VEC4S, RW_VEC4US, RW_VEC4I, RW_VEC4UI,
RW_BOUNDINGBOXF, RW_BOUNDINGBOXD,
RW_BOUNDINGSPHEREF, RW_BOUNDINGSPHERED,
RW_VECTOR, RW_MAP
};
enum Usage
{
READ_WRITE_PROPERTY = 1,
GET_PROPERTY = 2,
SET_PROPERTY = 4,
GET_SET_PROPERTY = GET_PROPERTY | SET_PROPERTY
};
BaseSerializer(int usage) : _firstVersion(0), _lastVersion(INT_MAX), _usage(usage) {}
virtual bool set(osg::Object& /*object*/, void* /*value*/) { return false; }
virtual bool get(const osg::Object& /*object*/, void* /*value*/) { return false; }
virtual bool read( InputStream&, osg::Object& ) = 0;
virtual bool write( OutputStream&, const osg::Object& ) = 0;
virtual const std::string& getName() const = 0;
virtual IntLookup* getIntLookup() { return 0; }
void setUsage(int usage) { _usage = usage; }
int getUsage() const { return _usage; }
void setUsage(bool hasGetter, bool hasSetter)
{
setUsage( ((hasGetter && hasSetter) ? BaseSerializer::READ_WRITE_PROPERTY : 0) |
((hasGetter) ? BaseSerializer::GET_PROPERTY : 0) |
((hasSetter) ? BaseSerializer::SET_PROPERTY : 0) );
}
bool supportsReadWrite() const { return (_usage & READ_WRITE_PROPERTY)!=0; }
bool supportsGetSet() const { return (_usage & GET_SET_PROPERTY)!=0; }
bool supportsGet() const { return (_usage & GET_PROPERTY)!=0; }
bool supportsSet() const { return (_usage & SET_PROPERTY)!=0; }
protected:
int _firstVersion; // Library version when the serializer is first introduced
int _lastVersion; // Library version when the serializer is last required.
int _usage; // How the Serializer can be used.
};
template<typename C>
class UserSerializer : public BaseSerializer
{
public:
typedef bool (*Checker)( const C& );
typedef bool (*Reader)( InputStream&, C& );
typedef bool (*Writer)( OutputStream&, const C& );
UserSerializer( const char* name, Checker cf, Reader rf, Writer wf )
: BaseSerializer(READ_WRITE_PROPERTY), _name(name), _checker(cf), _reader(rf), _writer(wf) {}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
if ( is.isBinary() )
{
bool ok = false; is >> ok;
if ( !ok ) return true;
}
else
{
if ( !is.matchString(_name) )
return true;
}
return (*_reader)(is, object);
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
bool ok = (*_checker)(object);
if ( os.isBinary() )
{
os << ok;
if ( !ok ) return true;
}
else
{
if ( !ok ) return true;
os << os.PROPERTY(_name.c_str());
}
return (*_writer)(os, object);
}
virtual const std::string& getName() const { return _name; }
protected:
std::string _name;
Checker _checker;
public:
Reader _reader;
Writer _writer;
};
template<typename P>
class TemplateSerializer : public BaseSerializer
{
public:
TemplateSerializer( const char* name, P def)
: BaseSerializer(READ_WRITE_PROPERTY), _name(name), _defaultValue(def) {}
virtual bool read( InputStream& is, osg::Object& obj ) = 0;
virtual bool write( OutputStream& os, const osg::Object& obj ) = 0;
virtual const std::string& getName() const { return _name; }
protected:
std::string _name;
P _defaultValue;
};
template<typename C, typename P>
class PropByValSerializer : public TemplateSerializer<P>
{
public:
typedef TemplateSerializer<P> ParentType;
typedef P (C::*Getter)() const;
typedef void (C::*Setter)( P );
PropByValSerializer( const char* name, P def, Getter gf, Setter sf, bool useHex=false ) : ParentType(name, def), _getter(gf), _setter(sf), _useHex(useHex)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
P value;
if ( is.isBinary() )
{
is >> value;
(object.*_setter)( value );
}
else if ( is.matchString(ParentType::_name) )
{
if ( _useHex ) is >> std::hex;
is >> value;
if ( _useHex ) is >> std::dec;
(object.*_setter)( value );
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
P value = (object.*_getter)();
if ( os.isBinary() )
{
os << value;
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str());
if ( _useHex ) { os << std::hex << std::showbase; }
os << value;
if ( _useHex ) os << std::dec << std::noshowbase;
os << std::endl;
}
return true;
}
public:
Getter _getter;
Setter _setter;
protected:
bool _useHex;
};
template<typename C, typename P>
class PropByRefSerializer : public TemplateSerializer<P>
{
public:
typedef TemplateSerializer<P> ParentType;
typedef const P& CP;
typedef CP (C::*Getter)() const;
typedef void (C::*Setter)( CP );
PropByRefSerializer( const char* name, CP def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
P value;
if ( is.isBinary() )
{
is >> value;
(object.*_setter)( value );
}
else if ( is.matchString(ParentType::_name) )
{
is >> value;
(object.*_setter)( value );
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
CP value = (object.*_getter)();
if ( os.isBinary() )
{
os << value;
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str()) << value << std::endl;
}
return true;
}
public:
Getter _getter;
Setter _setter;
};
template<typename C>
class MatrixSerializer : public TemplateSerializer<osg::Matrix>
{
public:
typedef TemplateSerializer<osg::Matrix> ParentType;
typedef const osg::Matrix& (C::*Getter)() const;
typedef void (C::*Setter)( const osg::Matrix& );
MatrixSerializer( const char* name, const osg::Matrix& def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
osg::Matrix value;
if ( is.isBinary() )
{
readMatrixImplementation( is, value );
(object.*_setter)( value );
}
else if ( is.matchString(ParentType::_name) )
{
readMatrixImplementation( is, value );
(object.*_setter)( value );
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const osg::Matrix& value = (object.*_getter)();
if ( os.isBinary() )
{
os << value;
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str()) << value << std::endl;
}
return true;
}
protected:
void readMatrixImplementation( InputStream& is, osg::Matrix& matrix )
{
#if 1
is >> matrix;
#else
if ( is.getUseFloatMatrix() )
{
osg::Matrixf realValue; is >> realValue;
matrix = realValue;
}
else
{
osg::Matrixd realValue; is >> realValue;
matrix = realValue;
}
#endif
}
public:
Getter _getter;
Setter _setter;
};
template<typename C, typename P>
class GLenumSerializer : public TemplateSerializer<P>
{
public:
typedef TemplateSerializer<P> ParentType;
typedef P (C::*Getter)() const;
typedef void (C::*Setter)( P );
GLenumSerializer( const char* name, P def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
if ( is.isBinary() )
{
GLenum value; is >> value;
(object.*_setter)( static_cast<P>(value) );
}
else if ( is.matchString(ParentType::_name) )
{
DEF_GLENUM(value); is >> value;
(object.*_setter)( static_cast<P>(value.get()) );
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P value = (object.*_getter)();
if ( os.isBinary() )
{
os << static_cast<GLenum>(value);
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str()) << GLENUM(value) << std::endl;
}
return true;
}
public:
Getter _getter;
Setter _setter;
};
template<typename C>
class StringSerializer : public TemplateSerializer<std::string>
{
public:
typedef TemplateSerializer<std::string> ParentType;
typedef const std::string& (C::*Getter)() const;
typedef void (C::*Setter)( const std::string& );
StringSerializer( const char* name, const std::string& def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
std::string value;
if ( is.isBinary() )
{
is >> value;
(object.*_setter)( value );
}
else if ( is.matchString(ParentType::_name) )
{
is.readWrappedString( value );
if ( !value.empty() && (_setter!=0) )
(object.*_setter)( value );
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const std::string& value = (object.*_getter)();
if ( os.isBinary() )
{
os << value;
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str());
os.writeWrappedString( value );
os << std::endl;
}
return true;
}
public:
Getter _getter;
Setter _setter;
};
template<typename C, typename P>
class ObjectSerializer : public BaseSerializer
{
public:
typedef const P* (C::*Getter)() const;
typedef void (C::*Setter)( P* );
ObjectSerializer( const char* name, P* def, Getter gf, Setter sf ) :
BaseSerializer(READ_WRITE_PROPERTY),
_name(name), _defaultValue(def), _getter(gf), _setter(sf)
{
setUsage( _getter!=0, _setter!=0);
}
virtual bool set(osg::Object& obj, void* value) { C& object = OBJECT_CAST<C&>(obj); (object.*_setter)( dynamic_cast<P*>(*(reinterpret_cast<osg::Object**>(value))) ); return true; }
virtual bool get(const osg::Object& obj, void* value) { const C& object = OBJECT_CAST<const C&>(obj);*(reinterpret_cast<const osg::Object**>(value )) = dynamic_cast<const osg::Object*>((object.*_getter)()); return true; }
virtual const std::string& getName() const { return _name; }
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
bool hasObject = false;
if ( is.isBinary() )
{
is >> hasObject;
if ( hasObject )
{
osg::ref_ptr<P> value = is.readObjectOfType<P>();
(object.*_setter)( value.get() );
}
}
else if ( is.matchString(_name) )
{
is >> hasObject;
if ( hasObject )
{
is >> is.BEGIN_BRACKET;
osg::ref_ptr<P> value = is.readObjectOfType<P>();
(object.*_setter)( value.get() );
is >> is.END_BRACKET;
}
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P* value = (object.*_getter)();
bool hasObject = (value!=NULL);
if ( os.isBinary() )
{
os << hasObject;
if (hasObject)
{
os.writeObject( value );
}
}
else if ( _defaultValue!=value )
{
os << os.PROPERTY(_name.c_str()) << hasObject;
if ( hasObject )
{
os << os.BEGIN_BRACKET << std::endl;
os.writeObject( value );
os << os.END_BRACKET;
}
os << std::endl;
}
return true;
}
public:
std::string _name;
osg::ref_ptr<P> _defaultValue;
Getter _getter;
Setter _setter;
};
template<typename C, typename P>
class ImageSerializer : public TemplateSerializer<P*>
{
public:
typedef TemplateSerializer<P*> ParentType;
typedef const P* (C::*Getter)() const;
typedef void (C::*Setter)( P* );
ImageSerializer( const char* name, P* def, Getter gf, Setter sf ):
ParentType(name, def), _getter(gf), _setter(sf)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual bool set(osg::Object& obj, void* value) { C& object = OBJECT_CAST<C&>(obj); (object.*_setter)( *(reinterpret_cast<P**>(value)) ); return true; }
virtual bool get(const osg::Object& obj, void* value) { const C& object = OBJECT_CAST<const C&>(obj);*(reinterpret_cast<const P**>(value )) = (object.*_getter)(); return true; }
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
bool hasObject = false;
if ( is.isBinary() )
{
is >> hasObject;
if ( hasObject )
{
osg::ref_ptr<osg::Image> image = is.readImage();
P* value = dynamic_cast<P*>( image.get() );
(object.*_setter)( value );
}
}
else if ( is.matchString(ParentType::_name) )
{
is >> hasObject;
if ( hasObject )
{
is >> is.BEGIN_BRACKET;
osg::ref_ptr<osg::Image> image = is.readImage();
P* value = dynamic_cast<P*>( image.get() );
(object.*_setter)( value );
is >> is.END_BRACKET;
}
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P* value = (object.*_getter)();
bool hasObject = (value!=NULL);
if ( os.isBinary() )
{
os << hasObject;
os.writeImage( value );
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str()) << hasObject;
if ( hasObject )
{
os << os.BEGIN_BRACKET << std::endl;
os.writeImage( value );
os << os.END_BRACKET;
}
os << std::endl;
}
return true;
}
public:
Getter _getter;
Setter _setter;
};
template<typename C, typename P, typename B>
class EnumSerializer : public TemplateSerializer<P>
{
public:
typedef TemplateSerializer<P> ParentType;
typedef P (C::*Getter)() const;
typedef B (C::*Setter)( P );
EnumSerializer( const char* name, P def, Getter gf, Setter sf ) : ParentType(name, def), _getter(gf), _setter(sf)
{
ParentType::setUsage( _getter!=0, _setter!=0);
}
virtual IntLookup* getIntLookup() { return &_lookup; }
void add( const char* str, P value )
{ _lookup.add(str, static_cast<IntLookup::Value>(value)); }
P getValue( const char* str )
{ return static_cast<P>(_lookup.getValue(str)); }
const std::string& getString( P value )
{ return _lookup.getString(static_cast<IntLookup::Value>(value)); }
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
IntLookup::Value value;
if ( is.isBinary() )
{
is >> value;
(object.*_setter)( static_cast<P>(value) );
}
else if ( is.matchString(ParentType::_name) )
{
std::string str; is >> str;
(object.*_setter)( getValue(str.c_str()) );
}
return true;
}
virtual bool write( osgDB::OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P value = (object.*_getter)();
if ( os.isBinary() )
{
os << (IntLookup::Value)value;
}
else if ( ParentType::_defaultValue!=value )
{
os << os.PROPERTY((ParentType::_name).c_str()) << getString(value) << std::endl;
}
return true;
}
public:
Getter _getter;
Setter _setter;
protected:
IntLookup _lookup;
};
template<typename C, typename P>
class ListSerializer : public BaseSerializer
{
public:
typedef typename P::value_type ValueType;
typedef typename P::const_iterator ConstIterator;
typedef const P& (C::*Getter)() const;
typedef void (C::*Setter)( const P& );
ListSerializer( const char* name, Getter gf, Setter sf ):
BaseSerializer(READ_WRITE_PROPERTY),
_name(name), _getter(gf), _setter(sf) {}
virtual const std::string& getName() const { return _name; }
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
unsigned int size = 0;
P list;
if ( is.isBinary() )
{
is >> size;
for ( unsigned int i=0; i<size; ++i )
{
ValueType value;
is >> value;
list.push_back( value );
}
if ( size>0 ) (object.*_setter)( list );
}
else if ( is.matchString(_name) )
{
is >> size;
if ( size>0 ) is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
ValueType value;
is >> value;
list.push_back( value );
}
if ( size>0 )
{
is >> is.END_BRACKET;
(object.*_setter)( list );
}
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& list = (object.*_getter)();
unsigned int size = (unsigned int)list.size();
if ( os.isBinary() )
{
os << size;
for ( ConstIterator itr=list.begin();
itr!=list.end(); ++itr )
{
os << (*itr);
}
}
else if ( size>0 )
{
os << os.PROPERTY((_name).c_str()) << size << os.BEGIN_BRACKET << std::endl;
for ( ConstIterator itr=list.begin();
itr!=list.end(); ++itr )
{
os << (*itr);
}
os << std::endl;
os << os.END_BRACKET << std::endl;
}
return true;
}
public:
std::string _name;
Getter _getter;
Setter _setter;
};
class VectorBaseSerializer : public BaseSerializer
{
public:
VectorBaseSerializer(BaseSerializer::Type elementType, unsigned int elementSize):
BaseSerializer(READ_WRITE_PROPERTY|GET_SET_PROPERTY),
_elementType(elementType),_elementSize(elementSize) {}
Type getElementType() const { return _elementType; }
unsigned int getElementSize() const { return _elementSize; }
virtual unsigned int size(const osg::Object& /*obj*/) const { return 0; }
virtual void resize(osg::Object& /*obj*/, unsigned int /*numElements*/) const {}
virtual void reserve(osg::Object& /*obj*/, unsigned int /*numElements*/) const {}
virtual void clear(osg::Object& /*obj*/) const {}
virtual void addElement(osg::Object& /*obj*/, void* /*ptr*/) const {}
virtual void insertElement(osg::Object& /*obj*/, unsigned int /*index*/, void* /*ptr*/) const {}
virtual void setElement(osg::Object& /*obj*/, unsigned int /*index*/, void* /*ptr*/) const {}
virtual void* getElement(osg::Object& /*obj*/, unsigned int /*index*/) const { return 0; }
virtual const void* getElement(const osg::Object& /*obj*/, unsigned int /*index*/) const { return 0; }
protected:
Type _elementType;
unsigned int _elementSize;
};
template<typename C, typename P>
class VectorSerializer : public VectorBaseSerializer
{
public:
typedef typename P::value_type ValueType;
typedef typename P::const_iterator ConstIterator;
typedef P& (C::*Getter)();
typedef const P& (C::*ConstGetter)() const;
typedef void (C::*Setter)( const P& );
VectorSerializer( const char* name, ConstGetter cgf, Getter gf, Setter sf, BaseSerializer::Type elementType, unsigned int numElementsOnRow):
VectorBaseSerializer(elementType, sizeof(ValueType)),
_name(name),
_constgetter(cgf), _getter(gf), _setter(sf),
_numElementsOnRow(numElementsOnRow) {}
virtual const std::string& getName() const { return _name; }
virtual unsigned int size(const osg::Object& obj) const
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& list = (object.*_constgetter)();
return static_cast<unsigned int>(list.size());
}
virtual void resize(osg::Object& obj, unsigned int numElements) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
list.resize(numElements);
}
virtual void reserve(osg::Object& obj, unsigned int numElements) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
list.reserve(numElements);
}
virtual void clear(osg::Object& obj) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
list.clear();
}
virtual void addElement(osg::Object& obj, void* ptr) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
list.push_back(*reinterpret_cast<ValueType*>(ptr));
}
virtual void insertElement(osg::Object& obj, unsigned int index, void* ptr) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
if (index>=list.size()) list.resize(index+1);
list.insert(list.begin()+index, *reinterpret_cast<ValueType*>(ptr));
}
virtual void setElement(osg::Object& obj, unsigned int index, void* ptr) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
if (index>=list.size()) list.resize(index+1);
list[index] = *reinterpret_cast<ValueType*>(ptr);
}
virtual void* getElement(osg::Object& obj, unsigned int index) const
{
C& object = OBJECT_CAST<C&>(obj);
P& list = (object.*_getter)();
if (index>=list.size()) return 0;
else return &list[index];
}
virtual const void* getElement(const osg::Object& obj, unsigned int index) const
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& list = (object.*_constgetter)();
if (index>=list.size()) return 0;
else return &list[index];
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
unsigned int size = 0;
P list;
if ( is.isBinary() )
{
is >> size;
list.reserve(size);
for ( unsigned int i=0; i<size; ++i )
{
ValueType value;
is >> value;
list.push_back( value );
}
if ( size>0 ) (object.*_setter)( list );
}
else if ( is.matchString(_name) )
{
is >> size;
list.reserve(size);
if ( size>0 ) is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
ValueType value;
is >> value;
list.push_back( value );
}
if ( size>0 )
{
is >> is.END_BRACKET;
(object.*_setter)( list );
}
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& list = (object.*_constgetter)();
unsigned int size = (unsigned int)list.size();
if ( os.isBinary() )
{
os << size;
for ( ConstIterator itr=list.begin();
itr!=list.end(); ++itr )
{
os << (*itr);
}
}
else if ( size>0 )
{
os << os.PROPERTY((_name).c_str()) << size << os.BEGIN_BRACKET << std::endl;
if (_numElementsOnRow==0)
{
for ( ConstIterator itr=list.begin(); itr!=list.end(); ++itr )
{
os << (*itr);
}
}
else if (_numElementsOnRow==1)
{
for ( ConstIterator itr=list.begin(); itr!=list.end(); ++itr )
{
os << (*itr); os << std::endl;
}
}
else
{
unsigned int i = _numElementsOnRow-1;
for (ConstIterator itr=list.begin(); itr!=list.end(); ++itr)
{
os << (*itr);
if (i==0) { os << std::endl; i = _numElementsOnRow-1; }
else --i;
}
if (i!=_numElementsOnRow) os << std::endl;
}
os << os.END_BRACKET << std::endl;
}
return true;
}
public:
std::string _name;
ConstGetter _constgetter;
Getter _getter;
Setter _setter;
unsigned int _numElementsOnRow;
};
template<typename C>
class IsAVectorSerializer : public VectorBaseSerializer
{
public:
typedef typename C::value_type ValueType;
typedef typename C::const_iterator ConstIterator;
IsAVectorSerializer( const char* name, BaseSerializer::Type elementType, unsigned int numElementsOnRow) :
VectorBaseSerializer(elementType, sizeof(ValueType)),
_name(name),
_numElementsOnRow(numElementsOnRow) {}
virtual const std::string& getName() const { return _name; }
virtual unsigned int size(const osg::Object& obj) const
{
const C& list = OBJECT_CAST<const C&>(obj);
return static_cast<unsigned int>(list.size());
}
virtual void resize(osg::Object& obj, unsigned int numElements) const
{
C& list = OBJECT_CAST<C&>(obj);
list.resize(numElements);
}
virtual void reserve(osg::Object& obj, unsigned int numElements) const
{
C& list = OBJECT_CAST<C&>(obj);
list.reserve(numElements);
}
virtual void clear(osg::Object& obj) const
{
C& list = OBJECT_CAST<C&>(obj);
list.clear();
}
virtual void addElement(osg::Object& obj, void* ptr) const
{
C& list = OBJECT_CAST<C&>(obj);
list.push_back(*reinterpret_cast<ValueType*>(ptr));
}
virtual void insertElement(osg::Object& obj, unsigned int index, void* ptr) const
{
C& list = OBJECT_CAST<C&>(obj);
if (index>=list.size()) list.resize(index+1);
list.insert(list.begin()+index, *reinterpret_cast<ValueType*>(ptr));
}
virtual void setElement(osg::Object& obj, unsigned int index, void* ptr) const
{
C& list = OBJECT_CAST<C&>(obj);
if (index>=list.size()) list.resize(index+1);
list[index] = *reinterpret_cast<ValueType*>(ptr);
}
virtual void* getElement(osg::Object& obj, unsigned int index) const
{
C& list = OBJECT_CAST<C&>(obj);
if (index>=list.size()) return 0;
else return &list[index];
}
virtual const void* getElement(const osg::Object& obj, unsigned int index) const
{
const C& list = OBJECT_CAST<const C&>(obj);
if (index>=list.size()) return 0;
else return &list[index];
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& list = OBJECT_CAST<C&>(obj);
unsigned int size = 0;
if ( is.isBinary() )
{
is >> size;
list.reserve(size);
for ( unsigned int i=0; i<size; ++i )
{
ValueType value;
is >> value;
list.push_back( value );
}
}
else if ( is.matchString(_name) )
{
is >> size;
list.reserve(size);
if ( size>0 ) is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
ValueType value;
is >> value;
list.push_back( value );
}
if ( size>0 )
{
is >> is.END_BRACKET;
}
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& list = OBJECT_CAST<const C&>(obj);
unsigned int size = (unsigned int)list.size();
if ( os.isBinary() )
{
os << size;
for ( ConstIterator itr=list.begin();
itr!=list.end(); ++itr )
{
os << (*itr);
}
}
else if ( size>0 )
{
os << os.PROPERTY((_name).c_str()) << size << os.BEGIN_BRACKET << std::endl;
if (_numElementsOnRow==0)
{
for ( ConstIterator itr=list.begin(); itr!=list.end(); ++itr )
{
os << (*itr);
}
}
else if (_numElementsOnRow==1)
{
for ( ConstIterator itr=list.begin(); itr!=list.end(); ++itr )
{
os << (*itr); os << std::endl;
}
}
else
{
unsigned int i = _numElementsOnRow-1;
for (ConstIterator itr=list.begin(); itr!=list.end(); ++itr)
{
os << (*itr);
if (i==0) { os << std::endl; i = _numElementsOnRow-1; }
else --i;
}
if (i!=_numElementsOnRow) os << std::endl;
}
os << os.END_BRACKET << std::endl;
}
return true;
}
public:
std::string _name;
unsigned int _numElementsOnRow;
};
class MapIteratorObject : public osg::Object
{
public:
MapIteratorObject():
_keyType(BaseSerializer::RW_UNDEFINED), _keySize(0),
_elementType(BaseSerializer::RW_UNDEFINED),_elementSize(0) {}
MapIteratorObject(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize):
_keyType(keyType), _keySize(keySize),
_elementType(elementType),_elementSize(elementSize) {}
MapIteratorObject(const MapIteratorObject& rhs, const osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY):
osg::Object(rhs, copyop),
_keyType(rhs._keyType), _keySize(rhs._keySize),
_elementType(rhs._elementType),_elementSize(rhs._elementSize) {}
META_Object(osgDB, MapIteratorObject);
BaseSerializer::Type getKeyType() const { return _keyType; }
unsigned int getKeySize() const { return _keySize; }
BaseSerializer::Type getElementType() const { return _elementType; }
unsigned int getElementSize() const { return _elementSize; }
virtual bool advance() { return false; }
virtual bool valid() const { return false; }
virtual const void* getKey() const { return 0; }
virtual void* getElement() const { return 0; }
virtual void setElement(void* /*ptr*/) const {}
protected:
BaseSerializer::Type _keyType;
unsigned int _keySize;
BaseSerializer::Type _elementType;
unsigned int _elementSize;
};
class MapBaseSerializer : public BaseSerializer
{
public:
MapBaseSerializer(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize):
BaseSerializer(READ_WRITE_PROPERTY|GET_SET_PROPERTY),
_keyType(keyType), _keySize(keySize),
_elementType(elementType),_elementSize(elementSize) {}
Type getKeyType() const { return _keyType; }
unsigned int getKeySize() const { return _keySize; }
Type getElementType() const { return _elementType; }
unsigned int getElementSize() const { return _elementSize; }
virtual void clear(osg::Object& /*obj*/) const {}
virtual void setElement(osg::Object& /*obj*/, void* /*ptrKey*/, void* /*ptrValue*/) const {}
virtual void* getElement(osg::Object& /*obj*/, void* /*ptrKey*/) const { return 0; }
virtual const void* getElement(const osg::Object& /*obj*/, void* /*ptrKey*/) const { return 0; }
virtual unsigned int size(const osg::Object& /*obj*/) const { return 0; }
virtual MapIteratorObject* createIterator(osg::Object& /*obj*/) const { return 0; }
virtual MapIteratorObject* createReverseIterator(osg::Object& /*obj*/) const { return 0; }
protected:
Type _keyType;
unsigned int _keySize;
Type _elementType;
unsigned int _elementSize;
};
template<typename C, typename P>
class MapSerializer : public MapBaseSerializer
{
public:
typedef typename P::value_type ValueType;
typedef typename P::key_type KeyType;
typedef typename P::mapped_type ElementType;
typedef typename P::iterator Iterator;
typedef typename P::reverse_iterator ReverseIterator;
typedef typename P::const_iterator ConstIterator;
typedef P& (C::*Getter)();
typedef const P& (C::*ConstGetter)() const;
typedef void (C::*Setter)( const P& );
MapSerializer( const char* name, ConstGetter cgf, Getter gf, Setter sf, BaseSerializer::Type keyType, BaseSerializer::Type elementType):
MapBaseSerializer(keyType, sizeof(KeyType), elementType, sizeof(ElementType)),
_name(name),
_constgetter(cgf), _getter(gf), _setter(sf) {}
virtual const std::string& getName() const { return _name; }
virtual void clear(osg::Object& obj) const
{
C& object = OBJECT_CAST<C&>(obj);
P& map = (object.*_getter)();
map.clear();
}
virtual void setElement(osg::Object& obj, void* ptrKey, void* ptrValue) const
{
C& object = OBJECT_CAST<C&>(obj);
P& map = (object.*_getter)();
map[*reinterpret_cast<KeyType*>(ptrKey)] = *reinterpret_cast<ElementType*>(ptrValue);
}
virtual void* getElement(osg::Object& obj, void* ptrKey) const
{
C& object = OBJECT_CAST<C&>(obj);
P& map = (object.*_getter)();
return &(map[*reinterpret_cast<KeyType*>(ptrKey)]);
}
virtual const void* getElement(const osg::Object& obj, void* ptrKey) const
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& map = (object.*_constgetter)();
ConstIterator itr = map.find(*reinterpret_cast<KeyType*>(ptrKey));
if (itr==map.end()) return 0;
else return &(itr->second);
}
virtual unsigned int size(const osg::Object& obj) const
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& map = (object.*_constgetter)();
return map.size();
}
struct MapIterator : public MapIteratorObject
{
MapIterator(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize,
Iterator itr, Iterator endItr):
MapIteratorObject(keyType, keySize, elementType, elementSize),
_itr(itr),_endItr(endItr) {}
Iterator _itr;
Iterator _endItr;
virtual bool advance() { if (valid()) ++_itr; return valid(); }
virtual bool valid() const { return _itr!=_endItr; }
virtual const void* getKey() const { return valid() ? &(_itr->first) : 0; }
virtual void* getElement() const { return valid() ? &(_itr->second) : 0; }
virtual void setElement(void* ptr) const { if (valid()) _itr->second = *reinterpret_cast<ElementType*>(ptr); }
};
struct ReverseMapIterator : public MapIteratorObject
{
ReverseMapIterator(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize,
ReverseIterator itr, ReverseIterator endItr):
MapIteratorObject(keyType, keySize, elementType, elementSize),
_itr(itr),_endItr(endItr) {}
ReverseIterator _itr;
ReverseIterator _endItr;
virtual bool advance() { if (valid()) ++_itr; return valid(); }
virtual bool valid() const { return _itr!=_endItr; }
virtual const void* getKey() const { return valid() ? &(_itr->first) : 0; }
virtual void* getElement() const { return valid() ? &(_itr->second) : 0; }
virtual void setElement(void* ptr) const { if (valid()) _itr->second = *reinterpret_cast<ElementType*>(ptr); }
};
virtual MapIteratorObject* createIterator(osg::Object& obj) const
{
C& object = OBJECT_CAST<C&>(obj);
P& map = (object.*_getter)();
return new MapIterator(_keyType, _keySize, _elementType, _elementSize, map.begin(), map.end());
}
virtual MapIteratorObject* createReverseIterator(osg::Object& obj) const
{
C& object = OBJECT_CAST<C&>(obj);
P& map = (object.*_getter)();
return new ReverseMapIterator(_keyType, _keySize, _elementType, _elementSize, map.rbegin(), map.rend());
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
unsigned int size = 0;
P map;
if ( is.isBinary() )
{
is >> size;
for ( unsigned int i=0; i<size; ++i )
{
KeyType key;
ElementType value;
is >> key >> value;
map[key] = value;
}
(object.*_setter)( map );
}
else if ( is.matchString(_name) )
{
is >> size;
if ( size>0 )
{
is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
KeyType key;
ElementType value;
is >> key >> value;
map[key] = value;
}
is >> is.END_BRACKET;
}
(object.*_setter)( map );
}
return true;
}
virtual bool write( OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P& map = (object.*_constgetter)();
unsigned int size = (unsigned int)map.size();
if ( os.isBinary() )
{
os << size;
for ( ConstIterator itr=map.begin();
itr!=map.end(); ++itr )
{
os << itr->first << itr->second;
}
}
else if ( size>0 )
{
os << os.PROPERTY((_name).c_str()) << size << os.BEGIN_BRACKET << std::endl;
for ( ConstIterator itr=map.begin(); itr!=map.end(); ++itr )
{
os << itr->first << itr->second; os << std::endl;
}
os << os.END_BRACKET << std::endl;
}
return true;
}
public:
std::string _name;
ConstGetter _constgetter;
Getter _getter;
Setter _setter;
};
template<typename C, typename P=unsigned int>
class BitFlagsSerializer : public osgDB::TemplateSerializer<P>
{
public:
typedef TemplateSerializer<P> ParentType;
typedef P (C::*Getter)() const;
typedef void (C::*Setter)( P );
BitFlagsSerializer( const char* name, P def, Getter gf, Setter sf )
: ParentType(name, def), _getter(gf), _setter(sf) {}
void add( const char* str, P value )
{
_lookup.add(str, static_cast<osgDB::IntLookup::Value>(value));
}
P getValue( const char* str )
{ return static_cast<P>(_lookup.getValue(str)); }
const std::string& getString( P value )
{ return _lookup.getString(static_cast<osgDB::IntLookup::Value>(value)); }
virtual bool read( osgDB::InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);
if ( is.isBinary() )
{
if (is.getFileVersion()<123)
{
bool ok = false; is >> ok; //code from user serialized ensuring backwards-compatibility
if ( !ok ) return true;
}
P mask;
is >> mask;
(object.*_setter)( mask );
}
else
{
if ( !is.matchString(ParentType::_name) ) //code from user serialized ensuring backwards-compatibility
return true;
P mask=P();
std::string maskSetString;
is >> maskSetString;
osgDB::StringList maskList;
osgDB::split( maskSetString, maskList, '|' );
for ( unsigned int i=0; i<maskList.size(); ++i )
mask |= _lookup.getValue( maskList[i].c_str());
(object.*_setter)( mask );
}
return true;
}
virtual bool write( osgDB::OutputStream& os, const osg::Object& obj )
{
const C& object = OBJECT_CAST<const C&>(obj);
const P mask = (object.*_getter)();
bool ok = ParentType::_defaultValue!=static_cast<P>(mask);
if ( os.isBinary() )
{
if (os.getFileVersion()<123)
{
os << ok;
if ( !ok )
return true;
}
os << (int)mask; //just write int value in binary case
}
else
{
if ( !ok )
return true;
os << os.PROPERTY(ParentType::_name.c_str());
std::string maskString;
const osgDB::IntLookup::ValueToString& v2sm = _lookup.getValueToString();
for( osgDB::IntLookup::ValueToString::const_iterator itr = v2sm.begin() ; itr != v2sm.end() ; itr++)
if( (mask & itr->first) != 0 )
maskString += std::string(itr->second + "|");
if ( !maskString.size() )
maskString = std::string("NONE|");
maskString.erase(maskString.size()-1,1);
os << maskString << std::endl; //remove last "|"
}
return true;
}
public:
Getter _getter;
Setter _setter;
protected:
osgDB::IntLookup _lookup;
};
// ADDING MANIPULATORS
#define ADD_SERIALIZER(S) \
wrapper->addSerializer( (S) )
#define ADD_USER_SERIALIZER(PROP) \
wrapper->addSerializer( new osgDB::UserSerializer<MyClass>( \
#PROP, &check##PROP, &read##PROP, &write##PROP), osgDB::BaseSerializer::RW_USER )
#define ADD_BOOL_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, bool >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOOL )
#define ADD_CHAR_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, char >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_CHAR )
#define ADD_UCHAR_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned char >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_UCHAR )
#define ADD_SHORT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, short >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_SHORT )
#define ADD_USHORT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned short >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_USHORT )
#define ADD_HEXSHORT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned short >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP, true), osgDB::BaseSerializer::RW_USHORT )
#define ADD_INT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, int >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_INT )
#define ADD_INT_SERIALIZER_NO_SET(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, int >( \
#PROP, DEF, &MyClass::get##PROP, 0), osgDB::BaseSerializer::RW_INT )
#define ADD_UINT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned int >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_UINT )
#define ADD_UINT_SERIALIZER_NO_SET(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned int >( \
#PROP, DEF, &MyClass::get##PROP, 0), osgDB::BaseSerializer::RW_UINT )
#define ADD_GLINT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, GLint >( \
#PROP, ((int)(DEF)), &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_INT )
#define ADD_HEXINT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, unsigned int >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP, true), osgDB::BaseSerializer::RW_UINT )
#define ADD_FLOAT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, float >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_FLOAT )
#define ADD_DOUBLE_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, double >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_DOUBLE )
#define ADD_REF_BOOL_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, bool >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOOL )
#define ADD_REF_CHAR_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, char >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_CHAR )
#define ADD_REF_UCHAR_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, unsigned char >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_UCHAR )
#define ADD_REF_SHORT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, short >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_SHORT )
#define ADD_REF_USHORT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, unsigned short >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_USHORT )
#define ADD_REF_HEXSHORT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, unsigned short >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP, true), osgDB::BaseSerializer::RW_USHORT )
#define ADD_REF_INT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, int >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_INT )
#define ADD_REF_UINT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, unsigned int >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_UINT )
#define ADD_REF_GLINT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, GLint >( \
#PROP, ((int)(DEF)), &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_INT )
#define ADD_REF_HEXINT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, unsigned int >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP, true), osgDB::BaseSerializer::RW_UINT )
#define ADD_REF_FLOAT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, float >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_FLOAT )
#define ADD_REF_DOUBLE_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, double >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_DOUBLE )
#define ADD_VEC2B_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2b >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2B )
#define ADD_VEC2UB_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2ub >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2UB )
#define ADD_VEC2S_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2s >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2S )
#define ADD_VEC2US_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2us >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2US )
#define ADD_VEC2I_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2i >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2I )
#define ADD_VEC2UI_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2ui >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2UI )
#define ADD_VEC2F_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2f >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2F )
#define ADD_VEC2D_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2d >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC2D )
#define ADD_VEC2_SERIALIZER(PROP, DEF) ADD_VEC2F_SERIALIZER(PROP, DEF)
#define ADD_VEC3B_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3b >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3B )
#define ADD_VEC3UB_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3ub >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3UB )
#define ADD_VEC3S_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3s >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3S )
#define ADD_VEC3US_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3us >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3US )
#define ADD_VEC3I_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3i >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3I )
#define ADD_VEC3UI_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3ui >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3UI )
#define ADD_VEC3F_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3f >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3F )
#define ADD_VEC3D_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3d >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC3D )
#define ADD_VEC3_SERIALIZER(PROP, DEF) ADD_VEC3F_SERIALIZER(PROP, DEF)
#define ADD_VEC4B_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4b >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4B )
#define ADD_VEC4UB_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4ub >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4UB )
#define ADD_VEC4S_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4s >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4S )
#define ADD_VEC4US_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4us >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4US )
#define ADD_VEC4I_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4i >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4I )
#define ADD_VEC4UI_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4ui >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4UI )
#define ADD_VEC4F_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4f >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4F )
#define ADD_VEC4D_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec4d >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_VEC4D )
#define ADD_VEC4_SERIALIZER(PROP, DEF) ADD_VEC4F_SERIALIZER(PROP, DEF)
#define ADD_QUAT_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Quat >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_QUAT )
#define ADD_PLANE_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Plane >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_PLANE )
#define ADD_MATRIXF_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Matrixf >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_MATRIXF )
#define ADD_MATRIXD_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Matrixd >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_MATRIXD )
#define ADD_MATRIX_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::MatrixSerializer< MyClass >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_MATRIX )
#define ADD_BOUNDINGBOXF_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::BoundingBoxf >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOUNDINGBOXF )
#define ADD_BOUNDINGBOXD_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::BoundingBoxd >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOUNDINGBOXD )
#define ADD_BOUNDINGSPHEREF_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::BoundingSpheref >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOUNDINGSPHEREF )
#define ADD_BOUNDINGSPHERED_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::BoundingSphered >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOUNDINGSPHERED )
#define ADD_GLENUM_SERIALIZER(PROP, TYPE, DEF) \
wrapper->addSerializer( new osgDB::GLenumSerializer< MyClass, TYPE >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_GLENUM )
#define ADD_GLENUM_SERIALIZER_NO_SET(PROP, TYPE, DEF) \
wrapper->addSerializer( new osgDB::GLenumSerializer< MyClass, TYPE >( \
#PROP, DEF, &MyClass::get##PROP, 0), osgDB::BaseSerializer::RW_GLENUM )
#define ADD_STRING_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::StringSerializer< MyClass >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_STRING )
#define ADD_OBJECT_SERIALIZER(PROP, TYPE, DEF) \
wrapper->addSerializer( new osgDB::ObjectSerializer< MyClass, TYPE >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_OBJECT )
#define ADD_OBJECT_SERIALIZER_NO_SET(PROP, TYPE, DEF) \
wrapper->addSerializer( new osgDB::ObjectSerializer< MyClass, TYPE >( \
#PROP, DEF, &MyClass::get##PROP, 0), osgDB::BaseSerializer::RW_OBJECT )
#define ADD_IMAGE_SERIALIZER(PROP, TYPE, DEF) \
wrapper->addSerializer( new osgDB::ImageSerializer< MyClass, TYPE >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_IMAGE )
#define ADD_LIST_SERIALIZER(PROP, TYPE) \
wrapper->addSerializer( new osgDB::ListSerializer< MyClass, TYPE >( \
#PROP, &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_LIST )
#define ADD_VECTOR_SERIALIZER(PROP, TYPE, ELEMENTTYPE, NUMELEMENTSONROW) \
wrapper->addSerializer( new osgDB::VectorSerializer< MyClass, TYPE >( \
#PROP, &MyClass::get##PROP, &MyClass::get##PROP, &MyClass::set##PROP, ELEMENTTYPE, NUMELEMENTSONROW), osgDB::BaseSerializer::RW_VECTOR )
#define ADD_ISAVECTOR_SERIALIZER(PROP, ELEMENTTYPE, NUMELEMENTSONROW) \
wrapper->addSerializer( new osgDB::IsAVectorSerializer< MyClass >( #PROP, ELEMENTTYPE, NUMELEMENTSONROW), osgDB::BaseSerializer::RW_VECTOR )
#define BEGIN_ENUM_SERIALIZER(PROP, DEF) \
{ typedef osgDB::EnumSerializer<MyClass, MyClass::PROP, void> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, MyClass::DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_ENUM_SERIALIZER2(PROP, TYPE, DEF) \
{ typedef osgDB::EnumSerializer<MyClass, TYPE, void> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, MyClass::DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_ENUM_SERIALIZER3(PROP, DEF) \
{ typedef osgDB::EnumSerializer<MyClass, MyClass::PROP, bool> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, MyClass::DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_ENUM_SERIALIZER4(PROPERTIES_CLASS, PROP, DEF) \
{ typedef osgDB::EnumSerializer<MyClass, PROPERTIES_CLASS::PROP, void> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, PROPERTIES_CLASS::DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_ENUM_SERIALIZER_NO_SET(PROP, DEF) \
{ typedef osgDB::EnumSerializer<MyClass, MyClass::PROP, void> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, MyClass::DEF, &MyClass::get##PROP, 0)
#define ADD_ENUM_VALUE(VALUE) \
serializer->add(#VALUE, MyClass::VALUE)
#define ADD_ENUM_CLASS_VALUE(CLASS, VALUE) \
serializer->add(#VALUE, CLASS::VALUE)
#define END_ENUM_SERIALIZER() \
wrapper->addSerializer(serializer.get(), osgDB::BaseSerializer::RW_ENUM); }
#define BEGIN_BITFLAGS_SERIALIZER(PROP, DEF) \
{ typedef osgDB::BitFlagsSerializer<MyClass> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_UINT_BITFLAGS_SERIALIZER(PROP, DEF) \
{ typedef osgDB::BitFlagsSerializer<MyClass, unsigned int> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_INT_BITFLAGS_SERIALIZER(PROP, DEF) \
{ typedef osgDB::BitFlagsSerializer<MyClass, int> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define ADD_BITFLAG_VALUE(VALUE_NAME, VALUE) \
serializer->add(#VALUE_NAME, VALUE)
#define END_BITFLAGS_SERIALIZER() \
wrapper->addSerializer(serializer.get(), osgDB::BaseSerializer::RW_INT); }
// VERSION CONTROL OPERATORS
#define UPDATE_TO_VERSION(VER) \
wrapper->setUpdatedVersion( (VER) );
#define UPDATE_TO_VERSION_SCOPED(VER) \
osgDB::UpdateWrapperVersionProxy uwvp(wrapper, (VER));
#define ADDED_ASSOCIATE(STR) \
wrapper->markAssociateAsAdded( STR );
#define REMOVED_ASSOCIATE(STR) \
wrapper->markAssociateAsRemoved( STR );
#define REMOVE_SERIALIZER(PROP) \
wrapper->markSerializerAsRemoved( #PROP );
#define ADD_MAP_SERIALIZER(PROP, TYPE, KEYTYPE, ELEMENTTYPE) \
wrapper->addSerializer( new osgDB::MapSerializer< MyClass, TYPE >( \
#PROP, &MyClass::get##PROP, &MyClass::get##PROP, &MyClass::set##PROP, KEYTYPE, ELEMENTTYPE), osgDB::BaseSerializer::RW_MAP )
#define ADD_METHOD_OBJECT( METHODNAME, METHODOBJECTCLASS ) wrapper->addMethodObject(METHODNAME, new METHODOBJECTCLASS());
#define ADD_METHOD(METHODNAME) \
{ \
struct MethodCaller : public osgDB::MethodObject \
{ \
virtual bool run(void* objectPtr, osg::Parameters&, osg::Parameters&) const \
{ \
MyClass* obj = reinterpret_cast<MyClass*>(objectPtr); \
obj->METHODNAME(); \
return true; \
} \
}; \
wrapper->addMethodObject(#METHODNAME, new MethodCaller()); \
}
#define SET_USAGE(VALUE) wrapper->getLastSerializer()->setUsage(VALUE)
}
#endif
GLENUM
#define GLENUM(value)
Definition DataTypes:101
DEF_GLENUM
#define DEF_GLENUM(var)
Definition DataTypes:102
InputStream
Notify
Object
OutputStream
OBJECT_CAST
#define OBJECT_CAST
Definition Serializer:36
osgDB::BaseSerializer
Definition Serializer:141
osgDB::BaseSerializer::BaseSerializer
BaseSerializer(int usage)
Definition Serializer:167
osgDB::BaseSerializer::_usage
int _usage
Definition Serializer:196
osgDB::BaseSerializer::get
virtual bool get(const osg::Object &, void *)
Definition Serializer:170
osgDB::BaseSerializer::supportsSet
bool supportsSet() const
Definition Serializer:191
osgDB::BaseSerializer::write
virtual bool write(OutputStream &, const osg::Object &)=0
osgDB::BaseSerializer::getUsage
int getUsage() const
Definition Serializer:179
osgDB::BaseSerializer::_firstVersion
int _firstVersion
Definition Serializer:194
osgDB::BaseSerializer::_lastVersion
int _lastVersion
Definition Serializer:195
osgDB::BaseSerializer::getName
virtual const std::string & getName() const =0
osgDB::BaseSerializer::read
virtual bool read(InputStream &, osg::Object &)=0
osgDB::BaseSerializer::supportsGetSet
bool supportsGetSet() const
Definition Serializer:189
osgDB::BaseSerializer::set
virtual bool set(osg::Object &, void *)
Definition Serializer:169
osgDB::BaseSerializer::supportsGet
bool supportsGet() const
Definition Serializer:190
osgDB::BaseSerializer::ObjectWrapper
friend class ObjectWrapper
Definition Serializer:142
osgDB::BaseSerializer::supportsReadWrite
bool supportsReadWrite() const
Definition Serializer:188
osgDB::BaseSerializer::Usage
Usage
Definition Serializer:159
osgDB::BaseSerializer::READ_WRITE_PROPERTY
@ READ_WRITE_PROPERTY
Definition Serializer:160
osgDB::BaseSerializer::SET_PROPERTY
@ SET_PROPERTY
Definition Serializer:162
osgDB::BaseSerializer::GET_PROPERTY
@ GET_PROPERTY
Definition Serializer:161
osgDB::BaseSerializer::GET_SET_PROPERTY
@ GET_SET_PROPERTY
Definition Serializer:163
osgDB::BaseSerializer::setUsage
void setUsage(int usage)
Definition Serializer:178
osgDB::BaseSerializer::Type
Type
Definition Serializer:145
osgDB::BaseSerializer::RW_UINT
@ RW_UINT
Definition Serializer:147
osgDB::BaseSerializer::RW_VEC4UB
@ RW_VEC4UB
Definition Serializer:152
osgDB::BaseSerializer::RW_VEC3I
@ RW_VEC3I
Definition Serializer:151
osgDB::BaseSerializer::RW_VEC3B
@ RW_VEC3B
Definition Serializer:151
osgDB::BaseSerializer::RW_VEC2B
@ RW_VEC2B
Definition Serializer:150
osgDB::BaseSerializer::RW_DOUBLE
@ RW_DOUBLE
Definition Serializer:147
osgDB::BaseSerializer::RW_BOUNDINGSPHEREF
@ RW_BOUNDINGSPHEREF
Definition Serializer:154
osgDB::BaseSerializer::RW_VEC4D
@ RW_VEC4D
Definition Serializer:148
osgDB::BaseSerializer::RW_VEC2F
@ RW_VEC2F
Definition Serializer:148
osgDB::BaseSerializer::RW_BOUNDINGBOXF
@ RW_BOUNDINGBOXF
Definition Serializer:153
osgDB::BaseSerializer::RW_MATRIXF
@ RW_MATRIXF
Definition Serializer:149
osgDB::BaseSerializer::RW_USHORT
@ RW_USHORT
Definition Serializer:147
osgDB::BaseSerializer::RW_OBJECT
@ RW_OBJECT
Definition Serializer:146
osgDB::BaseSerializer::RW_ENUM
@ RW_ENUM
Definition Serializer:149
osgDB::BaseSerializer::RW_MAP
@ RW_MAP
Definition Serializer:155
osgDB::BaseSerializer::RW_SHORT
@ RW_SHORT
Definition Serializer:147
osgDB::BaseSerializer::RW_QUAT
@ RW_QUAT
Definition Serializer:148
osgDB::BaseSerializer::RW_VEC2UI
@ RW_VEC2UI
Definition Serializer:150
osgDB::BaseSerializer::RW_VEC4US
@ RW_VEC4US
Definition Serializer:152
osgDB::BaseSerializer::RW_PLANE
@ RW_PLANE
Definition Serializer:148
osgDB::BaseSerializer::RW_VEC3UB
@ RW_VEC3UB
Definition Serializer:151
osgDB::BaseSerializer::RW_VEC3US
@ RW_VEC3US
Definition Serializer:151
osgDB::BaseSerializer::RW_VEC4B
@ RW_VEC4B
Definition Serializer:152
osgDB::BaseSerializer::RW_VECTOR
@ RW_VECTOR
Definition Serializer:155
osgDB::BaseSerializer::RW_VEC4F
@ RW_VEC4F
Definition Serializer:148
osgDB::BaseSerializer::RW_BOUNDINGBOXD
@ RW_BOUNDINGBOXD
Definition Serializer:153
osgDB::BaseSerializer::RW_VEC2D
@ RW_VEC2D
Definition Serializer:148
osgDB::BaseSerializer::RW_VEC3UI
@ RW_VEC3UI
Definition Serializer:151
osgDB::BaseSerializer::RW_VEC3D
@ RW_VEC3D
Definition Serializer:148
osgDB::BaseSerializer::RW_MATRIX
@ RW_MATRIX
Definition Serializer:149
osgDB::BaseSerializer::RW_VEC4S
@ RW_VEC4S
Definition Serializer:152
osgDB::BaseSerializer::RW_VEC2US
@ RW_VEC2US
Definition Serializer:150
osgDB::BaseSerializer::RW_IMAGE
@ RW_IMAGE
Definition Serializer:146
osgDB::BaseSerializer::RW_VEC4I
@ RW_VEC4I
Definition Serializer:152
osgDB::BaseSerializer::RW_MATRIXD
@ RW_MATRIXD
Definition Serializer:149
osgDB::BaseSerializer::RW_FLOAT
@ RW_FLOAT
Definition Serializer:147
osgDB::BaseSerializer::RW_VEC3S
@ RW_VEC3S
Definition Serializer:151
osgDB::BaseSerializer::RW_UCHAR
@ RW_UCHAR
Definition Serializer:147
osgDB::BaseSerializer::RW_LIST
@ RW_LIST
Definition Serializer:146
osgDB::BaseSerializer::RW_BOUNDINGSPHERED
@ RW_BOUNDINGSPHERED
Definition Serializer:154
osgDB::BaseSerializer::RW_INT
@ RW_INT
Definition Serializer:147
osgDB::BaseSerializer::RW_VEC2I
@ RW_VEC2I
Definition Serializer:150
osgDB::BaseSerializer::RW_UNDEFINED
@ RW_UNDEFINED
Definition Serializer:146
osgDB::BaseSerializer::RW_VEC4UI
@ RW_VEC4UI
Definition Serializer:152
osgDB::BaseSerializer::RW_VEC2S
@ RW_VEC2S
Definition Serializer:150
osgDB::BaseSerializer::RW_GLENUM
@ RW_GLENUM
Definition Serializer:149
osgDB::BaseSerializer::RW_CHAR
@ RW_CHAR
Definition Serializer:147
osgDB::BaseSerializer::RW_VEC2UB
@ RW_VEC2UB
Definition Serializer:150
osgDB::BaseSerializer::RW_STRING
@ RW_STRING
Definition Serializer:149
osgDB::BaseSerializer::RW_BOOL
@ RW_BOOL
Definition Serializer:147
osgDB::BaseSerializer::RW_USER
@ RW_USER
Definition Serializer:146
osgDB::BaseSerializer::RW_VEC3F
@ RW_VEC3F
Definition Serializer:148
osgDB::BaseSerializer::getIntLookup
virtual IntLookup * getIntLookup()
Definition Serializer:176
osgDB::BaseSerializer::setUsage
void setUsage(bool hasGetter, bool hasSetter)
Definition Serializer:181
osgDB::BitFlagsSerializer::Setter
void(C::* Setter)(P)
Definition Serializer:1457
osgDB::BitFlagsSerializer::_getter
Getter _getter
Definition Serializer:1540
osgDB::BitFlagsSerializer::write
virtual bool write(osgDB::OutputStream &os, const osg::Object &obj)
Definition Serializer:1504
osgDB::BitFlagsSerializer::BitFlagsSerializer
BitFlagsSerializer(const char *name, P def, Getter gf, Setter sf)
Definition Serializer:1459
osgDB::BitFlagsSerializer::getValue
P getValue(const char *str)
Definition Serializer:1467
osgDB::BitFlagsSerializer::Getter
P(C::* Getter)() const
Definition Serializer:1456
osgDB::BitFlagsSerializer::ParentType
TemplateSerializer< P > ParentType
Definition Serializer:1455
osgDB::BitFlagsSerializer::_setter
Setter _setter
Definition Serializer:1541
osgDB::BitFlagsSerializer::_lookup
osgDB::IntLookup _lookup
Definition Serializer:1544
osgDB::BitFlagsSerializer::read
virtual bool read(osgDB::InputStream &is, osg::Object &obj)
Definition Serializer:1473
osgDB::BitFlagsSerializer::add
void add(const char *str, P value)
Definition Serializer:1462
osgDB::BitFlagsSerializer::getString
const std::string & getString(P value)
Definition Serializer:1470
osgDB::EnumSerializer::getIntLookup
virtual IntLookup * getIntLookup()
Definition Serializer:721
osgDB::EnumSerializer::_setter
Setter _setter
Definition Serializer:766
osgDB::EnumSerializer::_lookup
IntLookup _lookup
Definition Serializer:769
osgDB::EnumSerializer::EnumSerializer
EnumSerializer(const char *name, P def, Getter gf, Setter sf)
Definition Serializer:716
osgDB::EnumSerializer::Setter
B(C::* Setter)(P)
Definition Serializer:714
osgDB::EnumSerializer::ParentType
TemplateSerializer< P > ParentType
Definition Serializer:712
osgDB::EnumSerializer::add
void add(const char *str, P value)
Definition Serializer:723
osgDB::EnumSerializer::Getter
P(C::* Getter)() const
Definition Serializer:713
osgDB::EnumSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:732
osgDB::EnumSerializer::_getter
Getter _getter
Definition Serializer:765
osgDB::EnumSerializer::getValue
P getValue(const char *str)
Definition Serializer:726
osgDB::EnumSerializer::getString
const std::string & getString(P value)
Definition Serializer:729
osgDB::EnumSerializer::write
virtual bool write(osgDB::OutputStream &os, const osg::Object &obj)
Definition Serializer:749
osgDB::GLenumSerializer::ParentType
TemplateSerializer< P > ParentType
Definition Serializer:455
osgDB::GLenumSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:480
osgDB::GLenumSerializer::_getter
Getter _getter
Definition Serializer:496
osgDB::GLenumSerializer::Getter
P(C::* Getter)() const
Definition Serializer:456
osgDB::GLenumSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:464
osgDB::GLenumSerializer::_setter
Setter _setter
Definition Serializer:497
osgDB::GLenumSerializer::Setter
void(C::* Setter)(P)
Definition Serializer:457
osgDB::GLenumSerializer::GLenumSerializer
GLenumSerializer(const char *name, P def, Getter gf, Setter sf)
Definition Serializer:459
osgDB::ImageSerializer::ParentType
TemplateSerializer< P * > ParentType
Definition Serializer:637
osgDB::ImageSerializer::set
virtual bool set(osg::Object &obj, void *value)
Definition Serializer:647
osgDB::ImageSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:650
osgDB::ImageSerializer::get
virtual bool get(const osg::Object &obj, void *value)
Definition Serializer:648
osgDB::ImageSerializer::ImageSerializer
ImageSerializer(const char *name, P *def, Getter gf, Setter sf)
Definition Serializer:641
osgDB::ImageSerializer::Getter
const P *(C::* Getter)() const
Definition Serializer:638
osgDB::ImageSerializer::Setter
void(C::* Setter)(P *)
Definition Serializer:639
osgDB::ImageSerializer::_getter
Getter _getter
Definition Serializer:704
osgDB::ImageSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:679
osgDB::ImageSerializer::_setter
Setter _setter
Definition Serializer:705
osgDB::InputStream
Definition InputStream:64
osgDB::InputStream::matchString
bool matchString(const std::string &str)
Definition InputStream:148
osgDB::InputStream::readWrappedString
void readWrappedString(std::string &str)
Definition InputStream:150
osgDB::InputStream::isBinary
bool isBinary() const
Definition InputStream:83
osgDB::InputStream::readImage
osg::ref_ptr< osg::Image > readImage(bool readFromExternal=true)
osgDB::InputStream::END_BRACKET
ObjectMark END_BRACKET
Definition InputStream:203
osgDB::InputStream::BEGIN_BRACKET
ObjectMark BEGIN_BRACKET
Definition InputStream:202
osgDB::InputStream::getFileVersion
int getFileVersion(const std::string &d=std::string()) const
osgDB::InputStream::readObjectOfType
osg::ref_ptr< T > readObjectOfType()
Definition InputStream:163
osgDB::IntLookup
Definition Serializer:40
osgDB::IntLookup::size
unsigned int size() const
Definition Serializer:47
osgDB::IntLookup::_valueToString
ValueToString _valueToString
Definition Serializer:109
osgDB::IntLookup::getValue
Value getValue(const char *str)
Definition Serializer:73
osgDB::IntLookup::getValueToString
ValueToString & getValueToString()
Definition Serializer:104
osgDB::IntLookup::getValueToString
const ValueToString & getValueToString() const
Definition Serializer:105
osgDB::IntLookup::IntLookup
IntLookup()
Definition Serializer:46
osgDB::IntLookup::getStringToValue
StringToValue & getStringToValue()
Definition Serializer:101
osgDB::IntLookup::StringToValue
std::map< std::string, Value > StringToValue
Definition Serializer:43
osgDB::IntLookup::add
void add(const char *str, Value value)
Definition Serializer:49
osgDB::IntLookup::_stringToValue
StringToValue _stringToValue
Definition Serializer:108
osgDB::IntLookup::Value
int Value
Definition Serializer:42
osgDB::IntLookup::add2
void add2(const char *str, const char *newStr, Value value)
Definition Serializer:61
osgDB::IntLookup::getStringToValue
const StringToValue & getStringToValue() const
Definition Serializer:102
osgDB::IntLookup::getString
const std::string & getString(Value value)
Definition Serializer:87
osgDB::IntLookup::ValueToString
std::map< Value, std::string > ValueToString
Definition Serializer:44
osgDB::IsAVectorSerializer::addElement
virtual void addElement(osg::Object &obj, void *ptr) const
Definition Serializer:1088
osgDB::IsAVectorSerializer::getElement
virtual void * getElement(osg::Object &obj, unsigned int index) const
Definition Serializer:1105
osgDB::IsAVectorSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:1153
osgDB::IsAVectorSerializer::getElement
virtual const void * getElement(const osg::Object &obj, unsigned int index) const
Definition Serializer:1112
osgDB::IsAVectorSerializer::insertElement
virtual void insertElement(osg::Object &obj, unsigned int index, void *ptr) const
Definition Serializer:1093
osgDB::IsAVectorSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:1119
osgDB::IsAVectorSerializer::getName
virtual const std::string & getName() const
Definition Serializer:1066
osgDB::IsAVectorSerializer::_numElementsOnRow
unsigned int _numElementsOnRow
Definition Serializer:1201
osgDB::IsAVectorSerializer::resize
virtual void resize(osg::Object &obj, unsigned int numElements) const
Definition Serializer:1073
osgDB::IsAVectorSerializer::ValueType
C::value_type ValueType
Definition Serializer:1058
osgDB::IsAVectorSerializer::reserve
virtual void reserve(osg::Object &obj, unsigned int numElements) const
Definition Serializer:1078
osgDB::IsAVectorSerializer::_name
std::string _name
Definition Serializer:1200
osgDB::IsAVectorSerializer::IsAVectorSerializer
IsAVectorSerializer(const char *name, BaseSerializer::Type elementType, unsigned int numElementsOnRow)
Definition Serializer:1061
osgDB::IsAVectorSerializer::setElement
virtual void setElement(osg::Object &obj, unsigned int index, void *ptr) const
Definition Serializer:1099
osgDB::IsAVectorSerializer::clear
virtual void clear(osg::Object &obj) const
Definition Serializer:1083
osgDB::IsAVectorSerializer::size
virtual unsigned int size(const osg::Object &obj) const
Definition Serializer:1068
osgDB::IsAVectorSerializer::ConstIterator
C::const_iterator ConstIterator
Definition Serializer:1059
osgDB::ListSerializer::_setter
Setter _setter
Definition Serializer:854
osgDB::ListSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:823
osgDB::ListSerializer::ValueType
P::value_type ValueType
Definition Serializer:777
osgDB::ListSerializer::Setter
void(C::* Setter)(const P &)
Definition Serializer:780
osgDB::ListSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:788
osgDB::ListSerializer::_getter
Getter _getter
Definition Serializer:853
osgDB::ListSerializer::getName
virtual const std::string & getName() const
Definition Serializer:786
osgDB::ListSerializer::Getter
const P &(C::* Getter)() const
Definition Serializer:779
osgDB::ListSerializer::ConstIterator
P::const_iterator ConstIterator
Definition Serializer:778
osgDB::ListSerializer::ListSerializer
ListSerializer(const char *name, Getter gf, Setter sf)
Definition Serializer:782
osgDB::ListSerializer::_name
std::string _name
Definition Serializer:852
osgDB::MapBaseSerializer::getKeySize
unsigned int getKeySize() const
Definition Serializer:1252
osgDB::MapBaseSerializer::_elementType
Type _elementType
Definition Serializer:1270
osgDB::MapBaseSerializer::size
virtual unsigned int size(const osg::Object &) const
Definition Serializer:1261
osgDB::MapBaseSerializer::_keyType
Type _keyType
Definition Serializer:1267
osgDB::MapBaseSerializer::MapBaseSerializer
MapBaseSerializer(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize)
Definition Serializer:1246
osgDB::MapBaseSerializer::getElementSize
unsigned int getElementSize() const
Definition Serializer:1255
osgDB::MapBaseSerializer::getElementType
Type getElementType() const
Definition Serializer:1254
osgDB::MapBaseSerializer::getElement
virtual void * getElement(osg::Object &, void *) const
Definition Serializer:1259
osgDB::MapBaseSerializer::clear
virtual void clear(osg::Object &) const
Definition Serializer:1257
osgDB::MapBaseSerializer::getKeyType
Type getKeyType() const
Definition Serializer:1251
osgDB::MapBaseSerializer::_keySize
unsigned int _keySize
Definition Serializer:1268
osgDB::MapBaseSerializer::setElement
virtual void setElement(osg::Object &, void *, void *) const
Definition Serializer:1258
osgDB::MapBaseSerializer::createIterator
virtual MapIteratorObject * createIterator(osg::Object &) const
Definition Serializer:1263
osgDB::MapBaseSerializer::createReverseIterator
virtual MapIteratorObject * createReverseIterator(osg::Object &) const
Definition Serializer:1264
osgDB::MapBaseSerializer::_elementSize
unsigned int _elementSize
Definition Serializer:1271
osgDB::MapBaseSerializer::getElement
virtual const void * getElement(const osg::Object &, void *) const
Definition Serializer:1260
osgDB::MapIteratorObject
Definition Serializer:1205
osgDB::MapIteratorObject::getElement
virtual void * getElement() const
Definition Serializer:1231
osgDB::MapIteratorObject::META_Object
META_Object(osgDB, MapIteratorObject)
osgDB::MapIteratorObject::MapIteratorObject
MapIteratorObject(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize)
Definition Serializer:1211
osgDB::MapIteratorObject::_elementType
BaseSerializer::Type _elementType
Definition Serializer:1238
osgDB::MapIteratorObject::advance
virtual bool advance()
Definition Serializer:1228
osgDB::MapIteratorObject::MapIteratorObject
MapIteratorObject(const MapIteratorObject &rhs, const osg::CopyOp copyop=osg::CopyOp::SHALLOW_COPY)
Definition Serializer:1215
osgDB::MapIteratorObject::getElementType
BaseSerializer::Type getElementType() const
Definition Serializer:1225
osgDB::MapIteratorObject::_keySize
unsigned int _keySize
Definition Serializer:1236
osgDB::MapIteratorObject::getKey
virtual const void * getKey() const
Definition Serializer:1230
osgDB::MapIteratorObject::getElementSize
unsigned int getElementSize() const
Definition Serializer:1226
osgDB::MapIteratorObject::getKeySize
unsigned int getKeySize() const
Definition Serializer:1223
osgDB::MapIteratorObject::setElement
virtual void setElement(void *) const
Definition Serializer:1232
osgDB::MapIteratorObject::getKeyType
BaseSerializer::Type getKeyType() const
Definition Serializer:1222
osgDB::MapIteratorObject::valid
virtual bool valid() const
Definition Serializer:1229
osgDB::MapIteratorObject::MapIteratorObject
MapIteratorObject()
Definition Serializer:1207
osgDB::MapIteratorObject::_keyType
BaseSerializer::Type _keyType
Definition Serializer:1235
osgDB::MapIteratorObject::_elementSize
unsigned int _elementSize
Definition Serializer:1239
osgDB::MapSerializer::ConstGetter
const P &(C::* ConstGetter)() const
Definition Serializer:1286
osgDB::MapSerializer::getElement
virtual const void * getElement(const osg::Object &obj, void *ptrKey) const
Definition Serializer:1317
osgDB::MapSerializer::Getter
P &(C::* Getter)()
Definition Serializer:1285
osgDB::MapSerializer::KeyType
P::key_type KeyType
Definition Serializer:1280
osgDB::MapSerializer::size
virtual unsigned int size(const osg::Object &obj) const
Definition Serializer:1326
osgDB::MapSerializer::Setter
void(C::* Setter)(const P &)
Definition Serializer:1287
osgDB::MapSerializer::getName
virtual const std::string & getName() const
Definition Serializer:1294
osgDB::MapSerializer::_name
std::string _name
Definition Serializer:1445
osgDB::MapSerializer::createIterator
virtual MapIteratorObject * createIterator(osg::Object &obj) const
Definition Serializer:1367
osgDB::MapSerializer::Iterator
P::iterator Iterator
Definition Serializer:1282
osgDB::MapSerializer::_getter
Getter _getter
Definition Serializer:1447
osgDB::MapSerializer::ElementType
P::mapped_type ElementType
Definition Serializer:1281
osgDB::MapSerializer::setElement
virtual void setElement(osg::Object &obj, void *ptrKey, void *ptrValue) const
Definition Serializer:1303
osgDB::MapSerializer::ConstIterator
P::const_iterator ConstIterator
Definition Serializer:1284
osgDB::MapSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:1418
osgDB::MapSerializer::getElement
virtual void * getElement(osg::Object &obj, void *ptrKey) const
Definition Serializer:1310
osgDB::MapSerializer::MapSerializer
MapSerializer(const char *name, ConstGetter cgf, Getter gf, Setter sf, BaseSerializer::Type keyType, BaseSerializer::Type elementType)
Definition Serializer:1289
osgDB::MapSerializer::_setter
Setter _setter
Definition Serializer:1448
osgDB::MapSerializer::createReverseIterator
virtual MapIteratorObject * createReverseIterator(osg::Object &obj) const
Definition Serializer:1374
osgDB::MapSerializer::ValueType
P::value_type ValueType
Definition Serializer:1279
osgDB::MapSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:1381
osgDB::MapSerializer::clear
virtual void clear(osg::Object &obj) const
Definition Serializer:1296
osgDB::MapSerializer::_constgetter
ConstGetter _constgetter
Definition Serializer:1446
osgDB::MapSerializer::ReverseIterator
P::reverse_iterator ReverseIterator
Definition Serializer:1283
osgDB::MatrixSerializer::readMatrixImplementation
void readMatrixImplementation(InputStream &is, osg::Matrix &matrix)
Definition Serializer:428
osgDB::MatrixSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:411
osgDB::MatrixSerializer::_setter
Setter _setter
Definition Serializer:448
osgDB::MatrixSerializer::Setter
void(C::* Setter)(const osg::Matrix &)
Definition Serializer:387
osgDB::MatrixSerializer::_getter
Getter _getter
Definition Serializer:447
osgDB::MatrixSerializer::Getter
const osg::Matrix &(C::* Getter)() const
Definition Serializer:386
osgDB::MatrixSerializer::MatrixSerializer
MatrixSerializer(const char *name, const osg::Matrix &def, Getter gf, Setter sf)
Definition Serializer:389
osgDB::MatrixSerializer::ParentType
TemplateSerializer< osg::Matrix > ParentType
Definition Serializer:385
osgDB::MatrixSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:394
osgDB::ObjectSerializer::_defaultValue
osg::ref_ptr< P > _defaultValue
Definition Serializer:628
osgDB::ObjectSerializer::ObjectSerializer
ObjectSerializer(const char *name, P *def, Getter gf, Setter sf)
Definition Serializer:560
osgDB::ObjectSerializer::_name
std::string _name
Definition Serializer:627
osgDB::ObjectSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:599
osgDB::ObjectSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:572
osgDB::ObjectSerializer::Getter
const P *(C::* Getter)() const
Definition Serializer:557
osgDB::ObjectSerializer::Setter
void(C::* Setter)(P *)
Definition Serializer:558
osgDB::ObjectSerializer::getName
virtual const std::string & getName() const
Definition Serializer:570
osgDB::ObjectSerializer::get
virtual bool get(const osg::Object &obj, void *value)
Definition Serializer:568
osgDB::ObjectSerializer::_getter
Getter _getter
Definition Serializer:629
osgDB::ObjectSerializer::_setter
Setter _setter
Definition Serializer:630
osgDB::ObjectSerializer::set
virtual bool set(osg::Object &obj, void *value)
Definition Serializer:567
osgDB::OutputStream
Definition OutputStream:57
osgDB::OutputStream::writeImage
void writeImage(const osg::Image *img)
osgDB::OutputStream::writeObject
void writeObject(const osg::Object *obj)
osgDB::OutputStream::BEGIN_BRACKET
ObjectMark BEGIN_BRACKET
Definition OutputStream:193
osgDB::OutputStream::END_BRACKET
ObjectMark END_BRACKET
Definition OutputStream:194
osgDB::OutputStream::getFileVersion
int getFileVersion(const std::string &d=std::string()) const
osgDB::OutputStream::isBinary
bool isBinary() const
Definition OutputStream:85
osgDB::OutputStream::PROPERTY
ObjectProperty PROPERTY
Definition OutputStream:192
osgDB::OutputStream::writeWrappedString
void writeWrappedString(const std::string &str)
Definition OutputStream:161
osgDB::PropByRefSerializer::_setter
Setter _setter
Definition Serializer:378
osgDB::PropByRefSerializer::Getter
CP(C::* Getter)() const
Definition Serializer:336
osgDB::PropByRefSerializer::CP
const P & CP
Definition Serializer:335
osgDB::PropByRefSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:361
osgDB::PropByRefSerializer::PropByRefSerializer
PropByRefSerializer(const char *name, CP def, Getter gf, Setter sf)
Definition Serializer:339
osgDB::PropByRefSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:344
osgDB::PropByRefSerializer::Setter
void(C::* Setter)(CP)
Definition Serializer:337
osgDB::PropByRefSerializer::_getter
Getter _getter
Definition Serializer:377
osgDB::PropByRefSerializer::ParentType
TemplateSerializer< P > ParentType
Definition Serializer:334
osgDB::PropByValSerializer::Setter
void(C::* Setter)(P)
Definition Serializer:277
osgDB::PropByValSerializer::PropByValSerializer
PropByValSerializer(const char *name, P def, Getter gf, Setter sf, bool useHex=false)
Definition Serializer:279
osgDB::PropByValSerializer::Getter
P(C::* Getter)() const
Definition Serializer:276
osgDB::PropByValSerializer::ParentType
TemplateSerializer< P > ParentType
Definition Serializer:275
osgDB::PropByValSerializer::_setter
Setter _setter
Definition Serializer:324
osgDB::PropByValSerializer::_getter
Getter _getter
Definition Serializer:323
osgDB::PropByValSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:303
osgDB::PropByValSerializer::_useHex
bool _useHex
Definition Serializer:327
osgDB::PropByValSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:284
osgDB::StringSerializer::_getter
Getter _getter
Definition Serializer:549
osgDB::StringSerializer::Getter
const std::string &(C::* Getter)() const
Definition Serializer:505
osgDB::StringSerializer::StringSerializer
StringSerializer(const char *name, const std::string &def, Getter gf, Setter sf)
Definition Serializer:508
osgDB::StringSerializer::_setter
Setter _setter
Definition Serializer:550
osgDB::StringSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:513
osgDB::StringSerializer::ParentType
TemplateSerializer< std::string > ParentType
Definition Serializer:504
osgDB::StringSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:531
osgDB::StringSerializer::Setter
void(C::* Setter)(const std::string &)
Definition Serializer:506
osgDB::TemplateSerializer
Definition Serializer:256
osgDB::TemplateSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)=0
osgDB::TemplateSerializer::TemplateSerializer
TemplateSerializer(const char *name, P def)
Definition Serializer:259
osgDB::TemplateSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)=0
osgDB::TemplateSerializer< osg::Matrix >::_defaultValue
osg::Matrix _defaultValue
Definition Serializer:268
osgDB::TemplateSerializer< osg::Matrix >::_name
std::string _name
Definition Serializer:267
osgDB::TemplateSerializer::getName
virtual const std::string & getName() const
Definition Serializer:264
osgDB::UserLookupTableProxy::_lookup
IntLookup _lookup
Definition Serializer:118
osgDB::UserLookupTableProxy::AddValueFunc
void(* AddValueFunc)(IntLookup *lookup)
Definition Serializer:115
osgDB::UserLookupTableProxy::UserLookupTableProxy
UserLookupTableProxy(AddValueFunc func)
Definition Serializer:116
osgDB::UserSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:210
osgDB::UserSerializer::getName
virtual const std::string & getName() const
Definition Serializer:243
osgDB::UserSerializer::Checker
bool(* Checker)(const C &)
Definition Serializer:203
osgDB::UserSerializer::Writer
bool(* Writer)(OutputStream &, const C &)
Definition Serializer:205
osgDB::UserSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:226
osgDB::UserSerializer::_writer
Writer _writer
Definition Serializer:251
osgDB::UserSerializer::_name
std::string _name
Definition Serializer:246
osgDB::UserSerializer::Reader
bool(* Reader)(InputStream &, C &)
Definition Serializer:204
osgDB::UserSerializer::UserSerializer
UserSerializer(const char *name, Checker cf, Reader rf, Writer wf)
Definition Serializer:207
osgDB::UserSerializer::_checker
Checker _checker
Definition Serializer:247
osgDB::UserSerializer::_reader
Reader _reader
Definition Serializer:250
osgDB::VectorBaseSerializer::VectorBaseSerializer
VectorBaseSerializer(BaseSerializer::Type elementType, unsigned int elementSize)
Definition Serializer:861
osgDB::VectorBaseSerializer::addElement
virtual void addElement(osg::Object &, void *) const
Definition Serializer:872
osgDB::VectorBaseSerializer::getElement
virtual void * getElement(osg::Object &, unsigned int) const
Definition Serializer:875
osgDB::VectorBaseSerializer::size
virtual unsigned int size(const osg::Object &) const
Definition Serializer:868
osgDB::VectorBaseSerializer::getElement
virtual const void * getElement(const osg::Object &, unsigned int) const
Definition Serializer:876
osgDB::VectorBaseSerializer::_elementSize
unsigned int _elementSize
Definition Serializer:880
osgDB::VectorBaseSerializer::insertElement
virtual void insertElement(osg::Object &, unsigned int, void *) const
Definition Serializer:873
osgDB::VectorBaseSerializer::clear
virtual void clear(osg::Object &) const
Definition Serializer:871
osgDB::VectorBaseSerializer::_elementType
Type _elementType
Definition Serializer:879
osgDB::VectorBaseSerializer::getElementSize
unsigned int getElementSize() const
Definition Serializer:866
osgDB::VectorBaseSerializer::setElement
virtual void setElement(osg::Object &, unsigned int, void *) const
Definition Serializer:874
osgDB::VectorBaseSerializer::resize
virtual void resize(osg::Object &, unsigned int) const
Definition Serializer:869
osgDB::VectorBaseSerializer::getElementType
Type getElementType() const
Definition Serializer:865
osgDB::VectorBaseSerializer::reserve
virtual void reserve(osg::Object &, unsigned int) const
Definition Serializer:870
osgDB::VectorSerializer::clear
virtual void clear(osg::Object &obj) const
Definition Serializer:920
osgDB::VectorSerializer::_setter
Setter _setter
Definition Serializer:1049
osgDB::VectorSerializer::getElement
virtual const void * getElement(const osg::Object &obj, unsigned int index) const
Definition Serializer:953
osgDB::VectorSerializer::ConstIterator
P::const_iterator ConstIterator
Definition Serializer:889
osgDB::VectorSerializer::resize
virtual void resize(osg::Object &obj, unsigned int numElements) const
Definition Serializer:908
osgDB::VectorSerializer::Setter
void(C::* Setter)(const P &)
Definition Serializer:892
osgDB::VectorSerializer::addElement
virtual void addElement(osg::Object &obj, void *ptr) const
Definition Serializer:926
osgDB::VectorSerializer::reserve
virtual void reserve(osg::Object &obj, unsigned int numElements) const
Definition Serializer:914
osgDB::VectorSerializer::_name
std::string _name
Definition Serializer:1046
osgDB::VectorSerializer::_numElementsOnRow
unsigned int _numElementsOnRow
Definition Serializer:1050
osgDB::VectorSerializer::VectorSerializer
VectorSerializer(const char *name, ConstGetter cgf, Getter gf, Setter sf, BaseSerializer::Type elementType, unsigned int numElementsOnRow)
Definition Serializer:894
osgDB::VectorSerializer::ConstGetter
const P &(C::* ConstGetter)() const
Definition Serializer:891
osgDB::VectorSerializer::Getter
P &(C::* Getter)()
Definition Serializer:890
osgDB::VectorSerializer::read
virtual bool read(InputStream &is, osg::Object &obj)
Definition Serializer:961
osgDB::VectorSerializer::insertElement
virtual void insertElement(osg::Object &obj, unsigned int index, void *ptr) const
Definition Serializer:932
osgDB::VectorSerializer::size
virtual unsigned int size(const osg::Object &obj) const
Definition Serializer:902
osgDB::VectorSerializer::getName
virtual const std::string & getName() const
Definition Serializer:900
osgDB::VectorSerializer::_constgetter
ConstGetter _constgetter
Definition Serializer:1047
osgDB::VectorSerializer::getElement
virtual void * getElement(osg::Object &obj, unsigned int index) const
Definition Serializer:946
osgDB::VectorSerializer::_getter
Getter _getter
Definition Serializer:1048
osgDB::VectorSerializer::setElement
virtual void setElement(osg::Object &obj, unsigned int index, void *ptr) const
Definition Serializer:939
osgDB::VectorSerializer::ValueType
P::value_type ValueType
Definition Serializer:888
osgDB::VectorSerializer::write
virtual bool write(OutputStream &os, const osg::Object &obj)
Definition Serializer:998
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Matrixd
Definition Matrixd:27
osg::Matrixf
Definition Matrixf:27
osg::Object
Definition Object:61
osg::Object::Object
Object()
Definition Object:69
osg::Referenced
Definition Referenced:44
osg::ref_ptr
Definition ref_ptr:32
osg::ref_ptr::get
T * get() const
Definition ref_ptr:117
osgDB
Definition Archive:24
osgDB::split
OSGDB_EXPORT void split(const std::string &src, StringList &list, char separator=' ')
osgDB::StringList
std::vector< std::string > StringList
Definition Serializer:31
osg
Definition AlphaFunc:19
osg::INFO
@ INFO
Definition Notify:35
osg::Matrix
Matrixd Matrix
Definition Matrix:27
osg::notify
std::ostream & notify(void)
Definition Notify:80
OSGDB_EXPORT
#define OSGDB_EXPORT
Definition osgDB/Export:39
NULL
#define NULL
Definition osg/Export:55
ref_ptr
osgDB::MapSerializer::MapIterator
Definition Serializer:1334
osgDB::MapSerializer::MapIterator::advance
virtual bool advance()
Definition Serializer:1343
osgDB::MapSerializer::MapIterator::MapIterator
MapIterator(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize, Iterator itr, Iterator endItr)
Definition Serializer:1335
osgDB::MapSerializer::MapIterator::getElement
virtual void * getElement() const
Definition Serializer:1346
osgDB::MapSerializer::MapIterator::getKey
virtual const void * getKey() const
Definition Serializer:1345
osgDB::MapSerializer::MapIterator::setElement
virtual void setElement(void *ptr) const
Definition Serializer:1347
osgDB::MapSerializer::MapIterator::_endItr
Iterator _endItr
Definition Serializer:1341
osgDB::MapSerializer::MapIterator::_itr
Iterator _itr
Definition Serializer:1340
osgDB::MapSerializer::MapIterator::valid
virtual bool valid() const
Definition Serializer:1344
osgDB::MapSerializer::ReverseMapIterator
Definition Serializer:1351
osgDB::MapSerializer::ReverseMapIterator::_endItr
ReverseIterator _endItr
Definition Serializer:1358
osgDB::MapSerializer::ReverseMapIterator::valid
virtual bool valid() const
Definition Serializer:1361
osgDB::MapSerializer::ReverseMapIterator::getKey
virtual const void * getKey() const
Definition Serializer:1362
osgDB::MapSerializer::ReverseMapIterator::getElement
virtual void * getElement() const
Definition Serializer:1363
osgDB::MapSerializer::ReverseMapIterator::advance
virtual bool advance()
Definition Serializer:1360
osgDB::MapSerializer::ReverseMapIterator::_itr
ReverseIterator _itr
Definition Serializer:1357
osgDB::MapSerializer::ReverseMapIterator::ReverseMapIterator
ReverseMapIterator(BaseSerializer::Type keyType, unsigned int keySize, BaseSerializer::Type elementType, unsigned int elementSize, ReverseIterator itr, ReverseIterator endItr)
Definition Serializer:1352
osgDB::MapSerializer::ReverseMapIterator::setElement
virtual void setElement(void *ptr) const
Definition Serializer:1364