Debian Codegraph @

doc/man/man3/ivm/general/SoOutput.ivm

raw
1 NAME SoOutput SoOut "" { used to write Inventor data files }
2
3 INCLUDE SoOutput.h
4
5 TYPEDEF "void *" SoOutputReallocCB "(void *ptr, size_t newSize)"
6
7 DESC {
8 This class is used for writing Inventor data files. It supports both
9 ASCII (default) and binary formats and provides some convenience
10 functions for handling files. It can also write to a buffer in memory
11 as well as to a file pointer.
12 A user-defined header can be specified for the output file.
13
14 An instance of \cSoOutput\. is
15 contained in an \cSoWriteAction\.; this is typically the only instance
16 needed.
17 }
18
19 METHOD "" SoOutput() {}
20 METHOD "" ~SoOutput() {
21 Constructor and destructor. The default \cSoOutput\. writes to \xstdout\..
22 The destructor closes any files opened by the \cSoOutput\..
23 }
24
25 METHOD setFilePtr void setFilePointer(FILE *newFP) {
26 Sets file pointer to write to.
27 }
28
29 METHOD getFilePtr FILE * getFilePointer() const {
30 Returns the file pointer in use, or NULL if using a buffer.
31 }
32
33 METHOD "" SbBool openFile(const char *fileName) {
34 Opens named file, sets file pointer to result. This returns FALSE on error.
35 }
36
37 METHOD "" closeFile() {
38 Closes current file if opened with
39 \+\mopenFile()\..\.
40 \-\mSoOutOpenFile()\..\.
41 }
42
43 METHOD setBuf void setBuffer(void *bufPointer, size_t initSize,
44 SoOutputReallocCB *reallocFunc, int32_t offset = 0) {
45 Sets up memory buffer to write to, initial size, reallocation function
46 (which is called if there is not enough room in the buffer), and
47 offset in the buffer at which to begin writing. If the reallocation
48 function returns NULL, writing will be disabled.
49 }
50
51 METHOD getBuf SbBool getBuffer(void *&bufPointer, size_t &nBytes) const {
52 Returns pointer to memory buffer being written to and the new size of
53 the buffer. Returns FALSE if not writing into a buffer.
54 }
55
56 METHOD "" size_t getBufferSize() const {
57 The total number of bytes allocated to a memory buffer may be larger
58 than the number of bytes written. This returns that total number.
59 }
60
61 METHOD "" void resetBuffer() {
62 Resets buffer for output again. Output starts over at beginning of buffer.
63 }
64
65 METHOD setBin void setBinary(SbBool flag) {
66 Sets whether output should be ASCII (default) or binary.
67 }
68
69 METHOD isBin SbBool isBinary() const {
70 Returns current state of binary flag.
71 }
72
73 METHOD setHdrStr void setHeaderString(const SbString &str) {
74 Sets the header for output files.
75 This is useful, for example, if you have a file format that is
76 a superset of the Inventor file format and you want Inventor
77 to read the files. It is highly recommend that in your new
78 header you simply append to the header of the Inventor
79 file format you are extending.
80 For example, if a new file format is based on the Inventor 2.1
81 file format, register a header similar to:
82 \k"#Inventor V2.1 ascii MY FILE FORMAT EXTENSION"\.
83 Then all Inventor 2.1 applications (and later) can read the file.
84 }
85
86 METHOD resetHdrStr void resetHeaderString() {
87 Resets the header for output files to be the default header.
88 }
89
90 METHOD getDfltASCIIHdr static SbString getDefaultASCIIHeader() {
91 Returns the string representing the default ASCII header.
92 }
93
94 METHOD getDfltBinHdr static SbString getDefaultBinaryHeader() {
95 Returns the string representing the default binary header.
96 }
97
98 METHOD setFltPrcsn void setFloatPrecision(int precision) {
99 Sets the precision for writing floating point numbers, i.e.
100 the number of significant digits. Floating point numbers
101 are written using %.xg format, where 'x' is the value of
102 the precision argument.
103 }
104
105 ALSO { SoInput, SoWriteAction, SoTranSender }
106