Debian Codegraph @

lib/database/src/so/fields/SoFieldData.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990,91 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.2 $
44 |
45 | Classes:
46 | SoFieldData
47 |
48 | Author(s) : Paul S. Strauss, Nick Thompson, Gavin Bell
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54 #include <assert.h>
55 #include <cstddef>
56 #include <Inventor/SbString.h>cxx . . $ `<file>/lib/database/include/Inventor/SbString.h`/
57 #include <Inventor/SoInput.h>cxx . . $ `<file>/lib/database/include/Inventor/SoInput.h`/
58 #include <Inventor/SoOutput.h>cxx . . $ `<file>/lib/database/include/Inventor/SoOutput.h`/
59 #include <Inventor/errors/SoDebugError.h>cxx . . $ `<file>/lib/database/include/Inventor/errors/SoDebugError.h`/
60 #include <Inventor/errors/SoReadError.h>cxx . . $ `<file>/lib/database/include/Inventor/errors/SoReadError.h`/
61 #include <Inventor/fields/SoField.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoField.h`/
62 #include <Inventor/fields/SoFieldData.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoFieldData.h`/
63 #include <Inventor/nodes/SoNode.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoNode.h`/
64
65 // Syntax for reading/writing type information to files
66 #define OPEN_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:66:9`! '['
67 #define CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:67:9`! ']'
68 #define VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:68:9`! ','
69
70 // In the binary file format, the number of fields integer is actually
71 // a bitfield containing the number of fields written and whether or
72 // not there is a description of those fields following. This assumes
73 // there are less than 2^14 (16,384) different fields in any node.
74 // We also assume that unsigned shorts have at least 14 bits.
75 #define NOT_BUILTIN_BITcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:75:9`! (1<<14)
76
77 //////////////////////////////////////////////////////////////////////////////
78 //
79 // SoFieldEntry holds the name and offset of a field in an SoFieldData.
80 // SoEnumEntry holds the type name and name/value pairs for an enum type.
81 // These are internal to Inventor. A list of each of these is stored
82 // in the SoFieldData.
83 //
84 //////////////////////////////////////////////////////////////////////////////
85
86 struct SoFieldEntrycxx . . $ SoFieldEntry# {
87 SbNamecxx . . $ SbName# namecxx . . $ SoFieldEntry#name.; // Name of field
88 std::ptrdiff_tcxx . . $ std/ptrdiff_t# offsetcxx . . $ SoFieldEntry#offset.; // Offset of field within object
89 };
90
91 struct SoEnumEntrycxx . . $ SoEnumEntry# {
92 SbNamecxx . . $ SbName# typeNamecxx . . $ SoEnumEntry#typeName.; // Name of enum type
93 int numcxx . . $ SoEnumEntry#num.; // number of values
94 int arraySizecxx . . $ SoEnumEntry#arraySize.; // size of arrays
95 int *valscxx . . $ SoEnumEntry#vals.; // array of values
96 SbNamecxx . . $ SbName# *namescxx . . $ SoEnumEntry#names.; // array of names
97
98 SoEnumEntrycxx . . $ SoEnumEntry#SoEnumEntry(78e67776a82c5be1).(const SbNamecxx . . $ SbName# &name);
99 SoEnumEntrycxx . . $ SoEnumEntry#SoEnumEntry(980cae9462f9feec).(const SoEnumEntrycxx . . $ SoEnumEntry# &o);
100 ~cxx . . $ SoEnumEntry#`~SoEnumEntry`(49f6e7a06ebc5aa8).SoEnumEntrycxx . . $ SoEnumEntry#();
101
102 static int growSizecxx . . $ SoEnumEntry#growSize.; // amount to grow arrays
103 };
104
105 int SoEnumEntrycxx . . $ SoEnumEntry#::growSizecxx . . $ SoEnumEntry#growSize. = 6;
106
107 SoEnumEntrycxx . . $ SoEnumEntry#::SoEnumEntrycxx . . $ SoEnumEntry#SoEnumEntry(78e67776a82c5be1).(const SbNamecxx . . $ SbName# &name)
108 {
109 typeNamecxx . . $ SoEnumEntry#typeName. =cxx . . $ SbName#`operator=`(8da52b6fc1e0f7c6). name;
110 numcxx . . $ SoEnumEntry#num. = 0;
111 arraySizecxx . . $ SoEnumEntry#arraySize. = growSizecxx . . $ SoEnumEntry#growSize.;
112 valscxx . . $ SoEnumEntry#vals. = new int[arraySizecxx . . $ SoEnumEntry#arraySize.];
113 namescxx . . $ SoEnumEntry#names. = new SbNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).[arraySizecxx . . $ SoEnumEntry#arraySize.];
114 }
115
116 SoEnumEntrycxx . . $ SoEnumEntry#::SoEnumEntrycxx . . $ SoEnumEntry#SoEnumEntry(980cae9462f9feec).(const SoEnumEntrycxx . . $ SoEnumEntry# &o)
117 {
118 typeNamecxx . . $ SoEnumEntry#typeName. =cxx . . $ SbName#`operator=`(8da52b6fc1e0f7c6). o.typeNamecxx . . $ SoEnumEntry#typeName.,
119 numcxx . . $ SoEnumEntry#num. = o.numcxx . . $ SoEnumEntry#num.;
120 arraySizecxx . . $ SoEnumEntry#arraySize. = numcxx . . $ SoEnumEntry#num.;
121 valscxx . . $ SoEnumEntry#vals. = new int[arraySizecxx . . $ SoEnumEntry#arraySize.];
122 namescxx . . $ SoEnumEntry#names. = new SbNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).[arraySizecxx . . $ SoEnumEntry#arraySize.];
123 for (int i=0; i<numcxx . . $ SoEnumEntry#num.; i++) {
124 valscxx . . $ SoEnumEntry#vals.[i] = o.valscxx . . $ SoEnumEntry#vals.[i];
125 namescxx . . $ SoEnumEntry#names.[i] =cxx . . $ SbName#`operator=`(8da52b6fc1e0f7c6). o.namescxx . . $ SoEnumEntry#names.[i];
126 }
127 }
128
129 SoEnumEntrycxx . . $ SoEnumEntry#::~cxx . . $ SoEnumEntry#`~SoEnumEntry`(49f6e7a06ebc5aa8).SoEnumEntrycxx . . $ SoEnumEntry#()
130 {
131 delete [] valscxx . . $ SoEnumEntry#vals.;
132 delete [] namescxx . . $ SoEnumEntry#names.;
133 }
134
135 ////////////////////////////////////////////////////////////////////////
136 //
137 // Description:
138 // Copy constructor
139 //
140 // Use: public
141
142 SoFieldDatacxx . . $ SoFieldData#::SoFieldDatacxx . . $ SoFieldData#SoFieldData(4d61452fea82b895).(const SoFieldDatacxx . . $ SoFieldData# &src) :
143 fieldscxx . . $ SoFieldData#fields.(src.fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).())
144 //
145 ////////////////////////////////////////////////////////////////////////
146 {
147 copycxx . . $ SoFieldData#copy(2c1142d05cf29340).(&src);
148 }
149
150
151 ////////////////////////////////////////////////////////////////////////
152 //
153 // Description:
154 // Like a copy constructor, but takes a pointer rather than reference.
155 // The pointer may be NULL.
156 //
157 // Use: public
158
159 SoFieldDatacxx . . $ SoFieldData#::SoFieldDatacxx . . $ SoFieldData#SoFieldData(2c1142d05cf29340).(const SoFieldDatacxx . . $ SoFieldData# *src) :
160 fieldscxx . . $ SoFieldData#fields.(src ? src->fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).() : 0)
161 //
162 ////////////////////////////////////////////////////////////////////////
163 {
164 if (src) copycxx . . $ SoFieldData#copy(2c1142d05cf29340).(src);
165 }
166
167 ////////////////////////////////////////////////////////////////////////
168 //
169 // Description:
170 // Destructor
171 //
172 // Use: public
173
174 SoFieldDatacxx . . $ SoFieldData#::~cxx . . $ SoFieldData#`~SoFieldData`(49f6e7a06ebc5aa8).SoFieldDatacxx . . $ SoFieldData#()
175
176 //
177 ////////////////////////////////////////////////////////////////////////
178 {
179 struct SoFieldEntrycxx . . $ SoFieldEntry# *tmpField;
180 struct SoEnumEntrycxx . . $ SoEnumEntry# *tmpEnum;
181
182 // Delete the list of fields and enums;
183 for (int i=0; i<fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
184 tmpField = (struct SoFieldEntrycxx . . $ SoFieldEntry# *)fieldscxx . . $ SoFieldData#fields.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i];
185 delete tmpField;
186 }
187
188 for (int j=0; j<enumscxx . . $ SoFieldData#enums..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); j++) {
189 tmpEnum = (struct SoEnumEntrycxx . . $ SoEnumEntry# *)enumscxx . . $ SoFieldData#enums.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).j];
190 delete tmpEnum;
191 }
192 }
193
194 ////////////////////////////////////////////////////////////////////////
195 //
196 // Description:
197 // Adds a field to current fieldData.
198 //
199 // Use: public
200
201 void
202 SoFieldDatacxx . . $ SoFieldData#::addFieldcxx . . $ SoFieldData#addField(62ec4b1f920ec561).(SoFieldContainercxx . . $ SoFieldContainer# *defobj, // Object with default values
203 const char *fieldName, // Name of field
204 const SoFieldcxx . . $ SoField# *field) // Pointer 2 field (in defNode)
205 //
206 ////////////////////////////////////////////////////////////////////////
207 {
208 struct SoFieldEntrycxx . . $ SoFieldEntry# *newField = new struct SoFieldEntrycxx . . $ SoFieldEntry#;
209 newField->namecxx . . $ SoFieldEntry#name. =cxx . . $ SbName#`operator=`(8da52b6fc1e0f7c6). fieldNamecxx . . $ SbName#SbName(85c52e162fed56f9).;
210 newField->offsetcxx . . $ SoFieldEntry#offset. = (const char *) field - (const char *) defobj;
211
212 fieldscxx . . $ SoFieldData#fields..appendcxx . . $ SbPList#append(5d22bdacc48458e8).((void *) newField);
213 }
214
215 ////////////////////////////////////////////////////////////////////////
216 //
217 // Description:
218 // Copies values and flags from field data in object to another
219 // object (of the same type, presumably). If copyConnections is
220 // TRUE, any connections to the fields are copied as well.
221 //
222 // Use: public
223
224 void
225 SoFieldDatacxx . . $ SoFieldData#::overlaycxx . . $ SoFieldData#overlay(e90e6198ca06d54b).(SoFieldContainercxx . . $ SoFieldContainer# *to, const SoFieldContainercxx . . $ SoFieldContainer# *from,
226 SbBoolcxx . . $ SbBool# copyConnections) const
227 //
228 ////////////////////////////////////////////////////////////////////////
229 {
230 // Access both field datas instead of just one, in case they
231 // differ per instance.
232 const SoFieldDatacxx . . $ SoFieldData# *fromFD = from->getFieldDatacxx . . $ SoFieldContainer#getFieldData(56e90abbfb485471).();
233 const SoFieldDatacxx . . $ SoFieldData# *toFD = to->getFieldDatacxx . . $ SoFieldContainer#getFieldData(56e90abbfb485471).();
234
235 SoFieldcxx . . $ SoField# *fromField, *toField;
236 int i;
237
238 for (i = 0; i < fromFD->fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
239
240 // Access the fields using the appropriate field data instances
241 toField = toFD->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(to, i);
242 fromField = fromFD->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(from, i);
243
244 // If both fields have default values, we don't bother copying
245 // the value:
246 if (! fromField->isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).() || ! toField->isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).())
247 // This method copies just the value...
248 toField->copyFromcxx . . $ SoField#copyFrom(cf274881b46fe863).(*fromField);
249
250 // ... so we still have to copy the rest
251 toField->setIgnoredcxx . . $ SoField#setIgnored(d4f767463ce0a6b3).(fromField->isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).());
252 toField->setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(fromField->isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).());
253 toField->enableNotifycxx . . $ SoField#enableNotify(7864480464b09eea).(fromField->isNotifyEnabledcxx . . $ SoField#isNotifyEnabled(455f465bc33b4cdf).());
254
255 // Allow the field to fix itself up after the copy. Most
256 // fields do nothing here, but node, path, and engine fields
257 // need to make sure instances are handled properly.
258 toField->fixCopycxx . . $ SoField#fixCopy(d4f767463ce0a6b3).(copyConnections);
259
260 // Copy the connection if necessary
261 if (fromField->isConnectedcxx . . $ SoField#isConnected(455f465bc33b4cdf).() && copyConnections)
262 toField->copyConnectioncxx . . $ SoField#copyConnection(4e16df535ad78f95).(fromField);
263 }
264 }
265
266 ////////////////////////////////////////////////////////////////////////
267 //
268 // Description:
269 // Returns name of field with given index in given object.
270 //
271 // Use: public
272
273 const SbNamecxx . . $ SbName# &
274 SoFieldDatacxx . . $ SoFieldData#::getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(int index) const
275 //
276 ////////////////////////////////////////////////////////////////////////
277 {
278 return ((SoFieldEntrycxx . . $ SoFieldEntry# *) fieldscxx . . $ SoFieldData#fields.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).index])->namecxx . . $ SoFieldEntry#name.;
279 }
280
281 ////////////////////////////////////////////////////////////////////////
282 //
283 // Description:
284 // Returns pointer to field with given index within given node instance.
285 //
286 // Use: public
287
288 SoFieldcxx . . $ SoField# *
289 SoFieldDatacxx . . $ SoFieldData#::getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(const SoFieldContainercxx . . $ SoFieldContainer# *object, int index) const
290 //
291 ////////////////////////////////////////////////////////////////////////
292 {
293 // This generates a CC warning; there's not much we can do about it...
294 return (SoFieldcxx . . $ SoField# *) ((char *) object +
295 ((SoFieldEntrycxx . . $ SoFieldEntry# *) fieldscxx . . $ SoFieldData#fields.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).index])->offsetcxx . . $ SoFieldEntry#offset.);
296 }
297
298 ////////////////////////////////////////////////////////////////////////
299 //
300 // Description:
301 // Returns index of field, given the field and the instance it is in.
302
303 int
304 SoFieldDatacxx . . $ SoFieldData#::getIndexcxx . . $ SoFieldData#getIndex(f7c62f244cc492ca).(const SoFieldContainercxx . . $ SoFieldContainer# *fc, const SoFieldcxx . . $ SoField# *field) const
305 //
306 ////////////////////////////////////////////////////////////////////////
307 {
308 for (int i = 0; i < getNumFieldscxx . . $ SoFieldData#getNumFields(455f465bc33b4cdf).(); i++)
309 if (getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(fc, i) == field)
310 return i;
311
312 #ifdef DEBUG
313 SoDebugError::post("SoFieldData::getIndex", "Can't find index for field");
314 #endif /* DEBUG */
315
316 return -1;
317 }
318
319 /////////////////////////////////////////////////////////////////
320 //
321 // Description:
322 //
323 // Strips leading and trailing white space off a string, returning
324 // an SbName.
325 //
326 // Use: private in this file. Should really be a method of SbName
327 //
328 #include <ctype.h>
329 static SbNamecxx . . $ SbName#
330 stripWhitecxx . . $ stripWhite(fc5685479b3e2be1).(const char *name)
331 //
332 ////////////////////////////////////////////////////////////////////////
333 {
334 int firstchar = -1;
335 int lastchar = -1;
336 int lastwhite = -1;
337
338 // scan string, marking first & last non-white char, and last white
339 int i;
340 for (i=0; name[i]; i++) {
341 if (isspace(name[i]))
342 lastwhite = i;
343 else {
344 if (firstchar == -1) firstchar = i;
345 lastchar = i;
346 }
347 }
348
349 // No trailing whitespace? -- just start at first non-white char
350 if (lastchar > lastwhite)
351 return SbNamecxx . . $ SbName#SbName(78e67776a82c5be1).(&name[firstchar]);
352
353 // trailing whitespace -- need to copy into buffer (to be able
354 // to place trailing NULL-termination, since the the string is const).
355 char buf[500];
356 int b;
357 for (b=0, i=firstchar; i<=lastchar; i++, b++)
358 buf[b] = name[i];
359 buf[b] = 0;
360 return SbNamecxx . . $ SbName#SbName(78e67776a82c5be1).(buf);
361 }
362
363 ////////////////////////////////////////////////////////////////////////
364 //
365 // Description:
366 // Adds an enum value to current fieldData. If the enum type
367 // hasn't been added yet, a new entry is created for it.
368 //
369 // Use: public
370
371 void
372 SoFieldDatacxx . . $ SoFieldData#::addEnumValuecxx . . $ SoFieldData#addEnumValue(5e891a9f77bb0eff).(const char *typeNameArg, const char *valNameArg,
373 int val)
374 //
375 ////////////////////////////////////////////////////////////////////////
376 {
377 struct SoEnumEntrycxx . . $ SoEnumEntry# *e = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
378 SbNamecxx . . $ SbName# typeName = stripWhitecxx . . $ SbName#SbName(78e67776a82c5be1).(typeNameArg);
379 SbNamecxx . . $ SbName# valName = stripWhitecxx . . $ SbName#SbName(78e67776a82c5be1).(valNameArg);
380
381 // look for an entry for this type name
382 for (int i=0; i<enumscxx . . $ SoFieldData#enums..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
383 e = (struct SoEnumEntrycxx . . $ SoEnumEntry# *) enumscxx . . $ SoFieldData#enums.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i];
384 if (e->typeNamecxx . . $ SoEnumEntry#typeName. ==cxx . . $ `operator==`(edde533be586f7a2). typeName)
385 break;
386 else
387 e = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
388 }
389 // make an entry if there wasn't one already
390 if (e == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!) {
391 e = new SoEnumEntrycxx . . $ SoEnumEntry#(typeName);
392 enumscxx . . $ SoFieldData#enums..appendcxx . . $ SbPList#append(5d22bdacc48458e8).((void*) e);
393 }
394 // grow arrays if needed
395 if (e->numcxx . . $ SoEnumEntry#num. == e->arraySizecxx . . $ SoEnumEntry#arraySize.) {
396 e->arraySizecxx . . $ SoEnumEntry#arraySize. += SoEnumEntrycxx . . $ SoEnumEntry#::growSizecxx . . $ SoEnumEntry#growSize.;
397 int *ovals = e->valscxx . . $ SoEnumEntry#vals.;
398 SbNamecxx . . $ SbName# *onames = e->namescxx . . $ SoEnumEntry#names.;
399 e->valscxx . . $ SoEnumEntry#vals. = new int[e->arraySizecxx . . $ SoEnumEntry#arraySize.];
400 e->namescxx . . $ SoEnumEntry#names. = new SbNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).[e->arraySizecxx . . $ SoEnumEntry#arraySize.];
401 for (int i=0; i<e->numcxx . . $ SoEnumEntry#num.; i++) {
402 e->valscxx . . $ SoEnumEntry#vals.[i] = ovals[i];
403 e->namescxx . . $ SoEnumEntry#names.[i] =cxx . . $ SbName#`operator=`(8da52b6fc1e0f7c6). onames[i];
404 }
405 delete [] ovals;
406 delete [] onames;
407 }
408 e->valscxx . . $ SoEnumEntry#vals.[e->numcxx . . $ SoEnumEntry#num.] = val;
409 e->namescxx . . $ SoEnumEntry#names.[e->numcxx . . $ SoEnumEntry#num.] =cxx . . $ SbName#`operator=`(8da52b6fc1e0f7c6). valName;
410 e->numcxx . . $ SoEnumEntry#num.++;
411 }
412
413 ////////////////////////////////////////////////////////////////////////
414 //
415 // Description:
416 // Returns name/value arrays for a given enum type.
417 //
418 // Use: public
419
420 void
421 SoFieldDatacxx . . $ SoFieldData#::getEnumDatacxx . . $ SoFieldData#getEnumData(61eb78ea3f26b859).(const char *typeNameArg, int &num,
422 int *&vals, SbNamecxx . . $ SbName# *&names)
423 //
424 ////////////////////////////////////////////////////////////////////////
425 {
426 SbNamecxx . . $ SbName# typeName = stripWhitecxx . . $ SbName#SbName(78e67776a82c5be1).(typeNameArg);
427
428 // look for an entry for this type name
429 for (int i=0; i<enumscxx . . $ SoFieldData#enums..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
430 struct SoEnumEntrycxx . . $ SoEnumEntry# *e = (struct SoEnumEntrycxx . . $ SoEnumEntry# *) enumscxx . . $ SoFieldData#enums.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i];
431 if (e->typeNamecxx . . $ SoEnumEntry#typeName. ==cxx . . $ `operator==`(edde533be586f7a2). typeName) {
432 num = e->numcxx . . $ SoEnumEntry#num.;
433 vals = e->valscxx . . $ SoEnumEntry#vals.;
434 names = e->namescxx . . $ SoEnumEntry#names.;
435 return;
436 }
437 }
438 // no entry found.
439 num = 0;
440 vals = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
441 names = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!;
442 }
443
444 ////////////////////////////////////////////////////////////////////////
445 //
446 // Description:
447 // Reads field type information for an unrecognized node. The
448 // ASCII syntax is a set of field type - field name pairs,
449 // separated by commas, enclosed withing square brackets. Returns
450 // TRUE on success, FALSE if there is a syntax error or
451 // unrecognized field type.
452 //
453 // numDescriptions is a very large number when reading ASCII (where
454 // we just read until the closing square brace).
455 //
456 // Use: private
457
458 SbBoolcxx . . $ SbBool#
459 SoFieldDatacxx . . $ SoFieldData#::readFieldDescriptionscxx . . $ SoFieldData#readFieldDescriptions(5b8ab2b8545ed703).(
460 SoInputcxx . . $ SoInput# *in, SoFieldContainercxx . . $ SoFieldContainer# *object, int numDescriptions) const
461
462 //
463 ////////////////////////////////////////////////////////////////////////
464 {
465 SbBoolcxx . . $ SbBool# gotChar;
466 SbNamecxx . . $ SbName# fieldTypecxx . . $ SbName#SbName(49f6e7a06ebc5aa8)., fieldNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).;
467 char c;
468
469 SbBoolcxx . . $ SbBool# isBinary = in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).();
470
471 SbBoolcxx . . $ SbBool# hadFieldsDefined = fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).() > 0;
472
473 if (!isBinary)
474 if (! ((gotChar = in->readcxx . . $ SoInput#read(9adc86e50523a208).(c)) || c != OPEN_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:66:9`!))
475 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
476
477 for (int i = 0; i < numDescriptions; i++) {
478
479 // Check for closing brace:
480 if (!isBinary) {
481 // Check for closing brace:
482 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c) && c == CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:67:9`!)
483 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
484 else in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
485 }
486
487 SbNamecxx . . $ SbName# typecxx . . $ SbName#SbName(49f6e7a06ebc5aa8)., fieldNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).;
488 if (!in->readcxx . . $ SoInput#read(9a8a621633966675).(type, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!)) return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
489 if (!in->readcxx . . $ SoInput#read(9a8a621633966675).(fieldName, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!)) return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
490
491 SoTypecxx . . $ SoType# fldType = SoTypecxx . . $ SoType#::fromNamecxx . . $ SoType#fromName(9c5a3237ca15d417).(typecxx . . $ SbName#SbName(78e67776a82c5be1).);
492
493 if (!hadFieldsDefined) {
494 // Only create fields if fields haven't already been
495 // defined. This isn't 100% correct-- we'll create
496 // field for nodes/engines that have not fields if the
497 // user specifies fields/inputs for them. But that's
498 // a case I'm not going to worry about (there are VERY
499 // few nodes that have no fields).
500
501 if (fldType.isBadcxx . . $ SoType#isBad(455f465bc33b4cdf).())
502 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
503
504 // Create and initialize an instance of the field.
505 // Add it to the field data.
506 SoFieldcxx . . $ SoField# *fld = (SoFieldcxx . . $ SoField# *)(fldType.createInstancecxx . . $ SoType#createInstance(45a5c5ac6be858a8).());
507 fld->setContainercxx . . $ SoField#setContainer(1c5659d1d94c054f).(object);
508
509 // Cast const away:
510 SoFieldDatacxx . . $ SoFieldData# *This = (SoFieldDatacxx . . $ SoFieldData# *)this;
511 This->addFieldcxx . . $ SoFieldData#addField(62ec4b1f920ec561).(object, fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).(), fld);
512 }
513 #ifdef DEBUG
514 else {
515 // Check to make sure specification matches reality:
516 SoField *f = object->getField(fieldName);
517 if (f == NULL) {
518 SoDebugError::post("SoFieldData::readFieldDescriptions",
519 "%s does not have a field named %s",
520 object->getTypeId().getName().getString(),
521 fieldName.getString());
522 }
523 else if (!f->isOfType(fldType)) {
524 SoDebugError::postWarning("SoFieldData::readFieldDescriptions",
525 "%s.%s is type %s, NOT type %s",
526 object->getTypeId().getName().getString(),
527 fieldName.getString(),
528 f->getTypeId().getName().getString(),
529 type.getString());
530 }
531 }
532 #endif
533 if (!isBinary) {
534 // Better get a ',' or a ']' at this point:
535 if (! in->readcxx . . $ SoInput#read(9adc86e50523a208).(c))
536 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
537 if (c != VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:68:9`!) {
538 if (c == CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:67:9`!)
539 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
540 else return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
541 }
542 // Got a ',', continue reading
543 }
544 }
545
546 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
547 }
548
549 ////////////////////////////////////////////////////////////////////////
550 //
551 // Description:
552 // Reads into fields of object according to SoInput. The third
553 // parameter indicates whether an unknown field should be reported
554 // as an error (default is TRUE); this can be FALSE for nodes that
555 // have children.
556 //
557 // Use: internal
558
559 SbBoolcxx . . $ SbBool#
560 SoFieldDatacxx . . $ SoFieldData#::readcxx . . $ SoFieldData#read(cc8228a617223129).(SoInputcxx . . $ SoInput# *in, SoFieldContainercxx . . $ SoFieldContainer# *object,
561 SbBoolcxx . . $ SbBool# errorOnUnknownField, SbBoolcxx . . $ SbBool# &notBuiltIn) const
562 //
563 ////////////////////////////////////////////////////////////////////////
564 {
565 // TRUE if reading an Inventor file pre-Inventor 2.1:
566 SbBoolcxx . . $ SbBool# oldFileFormat = (in->getIVVersioncxx . . $ SoInput#getIVVersion(9b8c9e39889c762c).() < 2.1f);
567
568 // TRUE if reading binary file format:
569 SbBoolcxx . . $ SbBool# isBinary = in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).();
570
571 // Assume it is a built-in node, until we figure out otherwise:
572 notBuiltIn = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
573
574 // COMPATIBILITY case:
575
576 if (oldFileFormat && isBinary) {
577
578 // If 2.0 file format, and the thing we're reading
579 // isn't (and, we assume, wasn't) built-in:
580 if (in->getIVVersioncxx . . $ SoInput#getIVVersion(9b8c9e39889c762c).() > 1.0f && !object->getIsBuiltIncxx . . $ SoFieldContainer#getIsBuiltIn(455f465bc33b4cdf).()) {
581 // The "fields" or "inputs" string is read by SoBase,
582 // because it may need them to decide whether or not to
583 // create an UnknownNode or an UnknownEngine.
584 int numDescriptions;
585 if (!in->readcxx . . $ SoInput#read(795be11dee30bb15).(numDescriptions))
586 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
587
588 notBuiltIn = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
589 // The rest of it is just like 2.1 format, IF the object
590 // has any fields:
591 if (!readFieldDescriptionscxx . . $ SoFieldData#readFieldDescriptions(5b8ab2b8545ed703).(in, object, numDescriptions))
592 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
593 }
594 // In the old file format, objects with no fields
595 // didn't write out anything for the field values:
596 if (fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).() == 0) return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
597
598 // This is mostly like Inventor 2.1 file format, except that
599 // there is no NOT_BUILTIN_BIT:
600 int numFieldsWritten;
601 if (!in->readcxx . . $ SoInput#read(795be11dee30bb15).(numFieldsWritten))
602 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
603 return readFieldscxx . . $ SoFieldData#readFields(5b8ab2b8545ed703).(in, object, numFieldsWritten);
604 }
605
606 // BINARY case:
607
608 else if (isBinary) {
609 unsigned short numWritten;
610
611 // First read number of fields written
612 if (! in->readcxx . . $ SoInput#read(d840fb5a7bfc301e).(numWritten))
613 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
614
615 // Figure out if field descriptions were written:
616 if (numWritten & NOT_BUILTIN_BITcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:75:9`!) {
617 notBuiltIn = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
618 numWritten &= (~NOT_BUILTIN_BITcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:75:9`!); // Clear bit
619 }
620
621 if (notBuiltIn) {
622 if (!readFieldDescriptionscxx . . $ SoFieldData#readFieldDescriptions(5b8ab2b8545ed703).(in, object, numWritten))
623 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
624 }
625
626 return readFieldscxx . . $ SoFieldData#readFields(5b8ab2b8545ed703).(in, object, numWritten);
627 }
628
629 // ASCII case:
630 else {
631
632 // Only check for "fields" or "inputs" the first time:
633 SbBoolcxx . . $ SbBool# firstTime = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
634
635 SbNamecxx . . $ SbName# fieldNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).;
636
637 // Keep reading fields until done
638 while (TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) {
639
640 // If no field name, just return.
641 if (!in->readcxx . . $ SoInput#read(9a8a621633966675).(fieldName, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) || !cxx . . $ SbName#`operator!`(455f465bc33b4cdf). fieldName)
642 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
643
644 // Read field descriptions. Field descriptions may be
645 // given for built-in nodes, and do NOT have to be given
646 // for non-built-in nodes as long as their code can be
647 // DSO-loaded.
648 if (firstTime) {
649 firstTime = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
650 if (fieldName ==cxx . . $ `operator==`(1deca42c6f82b65f). "fields" || fieldName ==cxx . . $ `operator==`(1deca42c6f82b65f). "inputs") {
651 notBuiltIn = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
652 if (!readFieldDescriptionscxx . . $ SoFieldData#readFieldDescriptions(5b8ab2b8545ed703).(in, object, NOT_BUILTIN_BITcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:75:9`!))
653 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
654 continue;
655 }
656 }
657
658 SbBoolcxx . . $ SbBool# foundName;
659 if (! readcxx . . $ SoFieldData#read(3c492243a86693d).(in, object, fieldName, foundName))
660 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
661
662 // No match with any valid field name
663 if (!foundName) {
664 if (errorOnUnknownField) {
665 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Unknown field \"%s\"",
666 fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
667 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
668 }
669 else {
670 // Put the field name back in the stream
671 in->putBackcxx . . $ SoInput#putBack(85c52e162fed56f9).(fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
672 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
673 }
674 }
675 }
676 }
677 }
678
679 ////////////////////////////////////////////////////////////////////////
680 //
681 // Used when reading binary file format:
682 //
683 // Use: internal
684
685 SbBoolcxx . . $ SbBool#
686 SoFieldDatacxx . . $ SoFieldData#::readFieldscxx . . $ SoFieldData#readFields(5b8ab2b8545ed703).(SoInputcxx . . $ SoInput# *in, SoFieldContainercxx . . $ SoFieldContainer# *object,
687 int numWritten) const
688 //
689 ////////////////////////////////////////////////////////////////////////
690 {
691 SbNamecxx . . $ SbName# fieldNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).;
692
693 // Read the fields - no tolerance for bad data
694 for (int f = 0; f < numWritten; f++) {
695 if (! in->readcxx . . $ SoInput#read(9a8a621633966675).(fieldName, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) || !cxx . . $ SbName#`operator!`(455f465bc33b4cdf). fieldName)
696 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
697
698 SbBoolcxx . . $ SbBool# foundName;
699 if (! readcxx . . $ SoFieldData#read(3c492243a86693d).(in, object, fieldName, foundName))
700 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
701
702 // No match with any valid field name
703 if (! foundName) {
704 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Unknown field \"%s\"",
705 fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
706 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
707 }
708 }
709 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
710 }
711
712 ////////////////////////////////////////////////////////////////////////
713 //
714 // This function is used when the field name has already been
715 // read, and just the value needs to be read in. It is used by
716 // the above read() method and to read in GlobalFields.
717 //
718 // Use: internal
719
720 SbBoolcxx . . $ SbBool#
721 SoFieldDatacxx . . $ SoFieldData#::readcxx . . $ SoFieldData#read(3c492243a86693d).(SoInputcxx . . $ SoInput# *in, SoFieldContainercxx . . $ SoFieldContainer# *object,
722 const SbNamecxx . . $ SbName# &fieldName, SbBoolcxx . . $ SbBool# &foundName) const
723 //
724 ////////////////////////////////////////////////////////////////////////
725 {
726 int i;
727 for (i = 0; i < fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
728 if (fieldName ==cxx . . $ `operator==`(edde533be586f7a2). getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(i)) {
729 if (! getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(object, i)->readcxx . . $ SoField#read(82f62b5975549baa).(in, fieldName))
730 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
731 break;
732 }
733 }
734 if (i == fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).())
735 foundName = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
736 else foundName = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
737
738 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
739 }
740
741 ////////////////////////////////////////////////////////////////////////
742 //
743 // Description:
744 // Writes all fields. The info in the SoOutput provides more
745 // specifics (file pointer, etc.). This may be called for either of
746 // the 2 stages of writing.
747 //
748 // Use: internal
749
750 void
751 SoFieldDatacxx . . $ SoFieldData#::writecxx . . $ SoFieldData#write(3c9bfc134c31f96e).(SoOutputcxx . . $ SoOutput# *out, const SoFieldContainercxx . . $ SoFieldContainer# *container) const
752 //
753 ////////////////////////////////////////////////////////////////////////
754 {
755 // If in writing stage and writing binary, count number of fields
756 // to write and write it
757 if (out->getStagecxx . . $ SoOutput#getStage(951fc68f69ba3c5a).() == SoOutputcxx . . $ SoOutput#::WRITEcxx . . $ SoOutput#WRITE.) {
758
759 SbBoolcxx . . $ SbBool# isBuiltIn = container->getIsBuiltIncxx . . $ SoFieldContainer#getIsBuiltIn(455f465bc33b4cdf).();
760
761 // In binary, we combine the isBuiltIn flag with the number of
762 // fields we're going to write (which is also the number of
763 // fields we'll describe):
764 if (out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
765 unsigned short numToWrite = 0;
766 for (int i = 0; i < fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
767 SoFieldcxx . . $ SoField# *field = getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(container, i);
768 if (field->shouldWritecxx . . $ SoField#shouldWrite(455f465bc33b4cdf).())
769 numToWrite++;
770 }
771 if (!isBuiltIn)
772 out->writecxx . . $ SoOutput#write(d4f767463ce0a6b3).(numToWrite | NOT_BUILTIN_BITcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:75:9`!);
773 else
774 out->writecxx . . $ SoOutput#write(ed53e3bbd3fa2f69).(numToWrite);
775 }
776 if (!isBuiltIn)
777 writeFieldDescriptionscxx . . $ SoFieldData#writeFieldDescriptions(3c9bfc134c31f96e).(out, container);
778 }
779
780 // Let each field do its thing
781 for (int i = 0; i < fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
782
783 SoFieldcxx . . $ SoField# *field = getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(container, i);
784
785 if (field->shouldWritecxx . . $ SoField#shouldWrite(455f465bc33b4cdf).())
786 field->writecxx . . $ SoField#write(5afc3f6978105403).(out, getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(i));
787 }
788 }
789
790 ////////////////////////////////////////////////////////////////////////
791 //
792 // Write out field descriptions
793 //
794 // Use: internal
795
796 void
797 SoFieldDatacxx . . $ SoFieldData#::writeFieldDescriptionscxx . . $ SoFieldData#writeFieldDescriptions(3c9bfc134c31f96e).(SoOutputcxx . . $ SoOutput# *out,
798 const SoFieldContainercxx . . $ SoFieldContainer# *container) const
799 //
800 ////////////////////////////////////////////////////////////////////////
801 {
802 SbBoolcxx . . $ SbBool# isBinary = out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).();
803
804 if (!isBinary) {
805 out->indentcxx . . $ SoOutput#indent(49f6e7a06ebc5aa8).();
806 if (container->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoNodecxx . . $ SoNode#::getClassTypeIdcxx . . $ SoNode#getClassTypeId(c00c150378d2b968).()))
807 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).("fields");
808 else
809 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).("inputs");
810 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
811 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(OPEN_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:66:9`!);
812 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
813 out->incrementIndentcxx . . $ SoOutput#incrementIndent(d4f767463ce0a6b3).(2);
814 }
815
816 // For each field, write out the field type name and field name.
817 int i = 0;
818 int numWritten = 0;
819 for (i = 0; i < getNumFieldscxx . . $ SoFieldData#getNumFields(455f465bc33b4cdf).(); i++) {
820
821 SoFieldcxx . . $ SoField# *field = getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(container, i);
822
823 // Don't write descriptions of fields that won't be written:
824 if (!field->shouldWritecxx . . $ SoField#shouldWrite(455f465bc33b4cdf).())
825 continue;
826
827 SoTypecxx . . $ SoType# type = field->getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).();
828
829 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(type.getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
830 if (! isBinary)
831 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
832 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(i).getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
833
834 // Format nice and pretty for ascii
835 if (! isBinary) {
836 if (i != getNumFieldscxx . . $ SoFieldData#getNumFields(455f465bc33b4cdf).() - 1) {
837 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:68:9`!);
838 ++numWritten;
839 if ((numWritten%4) == 0) { // 4 pairs per line
840 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).('\n');
841 out->indentcxx . . $ SoOutput#indent(49f6e7a06ebc5aa8).();
842 } else out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
843 }
844 }
845 }
846
847 // Write out the closing brace of the field type information.
848 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
849 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
850 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoFieldData.c++:67:9`!);
851 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).('\n');
852 out->decrementIndentcxx . . $ SoOutput#decrementIndent(d4f767463ce0a6b3).(2);
853 }
854 }
855
856 ////////////////////////////////////////////////////////////////////////
857 //
858 // Description:
859 // Copies all fields from given field data into this one, creating
860 // the new fields. This should be used only for copying fields from
861 // a base class into a derived class, since that's the only
862 // situation in which we are guaranteed that the field offsets are
863 // the same.
864 //
865 // Use: internal
866
867 void
868 SoFieldDatacxx . . $ SoFieldData#::copycxx . . $ SoFieldData#copy(2c1142d05cf29340).(const SoFieldDatacxx . . $ SoFieldData# *from)
869 //
870 ////////////////////////////////////////////////////////////////////////
871 {
872 int i;
873 if (from == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!)
874 return;
875
876 // Copy field entries
877 for (i = 0; i < from->fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
878
879 struct SoFieldEntrycxx . . $ SoFieldEntry# *fromField =
880 (struct SoFieldEntrycxx . . $ SoFieldEntry# *) from->fieldscxx . . $ SoFieldData#fields.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i];
881
882 fieldscxx . . $ SoFieldData#fields..appendcxx . . $ SbPList#append(5d22bdacc48458e8).((void *) new struct SoFieldEntrycxx . . $ SoFieldEntry#(*fromField));
883 }
884
885 // Copy enum entries
886 for (i = 0; i < from->enumscxx . . $ SoFieldData#enums..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
887
888 struct SoEnumEntrycxx . . $ SoEnumEntry# *fromEnum = (struct SoEnumEntrycxx . . $ SoEnumEntry# *) from->enumscxx . . $ SoFieldData#enums.[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i];
889
890 enumscxx . . $ SoFieldData#enums..appendcxx . . $ SbPList#append(5d22bdacc48458e8).((void *) new structcxx . . $ SoEnumEntry#SoEnumEntry(980cae9462f9feec). SoEnumEntrycxx . . $ SoEnumEntry#(*fromEnum));
891 }
892 }
893
894 ////////////////////////////////////////////////////////////////////////
895 //
896 // Description:
897 // Returns TRUE if the values in the fields of one container are
898 // the same as those in another (of the same type, presumably).
899 //
900 // Use: internal
901
902 SbBoolcxx . . $ SbBool#
903 SoFieldDatacxx . . $ SoFieldData#::isSamecxx . . $ SoFieldData#isSame(bc4590f7e5e2748c).(const SoFieldContainercxx . . $ SoFieldContainer# *c1,
904 const SoFieldContainercxx . . $ SoFieldContainer# *c2) const
905 //
906 ////////////////////////////////////////////////////////////////////////
907 {
908 int i;
909
910 for (i = 0; i < fieldscxx . . $ SoFieldData#fields..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++)
911 if (! getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(c1, i)->isSamecxx . . $ SoField#isSame(664178a370b23488).(*getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(c2, i)))
912 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
913
914 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
915 }