SOOUTPUT(3iv)
π SoOutput(3IV) β the write-y one π
okay bestie, so this is SoOutput, and it's the class you use to write Inventor data files. that's the whole vibe. it's from the SoOutput(3IV) manual, and it inherits from... itself?? yeah, SoOutput is listed under INHERITS FROM. iconic of it honestly. no parents, no drama, just main character energy. π
β¨ INHERITS FROM β¨
SoOutput
πΈ SYNOPSIS πΈ
#include <Inventor/SoOutput.h>
typedef void * SoOutputReallocCB(void *ptr, size_t newSize)
Methods from class SoOutput:
SoOutput()
~SoOutput()
void setFilePointer(FILE *newFP)
FILE * getFilePointer() const
SbBool openFile(const char *fileName)
closeFile()
void setBuffer(void *bufPointer, size_t initSize,
SoOutputReallocCB *reallocFunc, int32_t offset = 0)
SbBool getBuffer(void *&bufPointer, size_t &nBytes) const
size_t getBufferSize() const
void resetBuffer()
void setBinary(SbBool flag)
SbBool isBinary() const
void setHeaderString(const SbString &str)
void resetHeaderString()
static SbString getDefaultASCIIHeader()
static SbString getDefaultBinaryHeader()
void setFloatPrecision(int precision)
π¦ DESCRIPTION π¦
so basically, this class is used for writing Inventor data files. that's the job. that's the whole job. π
it supports both ASCII (default) and binary formats β and by default it's giving ASCII, just so you know β and it comes with some convenience functions for handling files, because we love a helper. β¨
it can also write to a buffer in memory as well as to a file pointer. so flexible. so versatile. and you can specify a user-defined header for the output file if you're feeling custom. π
here's the tea: an instance of SoOutput is contained in an SoWriteAction, and ngl that's typically the only instance you need. so like... you probably don't even have to make one yourself?? but you can, and honestly good for you. π
π METHODS π
SoOutput()~SoOutput()
Constructor and destructor, bestie. the default SoOutput writes to stdout β yes, straight to your terminal, no chill. and the destructor? it closes any files opened by the SoOutput, so it cleans up after itself. a class with manners. π«Ά
void setFilePointer(FILE *newFP)β sets the file pointer to write to. that's it, that's the function.FILE *getFilePointer() constβ hands you back the file pointer currently in use, orNULLif it's using a buffer instead. buffer girlies, this one's not for you. πSbBool openFile(const char *fileName)β opens the named file and sets the file pointer to the result. returnsFALSEon error. no cap, that's the whole thing.closeFile()β closes the current file, but only if it was opened withopenFile(). if you didn't open it, it's not gonna touch it. boundaries. periodt. βvoid setBuffer(void *bufPointer, size_t initSize, SoOutputReallocCB *reallocFunc, int32_t offset = 0)β sets up a memory buffer to write to. you pass in the initial size, the reallocation function (which gets called if there's not enough room in the buffer), and the offset in the buffer where writing should begin. heads up though: if the reallocation function returnsNULL, writing will be disabled. so like, don't do that unless you want the silence. πSbBool getBuffer(void *&bufPointer, size_t &nBytes) constβ gives you a pointer to the memory buffer being written to, plus the new size of the buffer. returnsFALSEif it's not writing into a buffer at all. vibe check failed, basically. π₯²size_t getBufferSize() constβ okay so the total number of bytes allocated to a memory buffer may be larger than the number of bytes actually written. this returns that total number. allocated β used, bestie, keep them separate in your head. π§ β¨void resetBuffer()β resets the buffer for output again. output starts over at the beginning of the buffer. fresh start, clean slate, we love a reset. π¦void setBinary(SbBool flag)β sets whether the output should be ASCII (the default) or binary. pick your fighter. πSbBool isBinary() constβ returns the current state of that binary flag. simple. slay.void setHeaderString(const SbString &str)β sets the header for output files. when's this useful? okay so like, if you've got a file format that's a superset of the Inventor file format and you want Inventor to be able to read those files, this is your moment. and it's highly recommend (their words, and honestly fair) that in your new header you just append to the header of the Inventor file format you're extending. for example β if a new file format is based on the Inventor 2.1 file format, you register a header similar to:
#Inventor V2.1 ascii MY FILE FORMAT EXTENSION
and then all Inventor 2.1 applications (and later) can read the file. that's the whole trick. backwards compatibility is the moment. π
void resetHeaderString()β resets the header for output files back to the default header. we're going back to factory settings, no shame in it. πstatic SbString getDefaultASCIIHeader()β returns the string representing the default ASCII header. β¨static SbString getDefaultBinaryHeader()β returns the string representing the default binary header. β¨void setFloatPrecision(int precision)β sets the precision for writing floating point numbers, i.e. the number of significant digits. the numbers get written using%.xgformat, where 'x' is the value of the precision argument. so like, precision = how much of the float you actually get to see. no more, no less. π
π SEE ALSO π
SoInputSoWriteActionSoTranSender
ok that's the whole page, bestie!! go forth and write some files πβ¨
and that's a wrap on SoOutput(3IV) π β this lil group chat was brought to you by the SoOutput(3IV)() source and version, dated however the original dated it, so shoutout to whoever shipped it. mwah. π π¦πΈ
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms