54#include <Inventor/misc/SoBasic.h>
55#include <Inventor/SbDict.h>
56#include <Inventor/SbString.h>
57#include <Inventor/SoType.h>
252 size_t fileWrite(
void* buffer,
size_t elemSize,
size_t count );
299 virtual void setBuffer(
void *bufPointer,
size_t initSize,
378 virtual SbBool openFromHandle(UINT hFile);
380 virtual void flushFile();
389 void setStage(Stage stage) { curStage = stage; }
390 Stage getStage()
const {
return curStage; }
394 void incrementIndent(
int amount = 1)
395 { indentLevel += amount; }
396 void decrementIndent(
int amount = 1)
397 { indentLevel -= amount; }
399 int getIndentLevel(){
return indentLevel; }
402 virtual void write(
bool b);
403 virtual void write(
char c);
404 virtual void write(
unsigned char c);
405 virtual void write(
const char *s);
406 virtual void write(
const SbString &s);
407 virtual void write(
const SbName &n);
408 virtual void write(int32_t i);
412 virtual void write(int64_t i);
416 virtual void write(uint32_t i);
420 virtual void write(uint64_t i);
421 virtual void write(
short s);
425 virtual void write(
unsigned short s);
426 virtual void write(
float f);
427 virtual void write(
double d);
428 virtual void writeBinaryArray(
unsigned char *c,
int length);
429 virtual void writeBinaryArray(int32_t *l,
int length);
430 virtual void writeBinaryArray(int64_t *l,
int length);
431 virtual void writeBinaryArray(
float *f,
int length);
432 virtual void writeBinaryArray(
double *d,
int length);
433 virtual void writeBinaryArray(
short *s,
int length);
436 virtual void indent();
440 SbBool isOutFileVRML2() {
return vrmlFileOut;}
441 SbBool isOutFileX3D() {
return x3dFileOut;}
442 SbBool isHeaderWritten() {
return wroteHeader;}
443 void incrementRefOut(
int amount = 1)
444 { refOut += amount; }
445 int getRefOut() {
return refOut;}
449 virtual void writeLargeBinaryArray(
unsigned char *c,
size_t length);
452 virtual void reset();
456 void setCompact(
SbBool flag) { compact = flag; }
457 SbBool isCompact()
const {
return compact; }
465 void setAnnotation(uint32_t bits)
466 { annotation = bits; }
467 uint32_t getAnnotation()
468 {
return (isCompact() ||
isBinary()) ? 0 : annotation; }
473 int findReferenceIfVRML2(
const SoBase *base)
const;
476 int addReferenceIfVRML2(
const SoBase *base);
479 virtual void addToVRML2Dict(
const SbString name,
const SoBase *base);
485 virtual void addToVRMLName(
const SoBase *base,
const char *name);
490 virtual char * findInVRMLName(
const SoBase *base)
const;
493 SbDict *PROTOToWrite;
496 int32_t isWritingBinArrayAsMemObj()
const;
498 SoOutputImpl* m_soOutputImpl;
504 struct SoOutputEntry {
512 float getIVVersion();
552 virtual SbBool setupFileProperties();
555 size_t bytesInBuf()
const
556 {
return (curBuf -
static_cast<char *
>(buffer) ); }
559 SbBool makeRoomInBuf(
size_t nBytes);
562 SbBool makeRoomInTmpBuf(
size_t nBytes);
566 int addReference(
const SoBase *base);
570 int findReference(
const SoBase *base)
const;
573 void convertShort(
short s,
char *to);
574 void convertInt32(int32_t l,
char *to);
575 void convertInt64(int64_t l,
char *to);
576 void convertFloat(
float f,
char *to);
577 void convertDouble(
double d,
char *to);
578 void convertShortArray(
short *from,
char *to,
int len);
579 void convertInt32Array( int32_t *from,
char *to,
int len);
580 void convertInt64Array( int64_t *from,
char *to,
int len);
581 void convertFloatArray(
float *from,
char *to,
int len);
582 void convertDoubleArray(
double *from,
char *to,
int len);
584 const char* getDoublesFormatString()
const;
586 const char* getFloatsFormatString()
const;
594 char m_floatsFmtString[16];
595 char m_doublesFmtString[16];
Character string stored in a hash table.
List of generic (void *) pointers.
Class for smart character strings.
Base class for all nodes, paths, and engines.
Scene graph database class.
Used to write Open Inventor data files.
virtual FILE * getFilePointer() const
Returns the file pointer in use, or NULL if using a buffer.
int filePutc(int)
Write a byte to the currently open file.
static SbString getDefaultASCIIHeader()
Returns the string representing the default ASCII header.
virtual void resetBuffer()
Resets buffer for output again.
size_t fileWrite(void *buffer, size_t elemSize, size_t count)
Write a buffer to the currently open file.
virtual void resetHeaderString()
Resets the header for output files to be the default header.
int filePuts(const char *)
Write a string to the currently open file.
virtual void setHeaderString(const SbString &str)
Sets the header for output files.
virtual SoNONUNICODE SbBool openFile(const char *fileName)
Opens named file, sets current file to result.
virtual void closeFile()
Closes current file if opened with openFile().
virtual void setFilePointer(FILE *newFP)
Sets file pointer to write to.
void * SoOutputReallocCB(void *ptr, size_t newSize)
virtual void setBuffer(void *bufPointer, size_t initSize, SoOutputReallocCB *reallocFunc, int32_t offset=0)
Sets up memory buffer to write to, initial size, reallocation function (which is called if there is n...
virtual ~SoOutput()
Destructor.
virtual size_t getBufferSize() const
The total number of bytes allocated to a memory buffer may be larger than the number of bytes written...
static SbString getDefaultBinaryHeader()
Returns the string representing the default binary header.
virtual SbBool openFile(const SbString &fileName)
Opens named file, sets current file to result.
virtual void setFloatPrecision(int precision)
Sets the precision for writing floating point numbers (type float), i.e. the number of significant di...
virtual SbBool isBinary() const
Returns current state of binary flag.
virtual void setBinary(SbBool flag)
Sets whether output should be ASCII (default) or binary.
virtual void setFileProperty(const FileProperty properties)
Sets a combination of properties for the current file.
FileProperty getFileProperty() const
Returns the current properties used by SoOutput.
virtual SbBool getBuffer(void *&bufPointer, size_t &nBytes) const
Returns memory buffer being written to and the new size of the buffer.
FileProperty
This enum defines the properties used when data are written to a file.
@ DefaultProperty
Regular ascii or binary output.
@ CompressedZlib
Compressed ascii or binary output using the zlib module.
virtual void setDoublePrecision(int precision)
Sets the precision for writing floating point numbers (type double), i.e. the number of significant d...
SbBool isWritingForScaleViz() const
Returns TRUE if ScaleViz is currently writing data for synchronization.
Stores runtime type information.