15 #ifndef OSGDB_OUTPUTSTREAM
16 #define OSGDB_OUTPUTSTREAM
18 #include <osg/Version>
24 #include <osg/BoundingBox>
25 #include <osg/BoundingSphere>
27 #include <osg/PrimitiveSet>
28 #include <osgDB/ReaderWriter>
29 #include <osgDB/StreamOperator>
41 for (
unsigned int i=0; i<fields.size(); ++i )
59 typedef std::map<const osg::Array*, unsigned int>
ArrayMap;
60 typedef std::map<const osg::Object*, unsigned int>
ObjectMap;
72 WRITE_USE_IMAGE_HINT = 0,
82 void setFileVersion(
const std::string& d,
int v ) { _domainVersionMap[d] = v; }
83 int getFileVersion(
const std::string& d=std::string() )
const;
85 bool isBinary()
const {
return _out->isBinary(); }
152 OutputStream& operator<<( const osg::ref_ptr<osg::Image>& ptr ) { writeImage(ptr.get());
return *
this; }
156 template<
typename T>
OutputStream& operator<<( const osg::ref_ptr<T>& ptr ) { writeObject(ptr.get());
return *
this; }
160 void writeCharArray(
const char* s,
unsigned int size ) { _out->writeCharArray(s, size); }
164 void writeSize(T size) { *this<<static_cast<unsigned int>(size); }
172 void writeObjectFields(
const osg::Object* obj,
const std::string& compoundName );
180 void compress( std::ostream* ostream );
183 void writeSchema( std::ostream& fout );
186 inline void throwException(
const std::string& msg );
196 void writeArrayImplementation(
const T*,
int write_size,
unsigned int numInRow=1 );
198 unsigned int findOrCreateArrayID(
const osg::Array* array,
bool& newID );
199 unsigned int findOrCreateObjectID(
const osg::Object* obj,
bool& newID );
void writeWrappedString(const std::string &str)
void writeCharArray(const char *s, unsigned int size)
void setWriteImageHint(WriteImageHint hint)
const std::string & getSchemaName() const
OutputException(const std::vector< std::string > &fields, const std::string &err)
OutputStream & operator<<(const ObjectGLenum &value)
OutputStream & operator<<(const osg::Image *img)
OutputStream & operator<<(const std::string &s)
OutputStream & operator<<(unsigned short s)
OutputStream & operator<<(unsigned long l)
OutputStream & operator<<(unsigned char c)
OutputStream & operator<<(std::ios_base &(*fn)(std::ios_base &))
OutputStream & operator<<(long l)
OutputStream & operator<<(unsigned int i)
OutputStream & operator<<(int i)
OutputStream & operator<<(const osg::Object *obj)
OutputStream & operator<<(const osg::Array *a)
const osgDB::Options * getOptions() const
OutputStream & operator<<(const ObjectProperty &prop)
OutputStream & operator<<(short s)
const std::string & getField() const
OutputStream & operator<<(const ObjectMark &mark)
void throwException(const std::string &msg)
osg::ref_ptr< const osgDB::Options > _options
OutputStream & operator<<(std::ostream &(*fn)(std::ostream &))
const std::string & getError() const
OutputStream & operator<<(const char *s)
OutputStream & operator<<(double d)
OutputStream & operator<<(signed char c)
OutputStream & operator<<(const osg::PrimitiveSet *p)
OutputStream & operator<<(float f)
std::stringstream _compressSource
WriteImageHint _writeImageHint
void setFileVersion(const std::string &d, int v)
osg::ref_ptr< OutputIterator > _out
std::ostream & operator<<(std::ostream &output, const Vec2f &vec)
VersionMap _domainVersionMap
bool _useRobustBinaryFormat
std::map< std::string, int > VersionMap
WriteImageHint getWriteImageHint() const
const OutputException * getException() const
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
SchemaMap _inbuiltSchemaMap
std::vector< std::string > _fields
A plane class. It can be used to represent an infinite plane.
OutputStream & operator<<(bool b)
OutputStream & operator<<(char c)
std::string _compressorName
void setOutputIterator(OutputIterator *oi)
set an output iterator, used directly when not using OutputStream with a traditional file releated st...
#define OPENSCENEGRAPH_SOVERSION
std::map< const osg::Array *, unsigned int > ArrayMap
std::map< std::string, std::string > SchemaMap
osg::ref_ptr< OutputException > _exception
std::map< const osg::Object *, unsigned int > ObjectMap
void writeArray(Output &fw, Iterator first, Iterator last, int noItemsPerLine=0)