Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoInput.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2022 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_INPUT_
51#define _SO_INPUT_
52
53#include <Inventor/misc/SoBasic.h>
54#include <Inventor/SbDict.h>
55#include <Inventor/SbPList.h>
56#include <Inventor/SbString.h>
57#include <Inventor/SoDB.h>
58#include <Inventor/threads/SbThreadMutex.h>
59#include <Inventor/threads/SbThreadSpinlock.h>
60
61#include <Inventor/STL/fstream>
62#include <Inventor/STL/iostream>
63#include <Inventor/STL/list>
64#include <Inventor/STL/vector>
65#include <Inventor/STL/map>
66
67#if defined(_WIN32)
68#pragma warning( push )
69#pragma warning( disable: 4251 ) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
70#endif
71
72
73class SoNode;
74class SoPath;
75class SoBase;
76class SoDB;
77class SbStringList;
78class SoInputImpl;
79class SoStreamBuffer;
80class SbThreadSignal;
82
83#ifndef HIDDEN_FROM_DOC
85//
86// Structure: SoInputFile (internal)
87//
88// This structure holds info about an opened file for use in the SoInput
89// class.
90//
91// One of the items is a dictionary that correlates reference names
92// in files to nodes and paths (SoBase instances).
93//
95
96
97{
98 // Name of file
99 SbString name;
100 // Name of file with full path
101 SbString fullName;
102 // File pointer
103 FILE *fp;
104 // ZCompressed file pointer
105 void* zFp;
106 // Buffer to read from (or NULL)
107 void *buffer;
108 // TRUE if buffer is created internally
109 SbBool bufferOwnership;
110 // Current location in buffer
111 char *curBuf;
112 // Buffer size
113 size_t bufSize;
114 // Number of line currently reading
115 int lineNum;
116 // TRUE if opened by SoInput
117 SbBool openedHere;
118#ifdef _WIN32
119 // TRUE if opened from handle
120 SbBool openedFromHandle;
121#endif
122 // TRUE if file has binary data
123 SbBool binary;
124 // TRUE if file uses UTF8 incoding
125 SbBool utf8;
126 // True if file is compressed using zlib
127 SbBool zCompressed;
128 // TRUE if current platform endianness is big endian
129 SbBool isBigEndian;
130 // TRUE if the file is streamed
131 SbBool isStreamed;
132 // Number of buffers used for the streaming process
133 int streamedBuffersNumber;
134 // Size of a streamBuffer;
135 int streamedBuffersSize;
136 // Size of the file in bytes
137 long long fileSize;
138 // TRUE if header was checked for A/B
139 SbBool readHeader;
140 // TRUE if header was read ok
141 bool headerOk;
142 // Node/path reference dictionary
143 SbDict *refDict;
144 // TRUE if dict from another SoInput
145 SbBool borrowedDict;
146 // Version if standard Inventor file;
147 float ivVersion;
148 // The header string of the input file
149 SbString headerString;
150 // CB to be called after reading file
151 SoDBHeaderCB *postReadCB;
152 // User data to pass to the postReadCB
153 void *CBData;
154 // Too complex for inlining
155 SoInputFile();
156};
157
158
159{
160};
161
162#endif // HIDDEN_FROM_DOC
163
165//
166// Class: SoInput
167//
168// This file contains the definition of the SoInput (input stream)
169// class. This class is used for reading Inventor data files; it
170// supports both ASCII (default) and binary formats. It skips over
171// Inventor comments (from '#' to end of line) and can stack input
172// files when file inclusion is encountered; when EOF is reached, the
173// stack is popped. Both the ASCII and binary formats can be compressed
174// using the gz format (e.g: Using gzip). The file extension for compressed files is 'ivz' but it's
175// not mandatory, the gz header is checked when the file is opened in order
176// to figure out if it is compressed or not. This feature uses the module IvDLZlib.
177//
178// Another feature is file opening. This will open a named file,
179// looking for it in any of several user-specified directories.
180// Alternatively, the caller can specify a buffer in memory (and its
181// size) to read from. The specified filenames can contain variables
182// which are replaced by SoInput using SoPreferences. The variables must
183// follow the usual $name format. (e.g: $OIVHOME).
184//
185//
186// SoInput also contains a dictionary that correlates node and path
187// pointers to temporary names written to files. This is so
188// references to previously defined nodes and paths are written
189// correctly.
190//
192
363{
364
365 public:
366
371
375 virtual ~SoInput();
376
384 SoNONUNICODE static void addDirectoryFirst(const char *dirName);
385
386
392 static void addDirectoryFirst( const SbString& dirName );
393
401 SoNONUNICODE static void addDirectoryLast(const char *dirName);
402
408 static void addDirectoryLast( const SbString& dirName );
409
410#define DIRECTORIES_SEPARATOR ":;"
432 SoNONUNICODE static void addEnvDirectoriesFirst(const char *envVarName,
433 const char *dirSep = DIRECTORIES_SEPARATOR);
434
448 static void addEnvDirectoriesFirst(const SbString& envVarName,
449 const SbString& dirSep = DIRECTORIES_SEPARATOR);
450
466 SoNONUNICODE static void addEnvDirectoriesLast(const char *envVarName,
467 const char *dirSep = DIRECTORIES_SEPARATOR);
468
482 static void addEnvDirectoriesLast(const SbString& envVarName,
483 const SbString& dirSep = DIRECTORIES_SEPARATOR);
484
490 SoNONUNICODE static void removeDirectory(const char *dirName);
491
495 static void removeDirectory( const SbString& dirName );
496
500 static void clearDirectories();
501
507
508
513 virtual void setFilePointer(FILE *newFP);
514
519 virtual FILE* getFilePointer();
520
539 SoNONUNICODE virtual SbBool openFile(const char *fileName, SbBool okIfNotFound = FALSE, SbBool aSync = FALSE);
540
556 virtual SbBool openFile( const SbString& fileName, SbBool okIfNotFound = FALSE, SbBool aSync = FALSE);
557
571 SoNONUNICODE virtual SbBool pushFile(const char *fileName);
572
584 virtual SbBool pushFile( const SbString& fileName );
585
589 virtual void closeFile();
590
599
608
614 virtual FILE *getCurFile() const;
615
622 SoNONUNICODE virtual const char *getCurFileName() const;
623
630
635 virtual void setBuffer(void *buffer, size_t bufSize);
636
640 virtual int getNumBytesRead() const;
641
648
655 virtual float getIVVersion() { return curFile->ivVersion; }
656
661 virtual void updateReadPercent( double readPercentage );
662
670 static SbBool findAbsolutePath( const SbString& fileName, SbString &fullName );
671
672
679
684
685private:
686
687 // Returns whether current file/buffer being read is binary
688 virtual SbBool isBinary();
689
690 // Returns whether current file/buffer being read uses utf8 encoding
691 virtual SbBool isUtf8();
692
693 // Returns whether current file/buffer is compressed using ZLIB
694 virtual SbBool isZCompressed();
695
696 // Reads next character from current file/buffer. Returns FALSE on
697 // EOF or error.
698 virtual SbBool get(char &c);
699
700 // Reads next ASCII character from current buffer. Returns FALSE on
701 // EOF or error.
702 virtual SbBool getASCIIBuffer(char &c);
703
704 // Reads next ASCII character from current file. Returns FALSE on
705 // EOF or error.
706 virtual SbBool getASCIIFile(char &c);
707
708 // Reads item of particular type from current file pointer/buffer. All
709 // skip white space before reading and return FALSE on EOF or if
710 // item could not be read.
711 virtual SbBool read(char &c);
712 virtual SbBool readByte(char &c);
713 virtual SbBool readByte(unsigned char &c);
714 virtual SbBool read(SbString &s);
715 virtual SbBool read(SbName &n, SbBool validIdent = FALSE);
716 virtual SbBool readBitMask(SbName &n, SbBool validIdent = FALSE);
717 virtual SbBool read(bool &i);
718 virtual SbBool read(int32_t &i);
719 virtual SbBool read(int64_t &i);
720 virtual SbBool read(uint32_t &i);
721 virtual SbBool read(uint64_t &i);
722 virtual SbBool read(short &s);
723 virtual SbBool read(unsigned short &s);
724 virtual SbBool read(float &f);
725 virtual SbBool read(double &d);
726 virtual SbBool readBinaryArray(unsigned char *c, int length);
727 virtual SbBool readBinaryArray(int32_t *l, int length);
728 virtual SbBool readBinaryArray(int64_t *l, int length);
729 virtual SbBool readBinaryArray(float *f, int length);
730 virtual SbBool readBinaryArray(short *s, int length);
731 virtual SbBool readBinaryArray(double *d, int length);
732
733 // Returns TRUE if current file/buffer is at EOF
734 virtual SbBool eof() const;
735
736 // This read does not skip whiteSpace. It's used to read a PROTO into
737 // the buffer. The second argument is just to differentiate the two
738 // character reads.
739 virtual SbBool read(char &c, SbBool skip);
740
741 // Returns TRUE if current header is VRML V2.0
742 SbBool isFileVRML2();
743
744 // Sets the vrmlFile flag. This is necessary for
745 // SoFieldData::readFieldDescriptions for UnKnownNodes to temporarily i
746 // turn off the flag so Inventor extension nodes field descriptions will
747 // read in correctly. They assume that the comma is between the fields
748 // but in VRML2, commas are whitespace.
749 void setFileVRML2(SbBool flag);
750
751 // Returns 0 for Inventor, 2 for VRML2.0 and 3 for VRML 3.0
752 int getVRMLVersion() { return vrmlFile; }
753
754 // Sets the vrmlFile flag. This is necessary for
755 // SoFieldData::readFieldDescriptions for UnKnownNodes to temporarily i
756 // turn off the flag so Inventor extension nodes field descriptions will
757 // read in correctly. They assume that the comma is between the fields
758 // but in VRML2, commas are whitespace.
759 void setVRMLVersion(int flag) { vrmlFile = flag; }
760
761#ifdef _WIN32
762 // Returns the file name from its handle.
763 SbString getFileNameFromHandle( HANDLE hFile ) const;
764
765 virtual SbBool openFromHandle( UINT hFile, SbBool okIfNotFound = FALSE, SbBool aSync = FALSE );
766#endif
767
768 private:
769
770 // Init function sets up global directory list
771 static void init();
772 static void finish();
773
774 // Constructor that gets reference dictionary from another SoInput
775 SoInput(SoInput *dictIn);
776
777 // Fills in passed string to contain description of current
778 // location in all open input files
779 virtual void getLocationString(SbString &string) const;
780
781 // Puts a just-read character or string back in input stream/buffer
782 virtual void putBack(char c);
783 virtual void putBack(const char *string);
784
785 // Adds a reference to dictionary in current file. This may also
786 // add a reference to the global dictionary if addToGlobalDict is
787 // TRUE (the default).
788 virtual void addReference(const SbName &name, SoBase *base,
789 SbBool addToGlobalDict = TRUE);
790
791 // Removes a reference to dictionary in current file. This may
792 // also remove a reference from the global dictionary.
793 virtual void removeReference(const SbName &name);
794
795 // Looks up a reference, returning the base pointer or NULL
796 virtual SoBase * findReference(const SbName &name) const;
797
798 virtual void resetFilePointer(FILE *fptr) { curFile->fp = fptr;}
799
800 virtual SbBool readLargeBinaryArray(unsigned char *c, size_t length);
801
802 SoInputImpl* m_soInputImpl;
803
804 // find absolute path of a file return TRUE if found
805 // and the absolute found path in fullName
806 //
807 // @UNICODE_WARNING
808 //
809 SoNONUNICODE static SbBool findAbsolutePath( const char* fileName, const SbStringList *some_dir, SbString &fullName );
810
811
812 // find absolute path of a file return TRUE if found
813 // and the absolute found path in fullName
814 //
815 static SbBool findAbsolutePath( const SbString& fileName, const SbStringList *some_dir, SbString &fullName );
816
817 int32_t isReadingBinArrayAsMemObj() const;
818
819 // Adds/subtracts the new value to/from the number of read bytes. Useful when an fseek is done on the
820 // currently opened file in order to keep m_numReadBytes up to date (i.e. reading PROTO of vrml files).
821 void updateNumReadBytes( int value);
822
823 // Set the Inventor version number of the current file
824 void setIVVersion(float version) { curFile->ivVersion = version; }
825 bool isHeaderOk() { return curFile->headerOk; }
826
827 void seekCurBuf( size_t size ) { curFile->curBuf += size; updateNumReadBytes(static_cast<int>(size) ); }
828
841 static bool readTextFile(const SbString& filename, SbString& dest);
842
851 static bool addInMemoryTextFile(const SbString& filename, const SbString& fileContent);
852
859 static bool removeInMemoryTextFile(const SbString& filename);
860
865 static bool isInMemoryTextFile(const SbString& filename);
866
870 long fileTell();
871
876 int fileSeek( long offset, int whence );
877
879 bool isReadByPlugin();
880
881 SbBool isReadingHeader();
882
883 private:
884
885 // Directory search path.
886 static void setDirectories(SbStringList *dir);
887 // Stack of SoInputFiles (depth >=1)
888 SbPList files;
889 // Top of stack
890 struct SoInputFile *curFile;
891 // For strings that are put back
892 SbString backBuf;
893 // Index into backBuf (-1 if no buf)
894 int backBufIndex;
895
896 // Buffer for binary read from file
897 void *tmpBuffer;
898 // Current location in temporary buffer
899 char *curTmpBuf;
900 // Size of temporary buffer
901 size_t tmpBufSize;
902
903 // Buffer for storing data that
904 // has been read but can't be put back.
905 char backupBuf[8];
906 // True if backupBuf contains data
907 SbBool backupBufUsed;
908 // Contains char that were put back in the stream in ascii mode.
909 std::vector<char> putBackCharBuffer;
910
911 // Looks for named file and opens it. Returns NULL if not found.
912 FILE *findFile(const SbString& fileName, SbString &fullName);
913
914 // Initializes reading from file
915 void initFile(FILE *newFP, const SbString& fileName,
916 SbString *fullName, SbBool openedHere,
917 SbDict *refDict = NULL);
918
919 // Initializes streamed reading from file
920 void initStreamedFile( FILE* newFP, const SbString& fileName, SbString* fullName, SbBool openedHere,
921 SbDict* refDict = NULL );
922
923#ifdef _WIN32
924 FILE *findFromHandle(int nHandle) const;
925
926 void initFromHandle(FILE *newFP,
927 int nHandle, SbBool openedHere,
928 SbDict *refDict = NULL);
929#endif
930
931 // Checks current Inventor/VRML file for ASCII/binary header comment.
932 // Returns FALSE if no header was found.
933 SbBool checkInventorHeader(SbBool bValidateBufferHeader=FALSE);
934
935 // Checks current file for ASCII/binary header comment. Returns
936 // FALSE if no header was found.
937 SbBool checkHeader(SbBool bValidateBufferHeader=FALSE);
938
939 // Returns TRUE if reading from memory buffer rather than file
940 SbBool fromBuffer() const { return (curFile->buffer != NULL); }
941
942 // Skips over white space in input. Pops file if EOF is hit.
943 // Returns FALSE on error.
944 SbBool skipWhiteSpace();
945
946 // Pops current file from stack, if possible.
947 SbBool popFile();
948
949 // Returns number of bytes left in current buffer
950 size_t freeBytesInBuf() const
951 { return (curFile->bufSize - (curFile->curBuf - static_cast<char *>(curFile->buffer) )); }
952
953 // Reads integer, unsigned integer, or floating-point number.
954 // Returns FALSE on EOF or error
955 SbBool readInteger(int32_t &l);
956 SbBool readUnsignedInteger(uint32_t &l);
957 SbBool readInteger(int64_t &l);
958 SbBool readUnsignedInteger(uint64_t &l);
959 SbBool readReal(double &d);
960
961 // Reads next ASCII format hex value from current file/buffer.
962 // Returns FALSE on EOF or error.
963 virtual SbBool readHex(uint32_t &l);
964
965 // Reads unsigned integer string into str. Accepts decimal, octal,
966 // and hex integers. Returns FALSE on EOF or error
967 SbBool readUnsignedIntegerString(char *str);
968
969 // Reads string of decimal or hexadecimal digits into string.
970 // Returns number of bytes read.
971 int readDigits(char *string);
972 int readHexDigits(char *string);
973
974 // Reads given character from buffer into string. Returns 0 or 1
975 int readChar(char *string, char charToRead);
976
977 // Make room in the temporary buffer for reading from a binary file
978 SbBool makeRoomInBuf(size_t nBytes);
979
980 // Convert datatypes to network format during writing
981 void convertShort(char *from, short *s);
982 void convertInt32(char *from, int32_t *l);
983 void convertInt64(char *from, int64_t *l);
984 void convertFloat(char *from, float *f);
985 void convertDouble(char *from, double *d);
986 void convertShortArray(char *from, short *to, size_t len);
987 void convertInt32Array(char *from, int32_t *to, size_t len);
988 void convertInt64Array(char *from, int64_t *to, size_t len);
989 void convertFloatArray(char *from, float *to, size_t len);
990 void convertDoubleArray(char *from, double *to, size_t len);
991
992 SbString bufferToString( const char* buffer );
993
999 size_t fileRead( void* ptr, size_t size, size_t count );
1000
1004 int fileReadByte();
1005
1006 static SbBool checkFileCompression( FILE* file, int64_t& fileSize, SbBool& isCompressed );
1007 static SbBool checkFileCompression( unsigned char byte1, unsigned char byte2 );
1008
1009 // deprecated
1010 void convertShortArray(char *from, short *to, int len);
1011 void convertInt32Array(char *from, int32_t *to, int len);
1012 void convertFloatArray(char *from, float *to, int len);
1013 void convertDoubleArray(char *from, double *to, int len);
1014
1015 int vrmlFile;
1016
1017// friend class SoBase;
1018// friend class SoDB;
1019
1020 private:
1021
1022 SoInputParameters* m_inputParameters;
1023
1024 // Directory search path.
1025 static SbStringList *directories;
1026 static SbString *defaultString;
1027
1028 // Callback put in a thread to fill-in the stack of streamed buffers.
1029 static void* streamingStackCB( void* data );
1030
1031 void commonInit();
1032
1033 // Method called when the current streamed buffer is read and needed to be swapped
1034 void swapStreamBuffer();
1035 // Methods called for binary files when there's not enough available space in the buffer to read the type
1036 char* getType( char* from, size_t sizeOfType, size_t freeBytes );
1037 char* getLongType( char* from, size_t sizeOfType, size_t freeBytes );
1038
1039 static std::list<SoStreamBuffer*>* m_streamBufStack; // Streamed buffers stack
1040 // Synchronization between app thread and streaming thread
1041 static SbThreadSignal* m_availableSig; // Used to signal the app thread that a buffer has been pushed in the stack
1042 static SbThreadMutex* m_availableSigMutex;
1043 static SbThreadSignal* m_stackFillSig; // Used to signal the callback thread that a buffer has been popped out of the stack
1044 static SbThreadMutex* m_stackFillSigMutex;
1045 static SbThreadMutex* m_stackMutex; // Used when accessing in the stack.
1046 static SbThreadMutex m_directoriesMutex; // Used when accessing in the directories list.
1047 SbThread* m_stackThread;
1048
1049 int64_t m_numReadBytes;
1050
1051 // Progress bar for debug purposes only!
1052 int m_percent, m_progress, m_prevProgressVal, m_prevPercentVal;
1053 double m_result;
1054 std::string m_progressBar;
1055
1056 // manage in memory text file for readTextFile method (filename,fileContent)
1057 typedef std::map<SbString, SbString> InMemoryTextFileMap;
1058 static InMemoryTextFileMap s_InMemoryTextFileMap;
1059 static SbThreadSpinlock s_InMemoryTextFileMapMutex;
1060 static SbBool s_InMemoryTextFileEnabled;
1061
1062 // manage zlib buffer uncompressing
1063 SbBool uncompressZData(const void *src, size_t srcLen, void*& dst, size_t& dstLen);
1064 int inflateZData(const void *src, size_t srcLen, void *dst, size_t dstLen);
1065
1066};
1067
1068#if defined(_WIN32)
1069#pragma warning( pop )
1070#endif
1071
1072#endif /* _SO_INPUT_ */
1073
Character string stored in a hash table.
Definition SbName.h:162
List of generic (void *) pointers.
Definition SbPList.h:77
Class for smart character strings.
Definition SbString.h:202
Maintains a list of pointers to SbString instances.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable thread ...
Definition SbThread.h:65
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable signal ...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable spinloc...
Base class for all nodes, paths, and engines.
Definition SoBase.h:111
Scene graph database class.
Definition SoDB.h:222
Used to read Open Inventor data files.
Definition SoInput.h:363
SoInput()
Constructor.
SoInputParameters * getInputParameters() const
Return the current SoInputParameters.
virtual SbString getHeader()
Returns the header of the file being read.
virtual SbBool openFile(const SbString &fileName, SbBool okIfNotFound=FALSE, SbBool aSync=FALSE)
Opens named file, sets file pointer to result.
virtual void setFilePointer(FILE *newFP)
Sets file pointer to read from.
virtual int getNumBytesRead() const
Returns the number of bytes read.
virtual FILE * getFilePointer()
Gets the file pointer read.
virtual SbBool isValidBuffer()
Returns TRUE if the current buffer is valid.
virtual SoNONUNICODE SbBool openFile(const char *fileName, SbBool okIfNotFound=FALSE, SbBool aSync=FALSE)
Opens named file, sets file pointer to result.
virtual SoNONUNICODE const char * getCurFileName() const
Returns full name (including directory path) of current file.
static void removeDirectory(const SbString &dirName)
Removes named directory from the list.
static void addDirectoryFirst(const SbString &dirName)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
static SoNONUNICODE void addEnvDirectoriesFirst(const char *envVarName, const char *dirSep=DIRECTORIES_SEPARATOR)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
virtual SbBool isValidFile()
Returns TRUE if the currently open file is a valid Open Inventor file.
static void addEnvDirectoriesFirst(const SbString &envVarName, const SbString &dirSep=DIRECTORIES_SEPARATOR)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
void setInputParameters(SoInputParameters *parameters)
Specify parameters to modify/control actions during the read of a file.
static SbBool findAbsolutePath(const SbString &fileName, SbString &fullName)
Returns absolute path of given file by looking in SoInput standard directories.
static void addEnvDirectoriesLast(const SbString &envVarName, const SbString &dirSep=DIRECTORIES_SEPARATOR)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
static SoNONUNICODE void removeDirectory(const char *dirName)
Removes named directory from the list.
virtual void closeFile()
Closes all files on stack opened with openFile() or pushFile().
virtual SbString getCurStringFileName() const
Returns full name (including directory path) of current file.
virtual float getIVVersion()
Returns the Open Inventor file version of the file being read (2.1).
Definition SoInput.h:655
virtual SoNONUNICODE SbBool pushFile(const char *fileName)
Opens named file, pushing the resulting file pointer onto the stack.
virtual void setBuffer(void *buffer, size_t bufSize)
Sets an in-memory buffer to read from, along with its size.
static const SbStringList & getDirectories()
Returns the list of directories as an SbStringList.
static void clearDirectories()
Clears the list of directories (including the current directory).
virtual void updateReadPercent(double readPercentage)
Reports the percentage of bytes read from the file.
virtual ~SoInput()
The destructor closes any files opened by the SoInput.
static SoNONUNICODE void addDirectoryLast(const char *dirName)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
static SoNONUNICODE void addDirectoryFirst(const char *dirName)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
static void addDirectoryLast(const SbString &dirName)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
virtual FILE * getCurFile() const
Returns the current file.
static SoNONUNICODE void addEnvDirectoriesLast(const char *envVarName, const char *dirSep=DIRECTORIES_SEPARATOR)
The SoInput class maintains a global list of directories that is searched to find files when opening ...
virtual SbBool pushFile(const SbString &fileName)
Opens named file, pushing the resulting file pointer onto the stack.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base class for f...
Abstract base class for all database nodes.
Definition SoNode.h:145
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
int SbBool
Boolean type.
Definition SbBase.h:87