Changeset 13041 for OpenSceneGraph/trunk/include/osgDB/InputStream
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgDB/InputStream (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgDB/InputStream
r13011 r13041 44 44 } 45 45 } 46 46 47 47 const std::string& getField() const { return _field; } 48 48 const std::string& getError() const { return _error; } 49 49 50 50 protected: 51 51 std::string _field; … … 58 58 typedef std::map< unsigned int, osg::ref_ptr<osg::Array> > ArrayMap; 59 59 typedef std::map< unsigned int, osg::ref_ptr<osg::Object> > IdentifierMap; 60 60 61 61 enum ReadType 62 62 { … … 66 66 READ_OBJECT 67 67 }; 68 68 69 69 InputStream( const osgDB::Options* options ); 70 70 virtual ~InputStream(); 71 71 72 72 bool isBinary() const { return _in->isBinary(); } 73 73 int getFileVersion() const { return _fileVersion; } 74 74 const osgDB::Options* getOptions() const { return _options.get(); } 75 75 76 76 // Serialization related functions 77 77 InputStream& operator>>( bool& b ) { _in->readBool(b); checkStream(); return *this; } … … 90 90 InputStream& operator>>( std::istream& (*fn)(std::istream&) ) { _in->readStream(fn); checkStream(); return *this; } 91 91 InputStream& operator>>( std::ios_base& (*fn)(std::ios_base&) ) { _in->readBase(fn); checkStream(); return *this; } 92 92 93 93 InputStream& operator>>( ObjectGLenum& value ) { _in->readGLenum(value); checkStream(); return *this; } 94 94 InputStream& operator>>( ObjectProperty& prop ) { _in->readProperty(prop); checkStream(); return *this; } 95 95 InputStream& operator>>( ObjectMark& mark ) { _in->readMark(mark); checkStream(); return *this; } 96 96 97 97 InputStream& operator>>( osg::Vec2b& v ); 98 98 InputStream& operator>>( osg::Vec3b& v ); … … 112 112 InputStream& operator>>( osg::Matrixf& mat ); 113 113 InputStream& operator>>( osg::Matrixd& mat ); 114 114 115 115 InputStream& operator>>( osg::Array*& a ) { a = readArray(); return *this; } 116 116 InputStream& operator>>( osg::Image*& img ) { img = readImage(); return *this; } 117 117 InputStream& operator>>( osg::PrimitiveSet*& p ) { p = readPrimitiveSet(); return *this; } 118 118 InputStream& operator>>( osg::Object*& obj ) { obj = readObject(); return *this; } 119 119 120 120 InputStream& operator>>( osg::ref_ptr<osg::Array>& ptr ) { ptr = readArray(); return *this; } 121 121 InputStream& operator>>( osg::ref_ptr<osg::Image>& ptr ) { ptr = readImage(); return *this; } 122 122 InputStream& operator>>( osg::ref_ptr<osg::PrimitiveSet>& ptr ) { ptr = readPrimitiveSet(); return *this; } 123 123 124 124 template<typename T> InputStream& operator>>( osg::ref_ptr<T>& ptr ) 125 125 { ptr = static_cast<T*>(readObject()); return *this; } 126 126 127 127 // Convenient methods for reading 128 128 bool matchString( const std::string& str ) { return _in->matchString(str); } … … 149 149 150 150 void decompress(); 151 151 152 152 // Schema handlers 153 153 void readSchema( std::istream& fin ); 154 154 void resetSchema(); 155 155 156 156 // Exception handlers 157 157 inline void throwException( const std::string& msg ); 158 158 const InputException* getException() const { return _exception.get(); } 159 159 160 160 protected: 161 161 inline void checkStream(); 162 162 void setWrapperSchema( const std::string& name, const std::string& properties ); 163 163 164 164 template<typename T> 165 165 void readArrayImplementation( T* a, unsigned int numComponentsPerElements, unsigned int componentSizeInBytes ); 166 166 167 167 ArrayMap _arrayMap; 168 168 IdentifierMap _identifierMap; 169 169 170 170 int _fileVersion; 171 171 bool _useSchemaData;
