Refactored the versioning of serializers so it now uses a _firstVersion and _lastVersion make it possible
to specify what range of versions support each serializer.
This commit is contained in:
@@ -56,9 +56,7 @@ public:
|
||||
const std::string& getName() const { return _name; }
|
||||
const StringList& getAssociates() const { return _associates; }
|
||||
|
||||
void addSerializer( BaseSerializer* s, BaseSerializer::Type t=BaseSerializer::RW_UNDEFINED )
|
||||
{ s->_version = _version; _serializers.push_back(s); _typeList.push_back(static_cast<int>(t)); }
|
||||
|
||||
void addSerializer( BaseSerializer* s, BaseSerializer::Type t=BaseSerializer::RW_UNDEFINED );
|
||||
void markSerializerAsRemoved( const std::string& name );
|
||||
BaseSerializer* getSerializer( const std::string& name );
|
||||
void addFinishedObjectReadCallback ( FinishedObjectReadCallback* forc) { _finishedObjectReadCallbacks.push_back(forc); }
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
#include <osg/Object>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
namespace osgDB
|
||||
{
|
||||
@@ -126,13 +127,15 @@ public:
|
||||
RW_MATRIXF, RW_MATRIXD, RW_MATRIX, RW_GLENUM, RW_STRING, RW_ENUM
|
||||
};
|
||||
|
||||
BaseSerializer() : _version(0) {}
|
||||
BaseSerializer() : _firstVersion(0), _lastVersion(INT_MAX) {}
|
||||
|
||||
virtual bool read( InputStream&, osg::Object& ) = 0;
|
||||
virtual bool write( OutputStream&, const osg::Object& ) = 0;
|
||||
virtual const std::string& getName() const = 0;
|
||||
|
||||
protected:
|
||||
int _version; // Library version when the serializer is added, or removed (neg value)
|
||||
int _firstVersion; // Library version when the serializer is first introduced
|
||||
int _lastVersion; // Library version when the serializer is last required.
|
||||
};
|
||||
|
||||
template<typename C>
|
||||
|
||||
Reference in New Issue
Block a user