Added Map serializer size() method and support for it in the lua plugin. Renamed functions in lua plugin to be more consistent.

This commit is contained in:
Robert Osfield
2014-02-26 11:01:35 +00:00
parent 69e9f2c973
commit 9394215d31
2 changed files with 45 additions and 16 deletions

View File

@@ -1145,6 +1145,7 @@ public:
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; }
protected:
Type _keyType;
@@ -1204,6 +1205,13 @@ public:
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();
}
virtual bool read( InputStream& is, osg::Object& obj )
{
C& object = OBJECT_CAST<C&>(obj);