Debian Codegraph @

lib/database/src/so/fields/SoField.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,92 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.3 $
44 |
45 | Classes:
46 | SoField
47 | SoSField
48 | SoMField
49 |
50 | Author(s) : Paul S. Strauss, Nick Thompson
51 |
52 ______________ S I L I C O N G R A P H I C S I N C . ____________
53 _______________________________________________________________________
54 */
55
56
57 #include <Inventor/SoDB.h>cxx . . $ `<file>/lib/database/include/Inventor/SoDB.h`/
58 #include <Inventor/SoInput.h>cxx . . $ `<file>/lib/database/include/Inventor/SoInput.h`/
59 #include <Inventor/misc/SoNotification.h>cxx . . $ `<file>/lib/database/include/Inventor/misc/SoNotification.h`/
60 #include <Inventor/SoOutput.h>cxx . . $ `<file>/lib/database/include/Inventor/SoOutput.h`/
61 #include <Inventor/actions/SoWriteAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoWriteAction.h`/
62 #include <Inventor/engines/SoEngine.h>cxx . . $ `<file>/lib/database/include/Inventor/engines/SoEngine.h`/
63 #include <Inventor/engines/SoFieldConverter.h>cxx . . $ `<file>/lib/database/include/Inventor/engines/SoFieldConverter.h`/
64 #include <Inventor/errors/SoDebugError.h>cxx . . $ `<file>/lib/database/include/Inventor/errors/SoDebugError.h`/
65 #include <Inventor/errors/SoReadError.h>cxx . . $ `<file>/lib/database/include/Inventor/errors/SoReadError.h`/
66 #include <Inventor/fields/SoFieldContainer.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoFieldContainer.h`/
67 #include <Inventor/fields/SoSubField.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoSubField.h`/
68 #include <Inventor/nodes/SoNode.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoNode.h`/
69 #include <Inventor/sensors/SoDataSensor.h>cxx . . $ `<file>/lib/database/include/Inventor/sensors/SoDataSensor.h`/
70 #include <cstdlib>
71 #include "SoGlobalField.h"cxx . . $ `<file>/lib/database/src/so/fields/SoGlobalField.h`/
72
73 // Special characters in files
74 #define OPEN_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:74:9`! '['
75 #define CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:75:9`! ']'
76 #define VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:76:9`! ','
77 #define IGNORE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:77:9`! '~'
78 #define CONNECTION_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:78:9`! '='
79 #define FIELD_SEP_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:79:9`! '.'
80
81 // Bit flags in flags token in binary files
82 #define FIELD_IGNOREDcxx . . $ `lib/database/src/so/fields/SoField.c++:82:9`! 0x01
83 #define FIELD_CONNECTEDcxx . . $ `lib/database/src/so/fields/SoField.c++:83:9`! 0x02
84 #define FIELD_DEFAULTcxx . . $ `lib/database/src/so/fields/SoField.c++:84:9`! 0x04
85
86 // Amount of values to allocate at a time when reading in multiple values.
87 #define VALUE_CHUNK_SIZEcxx . . $ `lib/database/src/so/fields/SoField.c++:87:9`! 32
88
89 // If the field is connected or there are any FieldSensors attached to
90 // this field, flags.hasAuditors will be TRUE, and this structure is
91 // used to contain the extra information needed. Done this way to
92 // save space in the common case.
93 struct SoFieldAuditorInfocxx . . $ SoFieldAuditorInfo# {
94 SoFieldContainercxx . . $ SoFieldContainer# *containercxx . . $ SoFieldAuditorInfo#container.;
95
96 // List of auditors: objects to pass notification to.
97 SoAuditorListcxx . . $ SoAuditorList# auditorscxx . . $ SoFieldAuditorInfo#auditors.;
98
99 // The "connection" field points to either an engine output or
100 // another field:
101 unioncxx . . $ SoFieldAuditorInfo#$anonymous_type_0# {
102 SoEngineOutputcxx . . $ SoEngineOutput# *engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.;
103 SoFieldcxx . . $ SoField# *fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.;
104 } connectioncxx . . $ SoFieldAuditorInfo#connection.;
105
106 };
107
108
109 //////////////////////////////////////////////////////////////////////////////
110 //
111 // Class: SoField
112 //
113 // Useful stuff for ALL fields, regardless of type or multiplicity
114 //
115 //////////////////////////////////////////////////////////////////////////////
116
117 SoTypecxx . . $ SoType# SoFieldcxx . . $ SoField#::classTypeIdcxx . . $ SoField#classTypeId.; // Type identifier
118 char *SoFieldcxx . . $ SoField#::fieldBufcxx . . $ SoField#fieldBuf.; // Used by SoField::get()
119 int SoFieldcxx . . $ SoField#::fieldBufSizecxx . . $ SoField#fieldBufSize.; // Used by SoField::get()
120
121 ////////////////////////////////////////////////////////////////////////
122 //
123 // Description:
124 // Helper routine, allocates the auditorInfo structure, if needed:
125 //
126 // Use: private, static
127
128 void
129 SoFieldcxx . . $ SoField#::createAuditorInfocxx . . $ SoField#createAuditorInfo(49f6e7a06ebc5aa8).()
130 //
131 ////////////////////////////////////////////////////////////////////////
132 {
133 if (!flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.) {
134 SoFieldContainercxx . . $ SoFieldContainer# *myContainer = containercxx . . $ SoField#$anonymous_type_1#container.;
135 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo. = new SoFieldAuditorInfocxx . . $ SoFieldAuditorInfo#;
136 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->containercxx . . $ SoFieldAuditorInfo#container. = myContainer;
137 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
138 flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
139 }
140 }
141
142 ////////////////////////////////////////////////////////////////////////
143 //
144 // Description:
145 // Constructor.
146 //
147 // Use: public
148
149 SoFieldcxx . . $ SoField#::SoFieldcxx . . $ SoField#SoField(49f6e7a06ebc5aa8).()
150 //
151 ////////////////////////////////////////////////////////////////////////
152 {
153 containercxx . . $ SoField#$anonymous_type_1#container. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
154 flagscxx . . $ SoField#flags..hasDefaultcxx . . $ SoField#$anonymous_type_0#hasDefault. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
155 flagscxx . . $ SoField#flags..ignoredcxx . . $ SoField#$anonymous_type_0#ignored. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
156 flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
157 flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
158 flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
159 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
160 flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
161 flagscxx . . $ SoField#flags..isEngineModifyingcxx . . $ SoField#$anonymous_type_0#isEngineModifying. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
162 flagscxx . . $ SoField#flags..readOnlycxx . . $ SoField#$anonymous_type_0#readOnly. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;;
163 flagscxx . . $ SoField#flags..dirtycxx . . $ SoField#$anonymous_type_0#dirty. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
164 }
165
166 ////////////////////////////////////////////////////////////////////////
167 //
168 // Description:
169 // Destructor. Also disconnects if connected.
170 //
171 // Use: public
172
173 SoFieldcxx . . $ SoField#::~cxx . . $ SoField#`~SoField`(49f6e7a06ebc5aa8).SoFieldcxx . . $ SoField#()
174 //
175 ////////////////////////////////////////////////////////////////////////
176 {
177 if (flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected.)
178 reallyDisconnectcxx . . $ SoField#reallyDisconnect(49f6e7a06ebc5aa8).();
179
180 // Make sure any auditors are notified of the impending doom of
181 // this field. We don't have to notify the container, since we
182 // can't be destroyed unless it is already being destroyed. So
183 // just notify the rest of the auditors. The only type of auditors
184 // that can be attached to a field are sensors and other fields
185 // connected from this one. Both of these are given a chance to
186 // detach/disconnect themselves.
187
188 if (flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.) {
189 SoAuditorListcxx . . $ SoAuditorList# &auditors = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors.;
190 for (int i = auditors.getLengthcxx . . $ SoAuditorList#getLength(455f465bc33b4cdf).() - 1; i >= 0; i--) {
191 switch (auditors.getTypecxx . . $ SoAuditorList#getType(7a029097243d1ac6).(i)) {
192 case SoNotReccxx . . $ SoNotRec#::SENSORcxx . . $ SoNotRec#SENSOR.:
193 // Tell sensor that we are going away. (This must be a
194 // field sensor, but cast it to a data sensor for ease.)
195 ((SoDataSensorcxx . . $ SoDataSensor# *) auditors.getObjectcxx . . $ SoAuditorList#getObject(9b392d13998dd55f).(i))->dyingReferencecxx . . $ SoDataSensor#dyingReference(49f6e7a06ebc5aa8).();
196
197 // The call to dyingReference() might remove auditors,
198 // shortening the auditors list; make sure we're not
199 // trying to access past the end.
200 if (i > auditors.getLengthcxx . . $ SoAuditorList#getLength(455f465bc33b4cdf).())
201 i = auditors.getLengthcxx . . $ SoAuditorList#getLength(455f465bc33b4cdf).();
202 break;
203
204 case SoNotReccxx . . $ SoNotRec#::FIELDcxx . . $ SoNotRec#FIELD.:
205 {
206 // Disconnect other field from this one
207 SoFieldcxx . . $ SoField# *f = (SoFieldcxx . . $ SoField# *)auditors.getObjectcxx . . $ SoAuditorList#getObject(9b392d13998dd55f).(i);
208 SoFieldContainercxx . . $ SoFieldContainer# *fc = f->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
209
210 // If connected to a converter, must remove the other
211 // side of the connection:
212 if (fc->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoFieldConvertercxx . . $ SoFieldConverter#::getClassTypeIdcxx . . $ SoFieldConverter#getClassTypeId(c00c150378d2b968).())) {
213 SoFieldConvertercxx . . $ SoFieldConverter# *converter =
214 (SoFieldConvertercxx . . $ SoFieldConverter# *)fc;
215 SoFieldListcxx . . $ SoFieldList# fieldListcxx . . $ SoFieldList#SoFieldList(49f6e7a06ebc5aa8).;
216 converter->getForwardConnectionscxx . . $ SoFieldConverter#getForwardConnections(517625c0f7c00408).(fieldList);
217 for (int j = 0; j < fieldList.getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); j++) {
218 fieldList[cxx . . $ SoFieldList#`operator[]`(f04f5c02c62994cc).0]->disconnectcxx . . $ SoField#disconnect(49f6e7a06ebc5aa8).();
219 }
220 // The converter will be deleted and will
221 // disconnect itself from us when all of its
222 // forward connections go away.
223 }
224 else {
225 f->disconnectcxx . . $ SoField#disconnect(49f6e7a06ebc5aa8).();
226 }
227 }
228 break;
229
230 default:
231 SoDebugErrorcxx . . $ SoDebugError#::postcxx . . $ SoDebugError#post(fb6d009da02ec724).("(internal) SoField::~SoField",
232 "Got an auditor of type %d",
233 (int) auditors.getTypecxx . . $ SoAuditorList#getType(7a029097243d1ac6).(i));
234 break;
235 }
236 }
237 delete auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.;
238 }
239 }
240
241 ////////////////////////////////////////////////////////////////////////
242 //
243 // Description:
244 // Returns TRUE if field is an instance of a field of the given type
245 // or an instance of a subclass of it.
246 //
247 // Use: public
248
249 SbBoolcxx . . $ SbBool#
250 SoFieldcxx . . $ SoField#::isOfTypecxx . . $ SoField#isOfType(1fd66475a268b64e).(SoTypecxx . . $ SoType# type) const
251 //
252 ////////////////////////////////////////////////////////////////////////
253 {
254 return getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).().isDerivedFromcxx . . $ SoType#isDerivedFrom(1fd66475a268b64e).(type);
255 }
256
257 ////////////////////////////////////////////////////////////////////////
258 //
259 // Description:
260 // Sets whether connection to field or engine is enabled. This
261 // flag may be set even if no connection is currently established.
262 // The flag will remain in effect until changed again.
263 //
264 // Use: public
265
266 void
267 SoFieldcxx . . $ SoField#::enableConnectioncxx . . $ SoField#enableConnection(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool# flag)
268 //
269 ////////////////////////////////////////////////////////////////////////
270 {
271 if (flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled. == flag) return;
272
273 // Before disabling, pull value through if out-of-date:
274 if (!flag) {
275 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
276 flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
277 flagscxx . . $ SoField#flags..readOnlycxx . . $ SoField#$anonymous_type_0#readOnly. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
278
279 if (isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).() && !flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.)
280 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.->connectionStatusChangedcxx . . $ SoField#connectionStatusChanged(d4f767463ce0a6b3).(-1);
281 }
282 else {
283 // Mark the field dirty when re-enabling so it will get
284 // evaluated.
285 flagscxx . . $ SoField#flags..readOnlycxx . . $ SoField#$anonymous_type_0#readOnly. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
286 flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
287 flagscxx . . $ SoField#flags..dirtycxx . . $ SoField#$anonymous_type_0#dirty. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
288
289 if (isConnectedFromEnginecxx . . $ SoField#isConnectedFromEngine(455f465bc33b4cdf).() || flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.) {
290 // Mark engine as needing evaluation to force it to write
291 // value (just as if we added a connection):
292 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.->addConnectioncxx . . $ SoEngineOutput#addConnection(6a35cc9f7090653f).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
293 }
294 else if (isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).()) {
295 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.->connectionStatusChangedcxx . . $ SoField#connectionStatusChanged(d4f767463ce0a6b3).(1);
296 }
297 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).(); // Pull value through
298 }
299 }
300
301 ////////////////////////////////////////////////////////////////////////
302 //
303 // Description:
304 // Connects the field to the given output of an engine. Returns
305 // FALSE if the connection could not be made.
306 //
307 // Use: public
308
309 SbBoolcxx . . $ SbBool#
310 SoFieldcxx . . $ SoField#::connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(SoEngineOutputcxx . . $ SoEngineOutput# *engineOutput)
311 //
312 ////////////////////////////////////////////////////////////////////////
313 {
314 SoFieldContainercxx . . $ SoFieldContainer# *engineCont = engineOutput->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
315
316 #ifdef DEBUG
317 // Make sure everything is contained, or this won't work at all
318 if (engineCont == NULL) {
319 SoDebugError::post("SoField::connectFrom",
320 "Can't connect to an engine output "
321 "that is not contained in an engine");
322 return FALSE;
323 }
324 #endif
325
326 // Ref the engine, just in case it's currently connected, and this
327 // is its only ref
328 engineCont->refcxx . . $ SoBase#ref(83f5f38750778ac8).();
329
330 // Disconnect any previous connection
331 disconnectcxx . . $ SoField#disconnect(49f6e7a06ebc5aa8).();
332
333 // Check the type of the field and the output for compatability
334 SoTypecxx . . $ SoType# outputType = engineOutput->getConnectionTypecxx . . $ SoEngineOutput#getConnectionType(70775439ff16cb15).();
335 if (getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).() !=cxx . . $ SoType#`operator!=`(1fd66475a268b64e). outputType) {
336
337 SbBoolcxx . . $ SbBool# ret;
338 SoFieldConvertercxx . . $ SoFieldConverter# *converter;
339
340 converter = createConvertercxx . . $ SoField#createConverter(b6ae65c6cffe55c9).(outputType);
341
342 // Check for error
343 if (converter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
344 ret = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
345 else {
346 converter->refcxx . . $ SoBase#ref(83f5f38750778ac8).();
347
348 // Hook the converter up to the other field first, then
349 // hook this up to the converter, to avoid multiple
350 // notifications or evaluations if something downstream is
351 // pulling values during notification:
352 // converter:
353 SoFieldcxx . . $ SoField# *c_input = converter->getInputcxx . . $ SoFieldConverter#getInput(ada21ac27dc7bfdf).(outputType);
354 SoEngineOutputcxx . . $ SoEngineOutput# *c_output =
355 converter->getOutputcxx . . $ SoFieldConverter#getOutput(9634afc507c62c40).(getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).());
356 #ifdef DEBUG
357 if (c_input == NULL || c_output == NULL) {
358 SoDebugError::post("SoField::connectFrom",
359 "Created converter, but converter"
360 "input or output is NULL");
361 return FALSE;
362 }
363 #endif
364 // Making the connection may result in downstream engines
365 // requesting evaluation, so this must be set before the
366 // connection is made:
367 flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
368 flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
369
370 c_input->connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(engineOutput);
371 connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(c_output);
372
373 converter->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).();
374 ret = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
375 }
376 // See comment below
377 engineCont->unrefNoDeletecxx . . $ SoBase#unrefNoDelete(83f5f38750778ac8).();
378
379 return ret;
380 }
381
382 createAuditorInfocxx . . $ SoField#createAuditorInfo(49f6e7a06ebc5aa8).();
383
384 flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
385
386 // If converted, this flag was set when the converter was created:
387 if (!flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.)
388 flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
389
390 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput. = engineOutput;
391
392 // Tell the engine output about this connection
393 engineOutput->addConnectioncxx . . $ SoEngineOutput#addConnection(6a35cc9f7090653f).(this);
394
395 if (isConnectionEnabledcxx . . $ SoField#isConnectionEnabled(455f465bc33b4cdf).() && engineOutput->isEnabledcxx . . $ SoEngineOutput#isEnabled(455f465bc33b4cdf).()) {
396 // A connection means that the field no longer contains the
397 // default value
398 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
399
400 // Notify
401 startNotifycxx . . $ SoField#startNotify(49f6e7a06ebc5aa8).();
402 }
403
404 // Get rid of the extra reference. Note that if the container was
405 // handed to us with 0 references, we don't want to delete it,
406 // since presumably whoever asked for the connection still wants
407 // it, and will ref it later.
408 engineCont->unrefNoDeletecxx . . $ SoBase#unrefNoDelete(83f5f38750778ac8).();
409
410 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
411 }
412
413 ////////////////////////////////////////////////////////////////////////
414 //
415 // Description:
416 // Connects the field to the given field. Returns FALSE if the
417 // connection could not be made.
418 //
419 // Use: public
420
421 SbBoolcxx . . $ SbBool#
422 SoFieldcxx . . $ SoField#::connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(SoFieldcxx . . $ SoField# *field)
423 //
424 ////////////////////////////////////////////////////////////////////////
425 {
426 // Disconnect any previous connection
427 disconnectcxx . . $ SoField#disconnect(49f6e7a06ebc5aa8).();
428
429 // Check the types of the two fields
430 SoTypecxx . . $ SoType# fieldType = field->getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).();
431 if (getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).() !=cxx . . $ SoType#`operator!=`(1fd66475a268b64e). fieldType) {
432
433 SbBoolcxx . . $ SbBool# ret;
434 SoFieldConvertercxx . . $ SoFieldConverter# *converter;
435
436 converter = createConvertercxx . . $ SoField#createConverter(b6ae65c6cffe55c9).(fieldType);
437
438 // Check for error
439 if (converter == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
440 ret = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
441 else {
442 converter->refcxx . . $ SoBase#ref(83f5f38750778ac8).();
443
444 // Hook the converter up to the other field first, then
445 // hook this up to the converter, to avoid multiple
446 // notifications or evaluations if something downstream is
447 // pulling values during notification:
448 // converter:
449 SoFieldcxx . . $ SoField# *c_input = converter->getInputcxx . . $ SoFieldConverter#getInput(ada21ac27dc7bfdf).(fieldType);
450 SoEngineOutputcxx . . $ SoEngineOutput# *c_output =
451 converter->getOutputcxx . . $ SoFieldConverter#getOutput(9634afc507c62c40).(getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).());
452 #ifdef DEBUG
453 if (c_input == NULL || c_output == NULL) {
454 SoDebugError::post("SoField::connectFrom",
455 "Created converter, but converter"
456 "input or output is NULL");
457 return FALSE;
458 }
459 #endif
460 // Making the connection may result in downstream engines
461 // requesting evaluation, so this must be set before the
462 // connection is made:
463 flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
464 flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
465
466 c_input->connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(field);
467 connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(c_output);
468
469 converter->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).();
470 ret = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
471 }
472 return ret;
473 }
474
475 createAuditorInfocxx . . $ SoField#createAuditorInfo(49f6e7a06ebc5aa8).();
476
477 flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
478
479 // If converted, this flag was set when the converter was created:
480 if (!flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.)
481 flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
482
483 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field. = field;
484
485 // Make sure this field gets notified when the connected field
486 // changes
487 field->addAuditorcxx . . $ SoField#addAuditor(83574029f67dcc4a).(this, SoNotReccxx . . $ SoNotRec#::FIELDcxx . . $ SoNotRec#FIELD.);
488
489 if (isConnectionEnabledcxx . . $ SoField#isConnectionEnabled(455f465bc33b4cdf).()) {
490 // A connection means that the field no longer contains the
491 // default value
492 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
493
494 // Notify
495 startNotifycxx . . $ SoField#startNotify(49f6e7a06ebc5aa8).();
496 }
497
498 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
499 }
500
501 ////////////////////////////////////////////////////////////////////////
502 //
503 // Description:
504 // Disconnects the field from whatever it's connected to. Harmless
505 // if not already connected.
506 //
507 // Use: public
508
509 void
510 SoFieldcxx . . $ SoField#::disconnectcxx . . $ SoField#disconnect(49f6e7a06ebc5aa8).()
511 //
512 ////////////////////////////////////////////////////////////////////////
513 {
514 if (flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected.) {
515
516 // Make sure the field is evaluated first. (There may have
517 // been a notification of the field but no corresponding
518 // evaluation before the field was disconnected.)
519 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
520
521 reallyDisconnectcxx . . $ SoField#reallyDisconnect(49f6e7a06ebc5aa8).();
522 }
523 }
524
525 ////////////////////////////////////////////////////////////////////////
526 //
527 // Description:
528 // Returns the engine output the field is connected to. Returns
529 // FALSE if there is no connection to an engine.
530 //
531 // Use: public
532
533 SbBoolcxx . . $ SbBool#
534 SoFieldcxx . . $ SoField#::getConnectedEnginecxx . . $ SoField#getConnectedEngine(d90a32d7bcd50feb).(SoEngineOutputcxx . . $ SoEngineOutput# *&engineOut) const
535 //
536 ////////////////////////////////////////////////////////////////////////
537 {
538 if (! isConnectedFromEnginecxx . . $ SoField#isConnectedFromEngine(455f465bc33b4cdf).())
539 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
540
541 // Skip over field converter, if any
542 const SoFieldcxx . . $ SoField# *connectedField =
543 (! flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted. ? this : getConvertercxx . . $ SoField#getConverter(b8f62a99f8ebc4d1).()->getConnectedInputcxx . . $ SoFieldConverter#getConnectedInput(50d976c2de78a9be).());
544
545 engineOut = connectedField->auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.;
546
547 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
548 }
549
550 ////////////////////////////////////////////////////////////////////////
551 //
552 // Description:
553 // Returns the field the field is connected to. Returns FALSE if
554 // there is no connection to a field.
555 //
556 // Use: public
557
558 SbBoolcxx . . $ SbBool#
559 SoFieldcxx . . $ SoField#::getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(SoFieldcxx . . $ SoField# *&field) const
560 //
561 ////////////////////////////////////////////////////////////////////////
562 {
563 if (! isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).())
564 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
565
566 // Skip over field converter, if any
567 const SoFieldcxx . . $ SoField# *connectedField =
568 (! flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted. ? this : getConvertercxx . . $ SoField#getConverter(b8f62a99f8ebc4d1).()->getConnectedInputcxx . . $ SoFieldConverter#getConnectedInput(50d976c2de78a9be).());
569
570 field = connectedField->auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.;
571
572 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
573 }
574
575 ////////////////////////////////////////////////////////////////////////
576 //
577 // Description:
578 // Returns the number of fields this field is writing into, and
579 // adds pointers to those fields to the given field list.
580 //
581 // Use: public
582
583 int
584 SoFieldcxx . . $ SoField#::getForwardConnectionscxx . . $ SoField#getForwardConnections(517625c0f7c00408).(SoFieldListcxx . . $ SoFieldList# &list) const
585 //
586 ////////////////////////////////////////////////////////////////////////
587 {
588 if (!flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.) return 0;
589
590 int numAuditors, numConnections = 0, i;
591
592 // Loop through our auditor list, finding fields we are connected
593 // to.
594 SoAuditorListcxx . . $ SoAuditorList# &auditors = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors.;
595 numAuditors = auditors.getLengthcxx . . $ SoAuditorList#getLength(455f465bc33b4cdf).();
596 for (i = 0; i < numAuditors; i++) {
597 if (auditors.getTypecxx . . $ SoAuditorList#getType(7a029097243d1ac6).(i) == SoNotReccxx . . $ SoNotRec#::FIELDcxx . . $ SoNotRec#FIELD.) {
598
599 SoFieldcxx . . $ SoField# *field = (SoFieldcxx . . $ SoField# *) auditors.getObjectcxx . . $ SoAuditorList#getObject(9b392d13998dd55f).(i);
600
601 // Skip over converter, if any
602 SoFieldContainercxx . . $ SoFieldContainer# *container = field->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
603 if (container->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoFieldConvertercxx . . $ SoFieldConverter#::getClassTypeIdcxx . . $ SoFieldConverter#getClassTypeId(c00c150378d2b968).()))
604 numConnections += ((SoFieldConvertercxx . . $ SoFieldConverter# *) container)->
605 getForwardConnectionscxx . . $ SoFieldConverter#getForwardConnections(517625c0f7c00408).(list);
606
607 else {
608 list.appendcxx . . $ SoFieldList#append(6a35cc9f7090653f).(field);
609 numConnections++;
610 }
611 }
612 }
613
614 return numConnections;
615 }
616
617 ////////////////////////////////////////////////////////////////////////
618 //
619 // Description:
620 // Returns the containing node or engine.
621 //
622 // Use: public
623
624 SoFieldContainercxx . . $ SoFieldContainer# *
625 SoFieldcxx . . $ SoField#::getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).() const
626 //
627 ////////////////////////////////////////////////////////////////////////
628 {
629 if (flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.)
630 return auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->containercxx . . $ SoFieldAuditorInfo#container.;
631 else
632 return containercxx . . $ SoField#$anonymous_type_1#container.;
633 }
634
635 ////////////////////////////////////////////////////////////////////////
636 //
637 // Description:
638 // Sets value of field from the Inventor data file format
639 // information in the value string. Returns TRUE if successful,
640 // FALSE otherwise.
641 //
642 // Use: public
643
644 SbBoolcxx . . $ SbBool#
645 SoFieldcxx . . $ SoField#::setcxx . . $ SoField#set(5c4306d8553b3696).(const char *valueString)
646 //
647 ////////////////////////////////////////////////////////////////////////
648 {
649 SoInputcxx . . $ SoInput# incxx . . $ SoInput#SoInput(49f6e7a06ebc5aa8).;
650 in.setBuffercxx . . $ SoInput#setBuffer(5500c4293b1bbef0).((void *) valueString, strlen(valueString));
651 return readcxx . . $ SoField#read(82f62b5975549baa).(&in, "<field passed to SoField::set>"cxx . . $ SbName#SbName(85c52e162fed56f9).);
652 }
653
654 ////////////////////////////////////////////////////////////////////////
655 //
656 // Description:
657 // Stores field value (in the same format expected by the set()
658 // method) in the given SbString. This always returns a string,
659 // even if the field has a default value.
660 //
661 // Use: public
662
663 void
664 SoFieldcxx . . $ SoField#::getcxx . . $ SoField#get(a526c26e8daafea0).(SbStringcxx . . $ SbString# &valueString)
665 //
666 ////////////////////////////////////////////////////////////////////////
667 {
668 SoOutputcxx . . $ SoOutput# outcxx . . $ SoOutput#SoOutput(49f6e7a06ebc5aa8).;
669
670 SbBoolcxx . . $ SbBool# wasDefault = isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).();
671
672 if (wasDefault)
673 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
674
675 // Make sure the field value is up to date
676 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
677
678 // Prepare a character buffer and SoOutput for writing field strings
679 if (fieldBufSizecxx . . $ SoField#fieldBufSize. == 0) {
680 fieldBufSizecxx . . $ SoField#fieldBufSize. = 1028;
681 fieldBufcxx . . $ SoField#fieldBuf. = (char *) malloc((unsigned) fieldBufSizecxx . . $ SoField#fieldBufSize.);
682 }
683
684 // Set up output into a string buffer
685 out.setBuffercxx . . $ SoOutput#setBuffer(61c86ae95e149a18).((void *) fieldBufcxx . . $ SoField#fieldBuf., fieldBufSizecxx . . $ SoField#fieldBufSize., &SoFieldcxx . . $ SoField#::reallocFieldBufcxx . . $ SoField#reallocFieldBuf(417ab160f6baadc6).);
686
687 // Make sure that the file header and lots of white space will NOT
688 // be written into the string
689 out.setCompactcxx . . $ SoOutput#setCompact(d4f767463ce0a6b3).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
690
691 // Prepare to begin writing by incrementing the
692 // current write counter in SoBase
693 SoBasecxx . . $ SoBase#::incrementCurrentWriteCountercxx . . $ SoBase#incrementCurrentWriteCounter(49f6e7a06ebc5aa8).();
694
695 // Count references first
696 out.setStagecxx . . $ SoOutput#setStage(1e2aade6511d3df6).(SoOutputcxx . . $ SoOutput#::COUNT_REFScxx . . $ SoOutput#COUNT_REFS.);
697 countWriteRefscxx . . $ SoField#countWriteRefs(58762e0f79576b7c).(&out);
698
699 // Next, do actual writing
700 out.setStagecxx . . $ SoOutput#setStage(1e2aade6511d3df6).(SoOutputcxx . . $ SoOutput#::WRITEcxx . . $ SoOutput#WRITE.);
701 writeValuecxx . . $ SoField#writeValue(58762e0f79576b7c).(&out);
702
703 // SoField::get() is used by field converters that convert to
704 // strings when evaluating. Because this can happen in the middle
705 // of writing a scene graph, we have to restore things to the way
706 // they were before the get().
707 SoBasecxx . . $ SoBase#::decrementCurrentWriteCountercxx . . $ SoBase#decrementCurrentWriteCounter(49f6e7a06ebc5aa8).();
708 out.setStagecxx . . $ SoOutput#setStage(1e2aade6511d3df6).(SoOutputcxx . . $ SoOutput#::COUNT_REFScxx . . $ SoOutput#COUNT_REFS.);
709 countWriteRefscxx . . $ SoField#countWriteRefs(58762e0f79576b7c).(&out);
710
711 // Make sure the string is terminated
712 out.resetcxx . . $ SoOutput#reset(49f6e7a06ebc5aa8).();
713
714 // Store the result in the passed SbString
715 valueString =cxx . . $ SbString#`operator=`(90e156a883234106). fieldBufcxx . . $ SoField#fieldBuf.;
716
717 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(wasDefault);
718 }
719
720 ////////////////////////////////////////////////////////////////////////
721 //
722 // Description:
723 // Touches a field, starts notification
724 //
725 // Use: public
726
727 void
728 SoFieldcxx . . $ SoField#::touchcxx . . $ SoField#touch(49f6e7a06ebc5aa8).()
729 //
730 ////////////////////////////////////////////////////////////////////////
731 {
732 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
733 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
734 }
735
736 ////////////////////////////////////////////////////////////////////////
737 //
738 // Description:
739 // Sets the ignore flag on a field. Causes notification.
740 //
741 // Use: public
742
743 void
744 SoFieldcxx . . $ SoField#::setIgnoredcxx . . $ SoField#setIgnored(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool# ig)
745 //
746 ////////////////////////////////////////////////////////////////////////
747 {
748 if (flagscxx . . $ SoField#flags..ignoredcxx . . $ SoField#$anonymous_type_0#ignored. != ig) {
749 flagscxx . . $ SoField#flags..ignoredcxx . . $ SoField#$anonymous_type_0#ignored. = ig;
750
751 // Indicate that the value changed, but leave the default flag as is
752 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
753 }
754 }
755
756 ////////////////////////////////////////////////////////////////////////
757 //
758 // Description:
759 // Initiates notification due to a change in the field.
760 //
761 // Use: internal
762
763 void
764 SoFieldcxx . . $ SoField#::startNotifycxx . . $ SoField#startNotify(49f6e7a06ebc5aa8).()
765 //
766 ////////////////////////////////////////////////////////////////////////
767 {
768 if (!flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. || flagscxx . . $ SoField#flags..isEngineModifyingcxx . . $ SoField#$anonymous_type_0#isEngineModifying.)
769 return;
770
771 SoDBcxx . . $ SoDB#::startNotifycxx . . $ SoDB#startNotify(49f6e7a06ebc5aa8).();
772
773 // Create a new notification list:
774 SoNotListcxx . . $ SoNotList# listcxx . . $ SoNotList#SoNotList(49f6e7a06ebc5aa8).;
775
776 // Use notify() method to do all the work:
777 notifycxx . . $ SoField#notify(f43de791d8d2eb5a).(&list);
778
779 SoDBcxx . . $ SoDB#::endNotifycxx . . $ SoDB#endNotify(49f6e7a06ebc5aa8).();
780 }
781
782 ////////////////////////////////////////////////////////////////////////
783 //
784 // Description:
785 // Propagates notification through the field. The notification must
786 // be coming from the engine output or field from which this
787 // field is connected.
788 //
789 // Use: internal
790
791 void
792 SoFieldcxx . . $ SoField#::notifycxx . . $ SoField#notify(f43de791d8d2eb5a).(SoNotListcxx . . $ SoNotList# *list)
793 //
794 ////////////////////////////////////////////////////////////////////////
795 {
796 // If notification is disabled, don't do anything.
797 if (flagscxx . . $ SoField#flags..dirtycxx . . $ SoField#$anonymous_type_0#dirty. || ! flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. || flagscxx . . $ SoField#flags..isEngineModifyingcxx . . $ SoField#$anonymous_type_0#isEngineModifying.)
798 return;
799
800 // If being notified through a connection and the connection is
801 // disabled, don't notify:
802 if (!flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled. && (list->getLastReccxx . . $ SoNotList#getLastRec(a39986cdb7d7aef6).() != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) {
803
804 SoNotReccxx . . $ SoNotRec#::Typecxx . . $ SoNotRec#Type# t = list->getLastReccxx . . $ SoNotList#getLastRec(a39986cdb7d7aef6).()->getTypecxx . . $ SoNotRec#getType(30fb18e4d3ac32aa).();
805 if (t == SoNotReccxx . . $ SoNotRec#::ENGINEcxx . . $ SoNotRec#ENGINE. || t == SoNotReccxx . . $ SoNotRec#::FIELDcxx . . $ SoNotRec#FIELD.)
806 return;
807 }
808
809 // Indicate that we are notifying, to break future cycles.
810 // SFTrigger relies on this being done BEFORE checking for a NULL
811 // field container.
812 flagscxx . . $ SoField#flags..dirtycxx . . $ SoField#$anonymous_type_0#dirty. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
813
814 // Propagate to all auditors.
815 // NOTE: Since this may be done for fields that are being
816 // constructed, we have to check for a NULL container first.
817 // NOTE: SFTrigger fields set their container to NULL temporarily
818 // when being read in to prevent notification propogating when
819 // they're read.
820 SoFieldContainercxx . . $ SoFieldContainer# *cont = getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
821
822 if (cont != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
823
824 // First create and append a new record to indicate we passed
825 // through this field.
826 SoNotReccxx . . $ SoNotRec# reccxx . . $ SoNotRec#SoNotRec(2ca869ab50d3357c).(cont);
827 list->appendcxx . . $ SoNotList#append(50c58e6066a0e420).(&rec, this);
828 list->setLastTypecxx . . $ SoNotList#setLastType(76880d22122cca57).(SoNotReccxx . . $ SoNotRec#::CONTAINERcxx . . $ SoNotRec#CONTAINER.);
829
830 // If no auditors, just notify container
831 if (! flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.)
832 cont->notifycxx . . $ SoFieldContainer#notify(f43de791d8d2eb5a).(list);
833
834 // Otherwise, notify container and auditors. We have to make
835 // sure to copy the list before notifying anyone.
836 else {
837 SoNotListcxx . . $ SoNotList# listCopy(*list);
838 cont->notifycxx . . $ SoFieldContainer#notify(f43de791d8d2eb5a).(list);
839 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors..notifycxx . . $ SoAuditorList#notify(f43de791d8d2eb5a).(&listCopy);
840 }
841 }
842 }
843
844 ////////////////////////////////////////////////////////////////////////
845 //
846 // Description:
847 // Sets the containing node, engine, or global. Also marks this
848 // field as Default, and turns on notification (this saves the
849 // nodes from having to do it).
850 //
851 // Use: internal
852
853 void
854 SoFieldcxx . . $ SoField#::setContainercxx . . $ SoField#setContainer(1c5659d1d94c054f).(SoFieldContainercxx . . $ SoFieldContainer# *cont)
855 //
856 ////////////////////////////////////////////////////////////////////////
857 {
858 if (flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.)
859 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->containercxx . . $ SoFieldAuditorInfo#container. = cont;
860 else
861 containercxx . . $ SoField#$anonymous_type_1#container. = cont;
862 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
863 enableNotifycxx . . $ SoField#enableNotify(7864480464b09eea).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
864 }
865
866 ////////////////////////////////////////////////////////////////////////
867 //
868 // Description:
869 // Returns TRUE if the field (or its description) needs to be
870 // written out.
871 //
872 // Use: internal
873
874 SbBoolcxx . . $ SbBool#
875 SoFieldcxx . . $ SoField#::shouldWritecxx . . $ SoField#shouldWrite(455f465bc33b4cdf).() const
876 //
877 ////////////////////////////////////////////////////////////////////////
878 {
879 if (!isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).() || isConnectedcxx . . $ SoField#isConnected(455f465bc33b4cdf).() || isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).()) return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
880
881 // The hard case; if we have any forward connections, should also
882 // write ourselves out (actually, that's only strictly necessary
883 // if the field is part of a non-builtin node...).
884
885 if (!flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.) return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
886
887 // Loop through our auditor list, finding fields we are connected
888 // to.
889 SoAuditorListcxx . . $ SoAuditorList# &auditors = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors.;
890 int numAuditors = auditors.getLengthcxx . . $ SoAuditorList#getLength(455f465bc33b4cdf).();
891 for (int i = 0; i < numAuditors; i++) {
892 if (auditors.getTypecxx . . $ SoAuditorList#getType(7a029097243d1ac6).(i) == SoNotReccxx . . $ SoNotRec#::FIELDcxx . . $ SoNotRec#FIELD.) {
893 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
894 }
895 }
896 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
897 }
898
899 ////////////////////////////////////////////////////////////////////////
900 //
901 // Description:
902 // Adds an auditor to list of auditors.
903 //
904 // Use: private
905
906 void
907 SoFieldcxx . . $ SoField#::addAuditorcxx . . $ SoField#addAuditor(83574029f67dcc4a).(void *auditor, SoNotReccxx . . $ SoNotRec#::Typecxx . . $ SoNotRec#Type# type)
908 //
909 ////////////////////////////////////////////////////////////////////////
910 {
911 #ifdef DEBUG
912 if (auditor == NULL) {
913 SoDebugError::post("SoField::addAuditor",
914 "ACK! Trying to add a NULL auditor");
915 return;
916 }
917 #endif
918 createAuditorInfocxx . . $ SoField#createAuditorInfo(49f6e7a06ebc5aa8).();
919
920 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors..appendcxx . . $ SoAuditorList#append(83574029f67dcc4a).(auditor, type);
921
922 // Connection status is different
923 connectionStatusChangedcxx . . $ SoField#connectionStatusChanged(d4f767463ce0a6b3).(1);
924 }
925
926 ////////////////////////////////////////////////////////////////////////
927 //
928 // Description:
929 // Removes an auditor from list of auditors.
930 //
931 // Use: private
932
933 void
934 SoFieldcxx . . $ SoField#::removeAuditorcxx . . $ SoField#removeAuditor(83574029f67dcc4a).(void *auditor, SoNotReccxx . . $ SoNotRec#::Typecxx . . $ SoNotRec#Type# type)
935 //
936 ////////////////////////////////////////////////////////////////////////
937 {
938 int audIndex = -1;
939 if (flagscxx . . $ SoField#flags..hasAuditorscxx . . $ SoField#$anonymous_type_0#hasAuditors.)
940 audIndex = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors..findcxx . . $ SoAuditorList#find(d6b355e199b2725).(auditor, type);
941
942 #ifdef DEBUG
943 if (audIndex < 0) {
944 SoDebugError::post("SoField::removeAuditor",
945 "can't find auditor %#x\n", auditor);
946 return;
947 }
948 #endif /* DEBUG */
949
950 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->auditorscxx . . $ SoFieldAuditorInfo#auditors..removecxx . . $ SoAuditorList#remove(d4f767463ce0a6b3).(audIndex);
951
952 // Connection status is different
953 connectionStatusChangedcxx . . $ SoField#connectionStatusChanged(d4f767463ce0a6b3).(-1);
954 }
955
956 ////////////////////////////////////////////////////////////////////////
957 //
958 // Description:
959 // Enables or disables notification
960 //
961 // Use: internal
962
963 SbBoolcxx . . $ SbBool#
964 SoFieldcxx . . $ SoField#::enableNotifycxx . . $ SoField#enableNotify(7864480464b09eea).(SbBoolcxx . . $ SbBool# flag)
965 //
966 ////////////////////////////////////////////////////////////////////////
967 {
968 if (flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. == flag) return flag;
969
970 if (flag) evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
971
972 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = flag;
973 return !flag; // Previous state of flag is returned
974 }
975
976 ////////////////////////////////////////////////////////////////////////
977 //
978 // Description:
979 // Indicates to a field that a change has been made involving a
980 // connection from it (as source) to another field. The default
981 // method does nothing. Used by the subclass of SFTime used by the
982 // realTime global field to disable/enable the real time update
983 // sensor as things are connected from it or disconnected from it.
984 //
985 // Use: internal, virtual
986
987 void
988 SoFieldcxx . . $ SoField#::connectionStatusChangedcxx . . $ SoField#connectionStatusChanged(d4f767463ce0a6b3).(int)
989 //
990 ////////////////////////////////////////////////////////////////////////
991 {
992 }
993
994 ////////////////////////////////////////////////////////////////////////
995 //
996 // Description:
997 // After a field value has been copied using copyFrom(),
998 // this is called to allow fields to update the copy. This is used
999 // by node, engine, and path fields to make sure instances are
1000 // handled properly. The default implementation does nothing.
1001 //
1002 // Use: internal, virtual
1003
1004 void
1005 SoFieldcxx . . $ SoField#::fixCopycxx . . $ SoField#fixCopy(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool#)
1006 //
1007 ////////////////////////////////////////////////////////////////////////
1008 {
1009 }
1010
1011 ////////////////////////////////////////////////////////////////////////
1012 //
1013 // Description:
1014 // This returns TRUE if this field contains a reference to a node
1015 // or engine that is copied during a copy operation (i.e., it is
1016 // "inside"). The default method just checks if the field is
1017 // connected to such a node or engine. Subclasses may contain other
1018 // tests, such as those that contain pointers to nodes or engines.
1019 //
1020 // Use: internal, virtual
1021
1022 SbBoolcxx . . $ SbBool#
1023 SoFieldcxx . . $ SoField#::referencesCopycxx . . $ SoField#referencesCopy(455f465bc33b4cdf).() const
1024 //
1025 ////////////////////////////////////////////////////////////////////////
1026 {
1027 // If this field is not connected, it doesn't reference anything
1028 if (! isConnectedcxx . . $ SoField#isConnected(455f465bc33b4cdf).())
1029 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1030
1031 // Find the container of the connected field or engine
1032 // output, and determine if it is an engine
1033 SoFieldContainercxx . . $ SoFieldContainer# *container;
1034 SbBoolcxx . . $ SbBool# containerKnownToBeEngine = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1035
1036 if (isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).()) {
1037 SoFieldcxx . . $ SoField# *connectedField;
1038 getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(connectedField);
1039 container = connectedField->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
1040 containerKnownToBeEngine = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1041 }
1042 else {
1043 SoEngineOutputcxx . . $ SoEngineOutput# *connectedOutput;
1044 getConnectedEnginecxx . . $ SoField#getConnectedEngine(d90a32d7bcd50feb).(connectedOutput);
1045 container = (SoEnginecxx . . $ SoEngine# *) connectedOutput->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
1046 containerKnownToBeEngine = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1047 }
1048
1049 // If a copy of the container exists, this field references a copy
1050 if (SoFieldContainercxx . . $ SoFieldContainer#::checkCopycxx . . $ SoFieldContainer#checkCopy(39a6da8fb59a7efc).(container) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1051 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1052
1053 // If the container is an engine, see if that engine should be
1054 // copied, recursively.
1055 // ??? Optimize this by keeping a dict of "outside"
1056 // ??? engines so we never do the same work twice?
1057 // ??? We could actually store a pointer to the original engine in
1058 // ??? the dictionary if it is outside, but then we have to be
1059 // ??? careful to test for this when we call checkCopy(). It's
1060 // ??? probably not worth the effort, since people won't copy
1061 // ??? complicated engine networks often.
1062 if (containerKnownToBeEngine ||
1063 container->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoEnginecxx . . $ SoEngine#::getClassTypeIdcxx . . $ SoEngine#getClassTypeId(c00c150378d2b968).()) &&
1064 ((SoEnginecxx . . $ SoEngine# *) container)->shouldCopycxx . . $ SoEngine#shouldCopy(455f465bc33b4cdf).())
1065 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1066
1067 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1068 }
1069
1070 ////////////////////////////////////////////////////////////////////////
1071 //
1072 // Description:
1073 // Copies connection from one field to another. Assumes fields are
1074 // the same subclass and that fromField is connected. The index of
1075 // the field in the SoFieldData instance is passed in.
1076 //
1077 // Use: internal
1078
1079 void
1080 SoFieldcxx . . $ SoField#::copyConnectioncxx . . $ SoField#copyConnection(4e16df535ad78f95).(const SoFieldcxx . . $ SoField# *fromField)
1081 //
1082 ////////////////////////////////////////////////////////////////////////
1083 {
1084 // Connected from another field:
1085 if (fromField->isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).()) {
1086 SoFieldcxx . . $ SoField# *connectedField;
1087 fromField->getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(connectedField);
1088
1089 // Find the index of the connected field in its container
1090 SoFieldContainercxx . . $ SoFieldContainer# *connectedFC = connectedField->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
1091 const SoFieldDatacxx . . $ SoFieldData# *fieldData = connectedFC->getFieldDatacxx . . $ SoFieldContainer#getFieldData(56e90abbfb485471).();
1092 int index = fieldData->getIndexcxx . . $ SoFieldData#getIndex(f7c62f244cc492ca).(connectedFC, connectedField);
1093
1094 // We may need to copy the field's container
1095 SoFieldContainercxx . . $ SoFieldContainer# *FCCopy = connectedFC->copyThroughConnectioncxx . . $ SoFieldContainer#copyThroughConnection(5859c5f6d4d84439).();
1096
1097 // Get the other field data in case it is different
1098 const SoFieldDatacxx . . $ SoFieldData# *otherFieldData = FCCopy->getFieldDatacxx . . $ SoFieldContainer#getFieldData(56e90abbfb485471).();
1099
1100 // Connect from the corresponding field in the container
1101 connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(otherFieldData->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(FCCopy, index));
1102 }
1103
1104 // Connected from engine:
1105 else {
1106 SoEngineOutputcxx . . $ SoEngineOutput# *connectedOutput;
1107 fromField->getConnectedEnginecxx . . $ SoField#getConnectedEngine(d90a32d7bcd50feb).(connectedOutput);
1108
1109 // Find the index of this output in the containing engine
1110 SoEnginecxx . . $ SoEngine# *connectedEngine = connectedOutput->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
1111 const SoEngineOutputDatacxx . . $ SoEngineOutputData# *outputData =connectedEngine->getOutputDatacxx . . $ SoEngine#getOutputData(92c49e241b71f0f1).();
1112 int outputIndex = outputData->getIndexcxx . . $ SoEngineOutputData#getIndex(a7694553b3a655e2).(connectedEngine,
1113 connectedOutput);
1114
1115 // We may need to copy the engine itself
1116 SoEnginecxx . . $ SoEngine# *engineCopy =
1117 (SoEnginecxx . . $ SoEngine# *) connectedEngine->copyThroughConnectioncxx . . $ SoEngine#copyThroughConnection(5859c5f6d4d84439).();
1118
1119 // Get the other output data in case it is different
1120 const SoEngineOutputDatacxx . . $ SoEngineOutputData# *outputDataCopy = engineCopy->getOutputDatacxx . . $ SoEngine#getOutputData(92c49e241b71f0f1).();
1121
1122 // Connect from the corresponding output in the engine copy
1123 connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(outputDataCopy->getOutputcxx . . $ SoEngineOutputData#getOutput(70f044a2b285ce3f).(engineCopy, outputIndex));
1124 }
1125
1126 // Make sure state of connection is identical
1127 if (! fromField->isConnectionEnabledcxx . . $ SoField#isConnectionEnabled(455f465bc33b4cdf).())
1128 enableConnectioncxx . . $ SoField#enableConnection(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
1129 }
1130
1131 ////////////////////////////////////////////////////////////////////////
1132 //
1133 // Description:
1134 // Called by an instance to indicate that a value has changed. If
1135 // resetDefault is TRUE, this turns off default flag. Initiates
1136 // notification to clear downstream dirty bits, and evaluates
1137 // (after protecting the value in the field) to clear upstream
1138 // dirty bits.
1139 //
1140 // Use: protected
1141
1142 void
1143 SoFieldcxx . . $ SoField#::valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).(SbBoolcxx . . $ SbBool# resetDefault) // Default is TRUE
1144 //
1145 ////////////////////////////////////////////////////////////////////////
1146 {
1147 if (resetDefault)
1148 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
1149
1150 flagscxx . . $ SoField#flags..readOnlycxx . . $ SoField#$anonymous_type_0#readOnly. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1151 flagscxx . . $ SoField#flags..dirtycxx . . $ SoField#$anonymous_type_0#dirty. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; // So notification WILL happen, at least as
1152 // far as sensors/field container
1153 startNotifycxx . . $ SoField#startNotify(49f6e7a06ebc5aa8).();
1154 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
1155 flagscxx . . $ SoField#flags..readOnlycxx . . $ SoField#$anonymous_type_0#readOnly. = !flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled.;
1156 }
1157
1158 ////////////////////////////////////////////////////////////////////////
1159 //
1160 // Description:
1161 // Really disconnects the field from whatever it's connected to.
1162 //
1163 // Use: private
1164
1165 void
1166 SoFieldcxx . . $ SoField#::reallyDisconnectcxx . . $ SoField#reallyDisconnect(49f6e7a06ebc5aa8).()
1167 //
1168 ////////////////////////////////////////////////////////////////////////
1169 {
1170 if (flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. || flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.) {
1171 SoEngineOutputcxx . . $ SoEngineOutput# *out = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.;
1172 out->removeConnectioncxx . . $ SoEngineOutput#removeConnection(6a35cc9f7090653f).(this);
1173 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1174 }
1175 else {
1176 SoFieldcxx . . $ SoField# *field = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.;
1177 field->removeAuditorcxx . . $ SoField#removeAuditor(83574029f67dcc4a).(this, SoNotReccxx . . $ SoNotRec#::FIELDcxx . . $ SoNotRec#FIELD.);
1178 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1179 }
1180 flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1181 flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1182 }
1183
1184 ////////////////////////////////////////////////////////////////////////
1185 //
1186 // Description:
1187 // Evaluates the field or engine the field is connected to,
1188 // storing the result in the field.
1189 //
1190 // Use: private
1191
1192 void
1193 SoFieldcxx . . $ SoField#::evaluateConnectioncxx . . $ SoField#evaluateConnection(83f5f38750778ac8).() const
1194 //
1195 ////////////////////////////////////////////////////////////////////////
1196 {
1197 // Cast away the nasty const...
1198 SoFieldcxx . . $ SoField# *f = (SoFieldcxx . . $ SoField# *) this;
1199 f->flagscxx . . $ SoField#flags..dirtycxx . . $ SoField#$anonymous_type_0#dirty. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!; // This must be done before upstream
1200 // evaluation to break evaluation cycles.
1201
1202 if (flagscxx . . $ SoField#flags..isEngineModifyingcxx . . $ SoField#$anonymous_type_0#isEngineModifying. ||
1203 !flagscxx . . $ SoField#flags..connectedcxx . . $ SoField#$anonymous_type_0#connected. || !flagscxx . . $ SoField#flags..connectionEnabledcxx . . $ SoField#$anonymous_type_0#connectionEnabled.) return;
1204
1205 // If connected to an engine, evaluate that engine. This will
1206 // cause the value to be written into the field by the engine.
1207 if (flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. || flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.) {
1208
1209 SoEnginecxx . . $ SoEngine# *e =
1210 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
1211 e->evaluateWrappercxx . . $ SoEngine#evaluateWrapper(49f6e7a06ebc5aa8).();
1212 }
1213
1214 // If connected to a field, just copy the value from that field
1215 // UNLESS the readOnly bit is set.
1216 // This uses the virtual "=" operator, which should do the right thing.
1217 else if (!f->isReadOnlycxx . . $ SoField#isReadOnly(455f465bc33b4cdf).()) {
1218 // Disable notification since we already did it
1219 SbBoolcxx . . $ SbBool# notifySave = f->flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled.;
1220 f->flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1221
1222 // Copy value
1223 f->copyFromcxx . . $ SoField#copyFrom(cf274881b46fe863).(*auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.);
1224
1225 // Reenable notification
1226 f->flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = notifySave;
1227 }
1228 }
1229
1230 ////////////////////////////////////////////////////////////////////////
1231 //
1232 // Description:
1233 // Creates a converter engine to convert from the given field
1234 // type to the type of this field. Returns NULL on error.
1235 //
1236 // Use: private
1237
1238 SoFieldConvertercxx . . $ SoFieldConverter# *
1239 SoFieldcxx . . $ SoField#::createConvertercxx . . $ SoField#createConverter(b6ae65c6cffe55c9).(const SoTypecxx . . $ SoType# &fromFieldType) const
1240 //
1241 ////////////////////////////////////////////////////////////////////////
1242 {
1243 SoFieldConvertercxx . . $ SoFieldConverter# *converter;
1244
1245 // Find the type of the conversion engine (if any)
1246 SoTypecxx . . $ SoType# converterType = SoDBcxx . . $ SoDB#::getConvertercxx . . $ SoDB#getConverter(52f15c28be84d1bd).(fromFieldType, getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).());
1247
1248 // If no engine exists for these types, don't connect
1249 if (converterType.isBadcxx . . $ SoType#isBad(455f465bc33b4cdf).()) {
1250
1251 #ifdef DEBUG
1252 const char *fromName = fromFieldType.getName().getString();
1253 SoDebugError::post("SoField::connectFrom",
1254 "Connection failed - no conversion supported "
1255 "for types (%s --> %s)",
1256 fromName, getTypeId().getName().getString());
1257 #endif /* DEBUG */
1258 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1259 }
1260
1261 // If there is a converter, instantiate it and link it in
1262 converter = (SoFieldConvertercxx . . $ SoFieldConverter# *) converterType.createInstancecxx . . $ SoType#createInstance(45a5c5ac6be858a8).();
1263
1264 #ifdef DEBUG
1265 // If it's an abstract class, error. This should never happen.
1266 if (converter == NULL)
1267 SoDebugError::post("SoField::connectFrom",
1268 "Connection failed - unable to create an "
1269 "instance of \"%s\" converter",
1270 converterType.getName().getString());
1271 #endif /* DEBUG */
1272
1273 return converter;
1274 }
1275
1276 ////////////////////////////////////////////////////////////////////////
1277 //
1278 // Description:
1279 // Reads field from file. Works for ASCII and binary input. The
1280 // name of the field has already been read and is passed here (for
1281 // error messages).
1282 //
1283 // Use: private
1284
1285 SbBoolcxx . . $ SbBool#
1286 SoFieldcxx . . $ SoField#::readcxx . . $ SoField#read(82f62b5975549baa).(SoInputcxx . . $ SoInput# *in, const SbNamecxx . . $ SbName# &name)
1287 //
1288 ////////////////////////////////////////////////////////////////////////
1289 {
1290 char c;
1291 SbBoolcxx . . $ SbBool# shouldReadConnection = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1292 SbBoolcxx . . $ SbBool# gotValue = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1293
1294 // Turn off notification during reading process. It is turned
1295 // back on and notification is started below:
1296 SbBoolcxx . . $ SbBool# wasNotifyEnabled = flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled.;
1297 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1298
1299 if (in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).()) {
1300 short readFlags;
1301
1302 if (! readValuecxx . . $ SoField#readValue(cfb31f743f00c8ca).(in)) {
1303 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
1304 "Couldn't read binary value for field \"%s\"",
1305 name.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1306 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = wasNotifyEnabled;
1307 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1308 }
1309
1310 // Read flags
1311 if (! in->readcxx . . $ SoInput#read(8057bae4a2079318).(readFlags)) {
1312 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
1313 "Couldn't read binary flags for field \"%s\"",
1314 name.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1315 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = wasNotifyEnabled;
1316 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1317 }
1318
1319 // (Don't use setIgnored() to set this, since it would cause
1320 // notification, which we don't want to have happen for trigger
1321 // fields.)
1322 flagscxx . . $ SoField#flags..ignoredcxx . . $ SoField#$anonymous_type_0#ignored. = (readFlags & FIELD_IGNOREDcxx . . $ `lib/database/src/so/fields/SoField.c++:82:9`!) != 0;
1323 shouldReadConnection = (readFlags & FIELD_CONNECTEDcxx . . $ `lib/database/src/so/fields/SoField.c++:83:9`!) != 0;
1324 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).((readFlags & FIELD_DEFAULTcxx . . $ `lib/database/src/so/fields/SoField.c++:84:9`!) != 0);
1325 gotValue = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1326 }
1327
1328 // ASCII version...
1329 else {
1330 // Check for ignore flag with no value
1331 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c) && c == IGNORE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:77:9`!) {
1332 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
1333 setIgnoredcxx . . $ SoField#setIgnored(d4f767463ce0a6b3).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
1334
1335 // Check for connection to engine/field
1336 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c) && c == CONNECTION_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:78:9`!)
1337 shouldReadConnection = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1338 else
1339 in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
1340 gotValue = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1341 }
1342
1343 else {
1344 setIgnoredcxx . . $ SoField#setIgnored(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
1345
1346 // If character is connection character, we just use the
1347 // default value and skip the reading-value stuff
1348 if (c != CONNECTION_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:78:9`!) {
1349 in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
1350
1351 if (! readValuecxx . . $ SoField#readValue(cfb31f743f00c8ca).(in)) {
1352 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
1353 "Couldn't read value for field \"%s\"",
1354 name.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1355 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = wasNotifyEnabled;
1356 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1357 }
1358
1359 gotValue = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1360 setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
1361
1362 // Check for ignore flag after value
1363 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c) && c == IGNORE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:77:9`!) {
1364 // (Don't use setIgnored() to set this, since it
1365 // would cause notification, which we don't want
1366 // to have happen for trigger fields.)
1367 flagscxx . . $ SoField#flags..ignoredcxx . . $ SoField#$anonymous_type_0#ignored. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1368
1369 // Get character to check for connection to
1370 // engine/field below.
1371 in->readcxx . . $ SoInput#read(9adc86e50523a208).(c);
1372 }
1373 } else {
1374 gotValue = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1375 }
1376
1377 // Check for connection to engine/field
1378 if (c == CONNECTION_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:78:9`!)
1379 shouldReadConnection = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1380 else
1381 in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
1382 }
1383 }
1384
1385 // Read connection info if necessary.
1386 if (shouldReadConnection && !readConnectioncxx . . $ SoField#readConnection(cfb31f743f00c8ca).(in)) {
1387 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = wasNotifyEnabled;
1388 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1389 }
1390
1391 // Turn notification back the way it was:
1392 flagscxx . . $ SoField#flags..notifyEnabledcxx . . $ SoField#$anonymous_type_0#notifyEnabled. = wasNotifyEnabled;
1393
1394 // If a value was read (even if there's a connection), call
1395 // valueChanged. Otherwise, just notify.
1396 if (gotValue) {
1397 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
1398 } else {
1399 startNotifycxx . . $ SoField#startNotify(49f6e7a06ebc5aa8).();
1400 }
1401
1402 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1403 }
1404
1405 ////////////////////////////////////////////////////////////////////////
1406 //
1407 // Description:
1408 // Reads field connection from file. Works for ASCII and binary
1409 // input. Returns FALSE on error. The upstream connection is
1410 // evaluated before connecting so we don't end up with dirty fields
1411 // upstream from clean ones (fields are clean once they've been
1412 // read).
1413 //
1414 // Use: private
1415
1416 SbBoolcxx . . $ SbBool#
1417 SoFieldcxx . . $ SoField#::readConnectioncxx . . $ SoField#readConnection(cfb31f743f00c8ca).(SoInputcxx . . $ SoInput# *in)
1418 //
1419 ////////////////////////////////////////////////////////////////////////
1420 {
1421 SoFieldContainercxx . . $ SoFieldContainer# *connContainer;
1422 SbNamecxx . . $ SbName# fieldNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).;
1423 SbBoolcxx . . $ SbBool# gotChar;
1424 char c;
1425
1426 // The field is connected to either an engine output or to a field
1427 // of an engine or node. First, read the node or engine as a base.
1428 SoBasecxx . . $ SoBase# *baseTemp;
1429 if (! SoBasecxx . . $ SoBase#::readcxx . . $ SoBase#read(56c2a128ec952e80).(in, baseTemp, SoFieldContainercxx . . $ SoFieldContainer#::getClassTypeIdcxx . . $ SoFieldContainer#getClassTypeId(c00c150378d2b968).()))
1430 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1431
1432 if (baseTemp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1433 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Missing node or engine name in "
1434 "connection specification");
1435 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1436 }
1437
1438 connContainer = (SoFieldContainercxx . . $ SoFieldContainer# *) baseTemp;
1439
1440 // Read the field separator character (ASCII only)
1441 if (! in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).() &&
1442 (! (gotChar = in->readcxx . . $ SoInput#read(9adc86e50523a208).(c)) || c != FIELD_SEP_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:79:9`!)) {
1443
1444 if (gotChar)
1445 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Expected '%c'; got '%c'",
1446 FIELD_SEP_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:79:9`!, c);
1447 else
1448 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Expected '%c'; got EOF", FIELD_SEP_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:79:9`!);
1449
1450 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1451 }
1452
1453 // Read the field name or output name
1454 if (! in->readcxx . . $ SoInput#read(9a8a621633966675).(fieldName, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!)) {
1455 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
1456 "Premature end of file before connection was read");
1457 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1458 }
1459
1460 // If the base is a node, make sure the field name is valid and
1461 // then connect to it.
1462 if (connContainer->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoNodecxx . . $ SoNode#::getClassTypeIdcxx . . $ SoNode#getClassTypeId(c00c150378d2b968).())) {
1463 SoNodecxx . . $ SoNode# *node = (SoNodecxx . . $ SoNode# *) connContainer;
1464 SoFieldcxx . . $ SoField# *connField;
1465
1466 connField = node->getFieldcxx . . $ SoFieldContainer#getField(c5cb3b179879bcd).(fieldName);
1467
1468 if (connField == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1469 const char *nodeName = node->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).().getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).();
1470 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "No such field \"%s\" in node %s",
1471 fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).(), nodeName);
1472 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1473 }
1474
1475 if (! connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(connField)) {
1476 const char *nodeName = node->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).().getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).();
1477 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Can't connect to field \"%s.%s\"",
1478 nodeName, fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1479 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1480 }
1481 }
1482
1483 // If the base is an engine, make sure the name is a valid field
1484 // or output and then connect to it
1485 else if (connContainer->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoEnginecxx . . $ SoEngine#::getClassTypeIdcxx . . $ SoEngine#getClassTypeId(c00c150378d2b968).())) {
1486 SoEnginecxx . . $ SoEngine# *engine = (SoEnginecxx . . $ SoEngine# *) connContainer;
1487 SoFieldcxx . . $ SoField# *connField;
1488 SoEngineOutputcxx . . $ SoEngineOutput# *connOutput;
1489
1490 connField = engine->getFieldcxx . . $ SoFieldContainer#getField(c5cb3b179879bcd).(fieldName);
1491
1492 if (connField == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1493
1494 // See if it's an output
1495 connOutput = engine->getOutputcxx . . $ SoEngine#getOutput(52e7227d05be6108).(fieldName);
1496
1497 if (connOutput == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
1498 const char *eName = engine->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).().getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).();
1499 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "No such field or output \"%s\" "
1500 "in engine %s",
1501 fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).(), eName);
1502 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1503 }
1504
1505 if (! connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(connOutput)) {
1506 const char *eName = engine->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).().getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).();
1507 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
1508 "Can't connect to engine output \"%s.%s\"",
1509 eName, fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1510 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1511 }
1512 }
1513 else {
1514 if (! connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(connField)) {
1515 const char *eName = engine->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).().getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).();
1516 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Can't connect to field \"%s.%s\"",
1517 eName, fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1518 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1519 }
1520 }
1521 }
1522
1523 // If it is a global field...
1524 else if (connContainer->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoGlobalFieldcxx . . $ SoGlobalField#::getClassTypeIdcxx . . $ SoGlobalField#getClassTypeId(c00c150378d2b968).())) {
1525
1526 SoGlobalFieldcxx . . $ SoGlobalField# *gf = (SoGlobalFieldcxx . . $ SoGlobalField# *) connContainer;
1527 SoFieldcxx . . $ SoField# *connField = gf->getMyFieldcxx . . $ SoGlobalField#getMyField(c4a4d937024b6702).();
1528
1529 // Make sure the name in the input is the name of the global field
1530 if (fieldName !=cxx . . $ `operator!=`(edde533be586f7a2). gf->getNamecxx . . $ SoGlobalField#getName(a4a84af177c3b6e7).()) {
1531 const char *globalName = gf->getNamecxx . . $ SoGlobalField#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).();
1532 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Wrong field name (\"%s\") for global "
1533 "field \"%s\"",
1534 fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).(), globalName);
1535 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1536 }
1537
1538 if (! connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(connField)) {
1539 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Can't connect to global field \"%s\"",
1540 gf->getNamecxx . . $ SoGlobalField#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1541 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1542 }
1543 }
1544
1545 // If it's not a node, engine or global field, problem
1546 else {
1547 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Trying to connect to a %s",
1548 connContainer->getTypeIdcxx . . $ SoBase#getTypeId(70775439ff16cb15).().getNamecxx . . $ SoType#getName(a4a84af177c3b6e7).().getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1549 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1550 }
1551
1552 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
1553 }
1554
1555 ////////////////////////////////////////////////////////////////////////
1556 //
1557 // Description:
1558 // Writes field to file. Works for ASCII and binary output. May be
1559 // called for either stage of writing.
1560 //
1561 // Use: internal
1562
1563 void
1564 SoFieldcxx . . $ SoField#::writecxx . . $ SoField#write(5afc3f6978105403).(SoOutputcxx . . $ SoOutput# *out, const SbNamecxx . . $ SbName# &name) const
1565 //
1566 ////////////////////////////////////////////////////////////////////////
1567 {
1568 if (out->getStagecxx . . $ SoOutput#getStage(951fc68f69ba3c5a).() == SoOutputcxx . . $ SoOutput#::COUNT_REFScxx . . $ SoOutput#COUNT_REFS.)
1569 countWriteRefscxx . . $ SoField#countWriteRefs(58762e0f79576b7c).(out);
1570
1571 else {
1572 // Actually write the field
1573 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
1574
1575 SbBoolcxx . . $ SbBool# writeConn = isConnectedcxx . . $ SoField#isConnected(455f465bc33b4cdf).() && isConnectionEnabledcxx . . $ SoField#isConnectionEnabled(455f465bc33b4cdf).();
1576
1577 // We should write a field-to-field connection if one exists
1578 // and the container at the other end should be written
1579 if (writeConn && isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).()) {
1580 SoFieldcxx . . $ SoField# *field;
1581 getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(field);
1582 SoFieldContainercxx . . $ SoFieldContainer# *container = field->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
1583 if (container == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || ! container->shouldWritecxx . . $ SoBase#shouldWrite(b126dc7c1de90089).())
1584 writeConn = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
1585 }
1586
1587 if (out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
1588 short flags = 0;
1589
1590 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(name.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1591 writeValuecxx . . $ SoField#writeValue(58762e0f79576b7c).(out);
1592
1593 if (isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).())
1594 flags |= FIELD_IGNOREDcxx . . $ `lib/database/src/so/fields/SoField.c++:82:9`!;
1595 if (writeConn)
1596 flags |= FIELD_CONNECTEDcxx . . $ `lib/database/src/so/fields/SoField.c++:83:9`!;
1597 if (isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).())
1598 flags |= FIELD_DEFAULTcxx . . $ `lib/database/src/so/fields/SoField.c++:84:9`!;
1599
1600 out->writecxx . . $ SoOutput#write(68e3ae50fe6578a9).(flags);
1601
1602 // Recurse on connected stuff if necessary
1603 if (writeConn)
1604 writeConnectioncxx . . $ SoField#writeConnection(58762e0f79576b7c).(out);
1605 }
1606
1607 // Only write out IF connected, not default, or ignored:
1608 else if (writeConn || !isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).() || isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).()) {
1609 out->indentcxx . . $ SoOutput#indent(49f6e7a06ebc5aa8).();
1610 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(name.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1611 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(out->isCompactcxx . . $ SoOutput#isCompact(455f465bc33b4cdf).() ? ' ' : '\t');
1612
1613 if (! isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).())
1614 writeValuecxx . . $ SoField#writeValue(58762e0f79576b7c).(out);
1615
1616 if (isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).()) {
1617 if (! isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).())
1618 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
1619 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(IGNORE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:77:9`!);
1620 }
1621
1622 // Recurse on connected stuff if necessary
1623 if (writeConn)
1624 writeConnectioncxx . . $ SoField#writeConnection(58762e0f79576b7c).(out);
1625
1626 // Annotate if necessary
1627 if (out->getAnnotationcxx . . $ SoOutput#getAnnotation(db52760e79bf9054).() & SoOutputcxx . . $ SoOutput#::ADDRESSEScxx . . $ SoOutput#ADDRESSES.) {
1628 char buf[100];
1629 sprintf(buf, " # %p", this);
1630 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(buf);
1631 }
1632 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(out->isCompactcxx . . $ SoOutput#isCompact(455f465bc33b4cdf).() ? ' ' : '\n');
1633 }
1634 }
1635 }
1636
1637 ////////////////////////////////////////////////////////////////////////
1638 //
1639 // Description:
1640 // Counts write-references on field to prepare for writing.
1641 //
1642 // Use: internal
1643
1644 void
1645 SoFieldcxx . . $ SoField#::countWriteRefscxx . . $ SoField#countWriteRefs(58762e0f79576b7c).(SoOutputcxx . . $ SoOutput# *out) const
1646 //
1647 ////////////////////////////////////////////////////////////////////////
1648 {
1649 if (! isConnectedcxx . . $ SoField#isConnected(455f465bc33b4cdf).())
1650 return;
1651
1652 // If we are connected from an engine output, add a reference
1653 // to that engine
1654 if (flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine. || flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.) {
1655 // We can't use getConnectedEngine() here because we want to
1656 // make sure we get the field converter if we're connected to one
1657 SoEnginecxx . . $ SoEngine# *container =
1658 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
1659 if (container != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1660 container->addWriteReferencecxx . . $ SoFieldContainer#addWriteReference(ef4b98cc8eef533a).(out);
1661 }
1662
1663 // If we are connected from another field, add a reference to
1664 // the field's container, but mark it as having come from a
1665 // field-to-field connection
1666 else {
1667 SoFieldcxx . . $ SoField# *field;
1668 getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(field);
1669 SoFieldContainercxx . . $ SoFieldContainer# *container = field->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
1670 if (container != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
1671 container->addWriteReferencecxx . . $ SoFieldContainer#addWriteReference(ef4b98cc8eef533a).(out, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
1672 }
1673 }
1674
1675 ////////////////////////////////////////////////////////////////////////
1676 //
1677 // Description:
1678 // Writes field connection to file. Works for ASCII and binary
1679 // output. This is called only for the last stage of writing.
1680 //
1681 // Use: private
1682
1683 void
1684 SoFieldcxx . . $ SoField#::writeConnectioncxx . . $ SoField#writeConnection(58762e0f79576b7c).(SoOutputcxx . . $ SoOutput# *out) const
1685 //
1686 ////////////////////////////////////////////////////////////////////////
1687 {
1688 SoFieldContainercxx . . $ SoFieldContainer# *container;
1689 SbNamecxx . . $ SbName# fieldNamecxx . . $ SbName#SbName(49f6e7a06ebc5aa8).;
1690
1691 // Write out connection character (ASCII only)
1692 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
1693 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
1694 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(CONNECTION_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:78:9`!);
1695 if (out->getAnnotationcxx . . $ SoOutput#getAnnotation(db52760e79bf9054).()&SoOutputcxx . . $ SoOutput#::ADDRESSEScxx . . $ SoOutput#ADDRESSES.) {
1696 char buf[100];
1697 sprintf(buf, " # %p", this);
1698 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(buf);
1699 }
1700 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).('\n');
1701 }
1702
1703 // Base will be indented a little more
1704 out->incrementIndentcxx . . $ SoOutput#incrementIndent(d4f767463ce0a6b3).();
1705
1706 getConnectionInfocxx . . $ SoField#getConnectionInfo(cc1be62b11e68811).(container, fieldName);
1707
1708 // Recurse on container (node, engine, or global field)
1709 container->writeInstancecxx . . $ SoFieldContainer#writeInstance(46d85c4d426f339d).(out);
1710
1711 // Write out separator character (ASCII only)
1712 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
1713 out->indentcxx . . $ SoOutput#indent(49f6e7a06ebc5aa8).();
1714 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(FIELD_SEP_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:79:9`!);
1715 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
1716 }
1717
1718 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).());
1719
1720 if (out->getAnnotationcxx . . $ SoOutput#getAnnotation(db52760e79bf9054).()&SoOutputcxx . . $ SoOutput#::ADDRESSEScxx . . $ SoOutput#ADDRESSES.) {
1721 char buf[100];
1722 void *ptr;
1723
1724 if (flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine.) {
1725 SoEngineOutputcxx . . $ SoEngineOutput# *eo;
1726 getConnectedEnginecxx . . $ SoField#getConnectedEngine(d90a32d7bcd50feb).(eo);
1727 ptr = eo;
1728 }
1729 else {
1730 SoFieldcxx . . $ SoField# *f;
1731 getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(f);
1732 ptr = f;
1733 }
1734 sprintf(buf, " # %p", ptr);
1735 out->writecxx . . $ SoOutput#write(85c52e162fed56f9).(buf);
1736 }
1737
1738 if (! out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).())
1739 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).('\n');
1740
1741 // Base was indented
1742 out->decrementIndentcxx . . $ SoOutput#decrementIndent(d4f767463ce0a6b3).();
1743 }
1744
1745 ////////////////////////////////////////////////////////////////////////
1746 //
1747 // Description:
1748 // Utility function that returns converter through which this field
1749 // is connected.
1750 //
1751 // Use: private
1752
1753 SoFieldConvertercxx . . $ SoFieldConverter# *
1754 SoFieldcxx . . $ SoField#::getConvertercxx . . $ SoField#getConverter(b8f62a99f8ebc4d1).() const
1755 {
1756 return (SoFieldConvertercxx . . $ SoFieldConverter# *)
1757 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
1758 }
1759
1760 ////////////////////////////////////////////////////////////////////////
1761 //
1762 // Description:
1763 // This is a utility function that determines what a field is
1764 // connected from. Transparently skips over field converter engines,
1765 // so it reconstructs the original connection that was specified.
1766 //
1767 // Use: private
1768
1769 void
1770 SoFieldcxx . . $ SoField#::getConnectionInfocxx . . $ SoField#getConnectionInfo(cc1be62b11e68811).(SoFieldContainercxx . . $ SoFieldContainer# *&container,
1771 SbNamecxx . . $ SbName# &fieldName) const
1772 {
1773 // If it's connected through a converter, recurse
1774 if (flagscxx . . $ SoField#flags..convertedcxx . . $ SoField#$anonymous_type_0#converted.)
1775 getConvertercxx . . $ SoField#getConverter(b8f62a99f8ebc4d1).()->getConnectedInputcxx . . $ SoFieldConverter#getConnectedInput(50d976c2de78a9be).()->getConnectionInfocxx . . $ SoField#getConnectionInfo(cc1be62b11e68811).(container,
1776 fieldName);
1777
1778 // Field-to-field connection?
1779 else if (! flagscxx . . $ SoField#flags..fromEnginecxx . . $ SoField#$anonymous_type_0#fromEngine.) {
1780 container = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field.->getContainercxx . . $ SoField#getContainer(5859c5f6d4d84439).();
1781 container->getFieldNamecxx . . $ SoFieldContainer#getFieldName(de53f3b873e9d1c7).(auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..fieldcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#field., fieldName);
1782 return;
1783 }
1784
1785 // It's an engine.
1786 else {
1787 container = auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput.->getContainercxx . . $ SoEngineOutput#getContainer(f580b99ec5c3a76a).();
1788 ((SoEnginecxx . . $ SoEngine# *) container)->getOutputNamecxx . . $ SoEngine#getOutputName(9c15ab52ffe28b7b).(
1789 auditorInfocxx . . $ SoField#$anonymous_type_1#auditorInfo.->connectioncxx . . $ SoFieldAuditorInfo#connection..engineOutputcxx . . $ SoFieldAuditorInfo#$anonymous_type_0#engineOutput., fieldName);
1790 }
1791 }
1792
1793 ////////////////////////////////////////////////////////////////////////
1794 //
1795 // Description:
1796 // This is a callback function passed to SoOutput::setBuffer() by
1797 // SoField::get(). It is used to reallocate the buffer in which the
1798 // returned field info string is stored. Since we need to keep
1799 // track of the pointer to the buffer and its size, we can't just
1800 // call realloc() instead.
1801 //
1802 // Use: private, static
1803
1804 void *
1805 SoFieldcxx . . $ SoField#::reallocFieldBufcxx . . $ SoField#reallocFieldBuf(417ab160f6baadc6).(void *ptr, size_t newSize)
1806 //
1807 ////////////////////////////////////////////////////////////////////////
1808 {
1809 fieldBufcxx . . $ SoField#fieldBuf. = (char *) realloc(ptr, newSize);
1810 fieldBufSizecxx . . $ SoField#fieldBufSize. = newSize;
1811
1812 return fieldBufcxx . . $ SoField#fieldBuf.;
1813 }
1814
1815 //////////////////////////////////////////////////////////////////////////////
1816 //
1817 // Class: SoSField
1818 //
1819 // Single-valued fields
1820 //
1821 //////////////////////////////////////////////////////////////////////////////
1822
1823 SoTypecxx . . $ SoType# SoSFieldcxx . . $ SoSField#::classTypeIdcxx . . $ SoSField#classTypeId.;
1824
1825 ////////////////////////////////////////////////////////////////////////
1826 //
1827 // Description:
1828 // Initializes the SoSField class.
1829 //
1830 // Use: internal
1831
1832 void
1833 SoSFieldcxx . . $ SoSField#::initClasscxx . . $ SoSField#initClass(49f6e7a06ebc5aa8).()
1834 //
1835 ////////////////////////////////////////////////////////////////////////
1836 {
1837 SO__FIELD_INIT_CLASScxx . . $ `lib/database/include/Inventor/fields/SoSubField.h:177:9`!(SoSField, "SField", SoField);
1838 }
1839
1840 ////////////////////////////////////////////////////////////////////////
1841 //
1842 // Description:
1843 // Destructor.
1844 //
1845 // Use: public
1846
1847 SoSFieldcxx . . $ SoSField#::~cxx . . $ SoSField#`~SoSField`(49f6e7a06ebc5aa8).SoSFieldcxx . . $ SoSField#()
1848 //
1849 ////////////////////////////////////////////////////////////////////////
1850 {
1851 }
1852
1853 ////////////////////////////////////////////////////////////////////////
1854 //
1855 // Description:
1856 // Use by SoType::createInstance; in this case, return NULL, since
1857 // this is an abstract type that has no instances...
1858 //
1859 // Use: public
1860
1861 void *
1862 SoSFieldcxx . . $ SoSField#::createInstancecxx . . $ SoSField#createInstance(50c7df7de5344ebb).()
1863 //
1864 ////////////////////////////////////////////////////////////////////////
1865 {
1866 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1867 }
1868
1869 ////////////////////////////////////////////////////////////////////////
1870 //
1871 // Description:
1872 // Constructor - keeps subclass constructors from being too complex
1873 // for poor old C++.
1874 //
1875 // Use: protected
1876
1877 SoSFieldcxx . . $ SoSField#::SoSFieldcxx . . $ SoSField#SoSField(49f6e7a06ebc5aa8).()
1878 //
1879 ////////////////////////////////////////////////////////////////////////
1880 {
1881 }
1882
1883 //////////////////////////////////////////////////////////////////////////////
1884 //
1885 // Class: SoMField
1886 //
1887 // Multiple-valued fields
1888 //
1889 //////////////////////////////////////////////////////////////////////////////
1890
1891 char *SoMFieldcxx . . $ SoMField#::fieldBufcxx . . $ SoMField#fieldBuf.; // Used by SoMField::get1()
1892 int SoMFieldcxx . . $ SoMField#::fieldBufSizecxx . . $ SoMField#fieldBufSize.; // Used by SoMField::get1()
1893 SoTypecxx . . $ SoType# SoMFieldcxx . . $ SoMField#::classTypeIdcxx . . $ SoMField#classTypeId.;
1894
1895 ////////////////////////////////////////////////////////////////////////
1896 //
1897 // Description:
1898 // Initializes the SoMField class.
1899 //
1900 // Use: internal
1901
1902 void
1903 SoMFieldcxx . . $ SoMField#::initClasscxx . . $ SoMField#initClass(49f6e7a06ebc5aa8).()
1904 //
1905 ////////////////////////////////////////////////////////////////////////
1906 {
1907 SO__FIELD_INIT_CLASScxx . . $ `lib/database/include/Inventor/fields/SoSubField.h:177:9`!(SoMField, "MField", SoField);
1908 }
1909
1910 ////////////////////////////////////////////////////////////////////////
1911 //
1912 // Description:
1913 // Destructor.
1914 //
1915 // Use: public
1916
1917 SoMFieldcxx . . $ SoMField#::~cxx . . $ SoMField#`~SoMField`(49f6e7a06ebc5aa8).SoMFieldcxx . . $ SoMField#()
1918 //
1919 ////////////////////////////////////////////////////////////////////////
1920 {
1921 }
1922
1923 ////////////////////////////////////////////////////////////////////////
1924 //
1925 // Description:
1926 // Use by SoType::createInstance; in this case, return NULL, since
1927 // this is an abstract type that has no instances...
1928 //
1929 // Use: public
1930
1931 void *
1932 SoMFieldcxx . . $ SoMField#::createInstancecxx . . $ SoMField#createInstance(50c7df7de5344ebb).()
1933 //
1934 ////////////////////////////////////////////////////////////////////////
1935 {
1936 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
1937 }
1938
1939 ////////////////////////////////////////////////////////////////////////
1940 //
1941 // Description:
1942 // Constructor
1943 //
1944 // Use: protected
1945
1946 SoMFieldcxx . . $ SoMField#::SoMFieldcxx . . $ SoMField#SoMField(49f6e7a06ebc5aa8).()
1947 //
1948 ////////////////////////////////////////////////////////////////////////
1949 {
1950 maxNumcxx . . $ SoMField#maxNum. = numcxx . . $ SoMField#num. = 0;
1951 }
1952
1953 ////////////////////////////////////////////////////////////////////////
1954 //
1955 // Description:
1956 // Inserts or deletes values to adjust to the given size
1957 //
1958 // Use: public
1959
1960 void
1961 SoMFieldcxx . . $ SoMField#::setNumcxx . . $ SoMField#setNum(d4f767463ce0a6b3).(int n)
1962 {
1963 if (n > numcxx . . $ SoMField#num.)
1964 insertSpacecxx . . $ SoMField#insertSpace(3e454b8ccf442868).(numcxx . . $ SoMField#num., n-numcxx . . $ SoMField#num.);
1965 else if (n < numcxx . . $ SoMField#num.)
1966 deleteValuescxx . . $ SoMField#deleteValues(3e454b8ccf442868).(n);
1967 }
1968
1969
1970 ////////////////////////////////////////////////////////////////////////
1971 //
1972 // Description:
1973 // Deletes num values starting at index start. A num of -1 (the default)
1974 // means delete all values after start, inclusive.
1975 //
1976 // Use: public
1977
1978 void
1979 SoMFieldcxx . . $ SoMField#::deleteValuescxx . . $ SoMField#deleteValues(3e454b8ccf442868).(int start, // Starting index
1980 int numToDelete) // Number of values to delete
1981 //
1982 ////////////////////////////////////////////////////////////////////////
1983 {
1984 int lastToCopy, i;
1985
1986 if (numToDelete < 0)
1987 numToDelete = getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() - start;
1988
1989 // Special case of deleting all values
1990 if (numToDelete == getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).())
1991 deleteAllValuescxx . . $ SoMField#deleteAllValues(49f6e7a06ebc5aa8).();
1992
1993 else {
1994 // Copy from the end of the array to the middle
1995 lastToCopy = (getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() - 1) - numToDelete;
1996 for (i = start; i <= lastToCopy; i++)
1997 copyValuecxx . . $ SoMField#copyValue(3e454b8ccf442868).(i, i + numToDelete);
1998
1999 // Truncate the array
2000 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() - numToDelete);
2001 }
2002
2003 // The field value has changed...
2004 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).();
2005 }
2006
2007 ////////////////////////////////////////////////////////////////////////
2008 //
2009 // Description:
2010 // Inserts space for num values starting at start. The initial
2011 // values in the new space are undefined.
2012 //
2013 // Use: public
2014
2015 void
2016 SoMFieldcxx . . $ SoMField#::insertSpacecxx . . $ SoMField#insertSpace(3e454b8ccf442868).(int start, // Starting index
2017 int numToInsert) // Number of spaces to insert
2018 //
2019 ////////////////////////////////////////////////////////////////////////
2020 {
2021 // Expand the array
2022 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() + numToInsert);
2023
2024 // Copy stuff out of the inserted area to later in the array
2025 for (int i = numcxx . . $ SoMField#num. - 1; i >= start + numToInsert; --i)
2026 copyValuecxx . . $ SoMField#copyValue(3e454b8ccf442868).(i, i - numToInsert);
2027
2028 // The field value has changed...
2029 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).();
2030 }
2031
2032 ////////////////////////////////////////////////////////////////////////
2033 //
2034 // Description:
2035 // This is equivalent to the SoField::set() method, but operates on
2036 // only the value given by the index.
2037 //
2038 // Use: public
2039
2040 SbBoolcxx . . $ SbBool#
2041 SoMFieldcxx . . $ SoMField#::set1cxx . . $ SoMField#set1(95e580389a7cc305).(int index, const char *valueString)
2042 //
2043 ////////////////////////////////////////////////////////////////////////
2044 {
2045 SoInputcxx . . $ SoInput# incxx . . $ SoInput#SoInput(49f6e7a06ebc5aa8).;
2046 in.setBuffercxx . . $ SoInput#setBuffer(5500c4293b1bbef0).((void *) valueString, strlen(valueString));
2047
2048 if (read1Valuecxx . . $ SoMField#read1Value(b57125c54eeea43).(&in, index)) {
2049
2050 // We have to do this here because read1Value() doesn't
2051 // indicate that values have changed, since it's usually used
2052 // in a larger reading context.
2053 valueChangedcxx . . $ SoField#valueChanged(d4f767463ce0a6b3).();
2054
2055 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
2056 }
2057 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2058 }
2059
2060 ////////////////////////////////////////////////////////////////////////
2061 //
2062 // Description:
2063 // This is equivalent to the SoField::get() method, but operates on
2064 // only the value given by the index.
2065 //
2066 // Use: public
2067
2068 void
2069 SoMFieldcxx . . $ SoMField#::get1cxx . . $ SoMField#get1(fb90e84487440997).(int index, SbStringcxx . . $ SbString# &valueString)
2070 //
2071 ////////////////////////////////////////////////////////////////////////
2072 {
2073 SoOutputcxx . . $ SoOutput# outcxx . . $ SoOutput#SoOutput(49f6e7a06ebc5aa8).;
2074
2075 // Make sure the field value is up to date
2076 evaluatecxx . . $ SoField#evaluate(83f5f38750778ac8).();
2077
2078 // Prepare a character buffer and SoOutput for writing field strings
2079 if (fieldBufSizecxx . . $ SoMField#fieldBufSize. == 0) {
2080 fieldBufSizecxx . . $ SoMField#fieldBufSize. = 1028;
2081 fieldBufcxx . . $ SoMField#fieldBuf. = (char *) malloc((unsigned) fieldBufSizecxx . . $ SoMField#fieldBufSize.);
2082 }
2083
2084 // Set up output into a string buffer
2085 out.setBuffercxx . . $ SoOutput#setBuffer(61c86ae95e149a18).((void *) fieldBufcxx . . $ SoMField#fieldBuf., fieldBufSizecxx . . $ SoMField#fieldBufSize., &SoMFieldcxx . . $ SoMField#::reallocFieldBufcxx . . $ SoMField#reallocFieldBuf(417ab160f6baadc6).);
2086
2087 // Make sure that the file header and lots of white space will NOT
2088 // be written into the string
2089 out.setCompactcxx . . $ SoOutput#setCompact(d4f767463ce0a6b3).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
2090
2091 // Write the data
2092 write1Valuecxx . . $ SoMField#write1Value(73cc401f7e0a390c).(&out, index);
2093
2094 // Make sure the string is terminated
2095 out.resetcxx . . $ SoOutput#reset(49f6e7a06ebc5aa8).();
2096
2097 // Store the result in the passed SbString
2098 valueString =cxx . . $ SbString#`operator=`(90e156a883234106). fieldBufcxx . . $ SoMField#fieldBuf.;
2099 }
2100
2101 ////////////////////////////////////////////////////////////////////////
2102 //
2103 // Description:
2104 // This makes sure there is enough memory allocated to hold
2105 // "newNum" values. It reallocates the values if necessary.
2106 //
2107 // Use: protected
2108
2109 void
2110 SoMFieldcxx . . $ SoMField#::makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(int newNum) // New number of values
2111 //
2112 ////////////////////////////////////////////////////////////////////////
2113 {
2114 // Allocate room to hold all values if necessary
2115 if (newNum != numcxx . . $ SoMField#num.) {
2116 allocValuescxx . . $ SoMField#allocValues(d4f767463ce0a6b3).(newNum);
2117 }
2118 }
2119
2120 ////////////////////////////////////////////////////////////////////////
2121 //
2122 // Description:
2123 // Reads all field values from file. Works for ASCII and binary
2124 // output. Binary values are read as a chunk.
2125 //
2126 // Use: private
2127
2128 SbBoolcxx . . $ SbBool#
2129 SoMFieldcxx . . $ SoMField#::readValuecxx . . $ SoMField#readValue(cfb31f743f00c8ca).(SoInputcxx . . $ SoInput# *in)
2130 //
2131 ////////////////////////////////////////////////////////////////////////
2132 {
2133 if (in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).()) {
2134 int numToRead;
2135
2136 // Read number of values
2137 if (! in->readcxx . . $ SoInput#read(795be11dee30bb15).(numToRead)) {
2138 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in, "Couldn't read number of binary values "
2139 "in multiple-value field");
2140 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2141 }
2142
2143 // Make space for values; also sets number of values
2144 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(numToRead);
2145
2146 // Read values
2147 if (! readBinaryValuescxx . . $ SoMField#readBinaryValues(b57125c54eeea43).(in, numToRead))
2148 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2149 }
2150
2151 else {
2152 char c;
2153 int curIndex = 0;
2154
2155 // Check for multiple field values
2156 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c) && c == OPEN_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:74:9`!) {
2157
2158 // Check for no values: just an open and close brace
2159 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c) && c == CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:75:9`!)
2160 ; // Do nothing now
2161
2162 else {
2163 in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
2164
2165 while (TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!) {
2166
2167 // Make some room at end if necessary
2168 if (curIndex >= getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).())
2169 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).() + VALUE_CHUNK_SIZEcxx . . $ `lib/database/src/so/fields/SoField.c++:87:9`!);
2170
2171 if (! read1Valuecxx . . $ SoMField#read1Value(b57125c54eeea43).(in, curIndex++) || ! in->readcxx . . $ SoInput#read(9adc86e50523a208).(c)) {
2172 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
2173 "Couldn't read value %d of field",
2174 curIndex);
2175 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2176 }
2177
2178 if (c == VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:76:9`!) {
2179
2180 // See if this is a trailing separator (right before
2181 // the closing brace). This is legal, but ignored.
2182
2183 if (in->readcxx . . $ SoInput#read(9adc86e50523a208).(c)) {
2184 if (c == CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:75:9`!)
2185 break;
2186 else
2187 in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
2188 }
2189 }
2190
2191 else if (c == CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:75:9`!)
2192 break;
2193
2194 else {
2195 SoReadErrorcxx . . $ SoReadError#::postcxx . . $ SoReadError#post(a08c53ae8c2fb13c).(in,
2196 "Expected '%c' or '%c' but got "
2197 "'%c' while reading value %d",
2198 VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:76:9`!,
2199 CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:75:9`!, c,
2200 curIndex);
2201 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2202 }
2203 }
2204 }
2205
2206 // If extra space left over, nuke it
2207 if (curIndex < getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).())
2208 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(curIndex);
2209 }
2210
2211 else {
2212 // Try reading 1 value
2213 in->putBackcxx . . $ SoInput#putBack(44b6ea1973a07080).(c);
2214 makeRoomcxx . . $ SoMField#makeRoom(d4f767463ce0a6b3).(1);
2215 if (! read1Valuecxx . . $ SoMField#read1Value(b57125c54eeea43).(in, 0))
2216 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2217 }
2218 }
2219
2220 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
2221 }
2222
2223 ////////////////////////////////////////////////////////////////////////
2224 //
2225 // Description:
2226 // Writes all values of field to file. Works for ASCII and binary
2227 // output. Binary output writes out the number of values and then
2228 // the values as one big chunk o'memory.
2229 //
2230 // Use: private
2231
2232 void
2233 SoMFieldcxx . . $ SoMField#::writeValuecxx . . $ SoMField#writeValue(58762e0f79576b7c).(SoOutputcxx . . $ SoOutput# *out) const
2234 //
2235 ////////////////////////////////////////////////////////////////////////
2236 {
2237 int i;
2238
2239 if (out->isBinarycxx . . $ SoOutput#isBinary(455f465bc33b4cdf).()) {
2240 out->writecxx . . $ SoOutput#write(d4f767463ce0a6b3).(numcxx . . $ SoMField#num.);
2241 writeBinaryValuescxx . . $ SoMField#writeBinaryValues(58762e0f79576b7c).(out);
2242 }
2243
2244 else {
2245 if (numcxx . . $ SoMField#num. == 1)
2246 write1Valuecxx . . $ SoMField#write1Value(73cc401f7e0a390c).(out, 0);
2247
2248 else {
2249 int numOnLine = 0, maxOnLine = getNumValuesPerLinecxx . . $ SoMField#getNumValuesPerLine(455f465bc33b4cdf).();
2250
2251 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(OPEN_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:74:9`!);
2252 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
2253
2254 out->incrementIndentcxx . . $ SoOutput#incrementIndent(d4f767463ce0a6b3).(4);
2255
2256 for (i = 0; i < numcxx . . $ SoMField#num.; i++) {
2257
2258 write1Valuecxx . . $ SoMField#write1Value(73cc401f7e0a390c).(out, i);
2259
2260 if (i < numcxx . . $ SoMField#num. - 1) {
2261 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(VALUE_SEPARATOR_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:76:9`!);
2262 if (++numOnLine == maxOnLine && ! out->isCompactcxx . . $ SoOutput#isCompact(455f465bc33b4cdf).()) {
2263 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).('\n');
2264 out->indentcxx . . $ SoOutput#indent(49f6e7a06ebc5aa8).();
2265 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
2266 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
2267 numOnLine = 0;
2268 }
2269 else
2270 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
2271 }
2272 }
2273
2274 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(' ');
2275 out->writecxx . . $ SoOutput#write(44b6ea1973a07080).(CLOSE_BRACE_CHARcxx . . $ `lib/database/src/so/fields/SoField.c++:75:9`!);
2276
2277 out->decrementIndentcxx . . $ SoOutput#decrementIndent(d4f767463ce0a6b3).(4);
2278 }
2279 }
2280 }
2281
2282 ////////////////////////////////////////////////////////////////////////
2283 //
2284 // Description:
2285 // Writes array of binary values to file as one chunk.
2286 //
2287 // Use: private
2288
2289 void
2290 SoMFieldcxx . . $ SoMField#::writeBinaryValuescxx . . $ SoMField#writeBinaryValues(58762e0f79576b7c).(SoOutputcxx . . $ SoOutput# *out) const // Defines writing action
2291
2292 //
2293 ////////////////////////////////////////////////////////////////////////
2294 {
2295 int i;
2296
2297 for (i = 0; i < numcxx . . $ SoMField#num.; i++)
2298 write1Valuecxx . . $ SoMField#write1Value(73cc401f7e0a390c).(out, i);
2299 }
2300
2301 ////////////////////////////////////////////////////////////////////////
2302 //
2303 // Description:
2304 // Reads array of binary values from file as one chunk.
2305 //
2306 // Use: private
2307
2308 SbBoolcxx . . $ SbBool#
2309 SoMFieldcxx . . $ SoMField#::readBinaryValuescxx . . $ SoMField#readBinaryValues(b57125c54eeea43).(SoInputcxx . . $ SoInput# *in, // Reading specification
2310 int numToRead) // Number of values to read
2311 //
2312 ////////////////////////////////////////////////////////////////////////
2313 {
2314 int i;
2315
2316 for (i = 0; i < numToRead; i++)
2317 if (! read1Valuecxx . . $ SoMField#read1Value(b57125c54eeea43).(in, i))
2318 return FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
2319
2320 return TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
2321 }
2322
2323 ////////////////////////////////////////////////////////////////////////
2324 //
2325 // Description:
2326 // Returns number of ASCII values to write per output line. This
2327 // defines the default to be 1, just to play it safe.
2328 //
2329 // Use: private
2330
2331 int
2332 SoMFieldcxx . . $ SoMField#::getNumValuesPerLinecxx . . $ SoMField#getNumValuesPerLine(455f465bc33b4cdf).() const
2333 //
2334 ////////////////////////////////////////////////////////////////////////
2335 {
2336 return 1;
2337 }
2338
2339 ////////////////////////////////////////////////////////////////////////
2340 //
2341 // Description:
2342 // This is a callback function passed to SoOutput::setBuffer() by
2343 // SoMField::get1(). It is used to reallocate the buffer in which the
2344 // returned field info string is stored. Since we need to keep
2345 // track of the pointer to the buffer and its size, we can't just
2346 // call realloc() instead.
2347 //
2348 // Use: private, static
2349
2350 void *
2351 SoMFieldcxx . . $ SoMField#::reallocFieldBufcxx . . $ SoMField#reallocFieldBuf(417ab160f6baadc6).(void *ptr, size_t newSize)
2352 //
2353 ////////////////////////////////////////////////////////////////////////
2354 {
2355 fieldBufcxx . . $ SoMField#fieldBuf. = (char *) realloc(ptr, newSize);
2356 fieldBufSizecxx . . $ SoMField#fieldBufSize. = newSize;
2357
2358 return fieldBufcxx . . $ SoMField#fieldBuf.;
2359 }
2360
2361
2362