SOINPUT(3iv)

πŸ’– SoInput(3IV) β€” the vibe check πŸ’–

okay bestie, pull up a chair, we're reading SoInput(3IV) together and it's literally the little reader that goes through your Inventor data files. she's from the 3IV manual, she's iconic, she's giving file-parsing main character energy, and by the end of this you're gonna know her like the back of your hand. no cap. ✨


🌸 NAME 🌸

SoInput β€” used to read Inventor data files 🫢


πŸ¦‹ INHERITS FROM πŸ¦‹

SoInput

(yes girl, she's her own ancestor situation, it's fine, we don't question it πŸ’…)


✨ SYNOPSIS ✨

#include <Inventor/SoInput.h>

Methods from class SoInput:

                              SoInput()
                              ~SoInput()
 static void                  addDirectoryFirst(const char *dirName)
 static void                  addDirectoryLast(const char *dirName)
 static void                  addEnvDirectoriesFirst(const char
                                   *envVarName)
 static void                  addEnvDirectoriesLast(const char *envVarName)
 static void                  removeDirectory(const char *dirName)
 static void                  clearDirectories()
 static const SbStringList &  getDirectories()
 void                         setFilePointer(FILE *newFP)
 SbBool                       openFile(const char *fileName, SbBool
                                   okIfNotFound = FALSE)
 SbBool                       pushFile(const char *fileName)
                              closeFile()
 SbBool                       isValidFile()
 FILE *                       getCurFile() const
 const char *                 getCurFileName() const
 void                         setBuffer(void *bufPointer, size_t bufSize)
 SbString                     getHeader()
 float                        getIVVersion()

πŸ‘‘ DESCRIPTION πŸ‘‘

So listen. This class is what the SoDB reading routines use when they're out here reading Inventor data files. She supports both ASCII (that's the default, periodt) and binary Inventor formats. And you can even register extra valid file headers, which is such a slay. 🌈

When she's reading, SoInput skips right over Inventor comments (that's from # all the way to end of line, bye πŸ‘‹) and she can stack input files β€” like a little stack of snacks. And when EOF hits? The stack gets popped. Popped, bestie. πŸ“

She can also read from a buffer in memory. Versatile queen. πŸ’œ


πŸ’… METHODS πŸ’…

  • SoInput()
  • ~SoInput()

Constructor and destructor, the classic duo. The default SoInput reads from stdin. And the destructor closes any files that the SoInput opened β€” she cleans up after herself, we love a responsible icon. 🧚

  • static void addDirectoryFirst(const char *dirName)
  • static void addDirectoryLast(const char *dirName)
  • static void addEnvDirectoriesFirst(const char *envVarName)
  • static void addEnvDirectoriesLast(const char *envVarName)

So the SoInput class keeps a global list of directories that gets searched to find files when opening them. Directories are searched in order, okay, order matters, don't come for her. Each of these routines adds directories to the list, either at the beginning ("First") or at the end ("Last"). The last two routines add directories named in the value of the given environment variable. And inside that variable's value, directories may be separated by colons or whitespace. πŸ’«

  • static void removeDirectory(const char *dirName)

Removes the named directory from the list. Gone. Not invited back. πŸ™ˆ

  • static void clearDirectories()

Clears the list of directories β€” and yes, that includes the current directory too. Full reset, no survivors. πŸ’€

  • static const SbStringList & getDirectories()

Returns the list of directories as an SbStringList. Handing you the whole list, bestie. πŸŽ€

  • void setFilePointer(FILE *newFP)

Sets the file pointer to read from. And if necessary, she clears the stack of input files. Out with the old. ✨

  • SbBool openFile(const char *fileName, SbBool okIfNotFound = FALSE)

Opens the named file and sets the file pointer to the result. Clears the stack of input files if necessary. This returns FALSE on error. And here's the tea: if okIfNotFound is FALSE (which is the default), she prints an error message if the file could not be found. So don't be surprised, okay? 😭

  • SbBool pushFile(const char *fileName)

Opens the named file and pushes the resulting file pointer onto the stack. Returns FALSE on error. Stacked. πŸ“š

  • closeFile()

Closes all files on the stack that were opened with openFile() or pushFile(). Every single one. πŸ’…

  • SbBool isValidFile()

Returns TRUE if the currently open file is a valid Inventor file β€” meaning it begins with a valid Inventor header, or one that's been registered with SoDB::registerHeader. Validation check, we love to see it. πŸ”₯

  • FILE * getCurFile() const

Returns a pointer to the current file, or NULL if she's reading from a buffer. πŸ¦‹

  • const char * getCurFileName() const

Returns the full name (including the directory path) of the current file, or NULL if she's reading from a buffer. Full name, no nicknames. πŸ’–

  • void setBuffer(void *bufPointer, size_t bufSize)

Sets an in-memory buffer to read from, along with its size. Buffer era. 🌸

  • SbString getHeader()

Returns the header of the file being read. The header! πŸ‘‘

  • float getIVVersion()

Returns the Inventor file version of the file being read (e.g. 2.1). And if the file has a header registered through SoDB::registerHeader(), then the returned version is the Inventor version registered with that header. Version check, slay. ⭐


πŸ” SEE ALSO πŸ”

SoDB, SoOutput, SoTranReceiver


and that's the whole page, bestie!! 🫢 this was SoInput(3IV)() from the 3IV manual β€” version and date info live right there in that footer, so consider this your cute little sign-off: SoInput(3IV)(), mwah, go read some Inventor files, you've got this πŸ’–βœ¨πŸŽ€