Debian Codegraph @

lib/database/src/so/nodes/SoUnknownNode.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1990,91 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | $Revision: 1.2 $
44 |
45 | Classes:
46 | SoUnknownNode
47 |
48 | Author(s) : Paul S. Strauss, Dave Immel, Gavin Bell
49 |
50 ______________ S I L I C O N G R A P H I C S I N C . ____________
51 _______________________________________________________________________
52 */
53
54
55 #include <cstdlib>
56 #include <Inventor/misc/SoState.h>cxx . . $ `<file>/lib/database/include/Inventor/misc/SoState.h`/
57 #include <Inventor/actions/SoWriteAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoWriteAction.h`/
58 #include <Inventor/fields/SoMFString.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoMFString.h`/
59 #include <Inventor/fields/SoSFNode.h>cxx . . $ `<file>/lib/database/include/Inventor/fields/SoSFNode.h`/
60 #include <SoUnknownNode.h>cxx . . $ `<file>/lib/database/include/SoUnknownNode.h`/
61
62 // Because of the special treatment of fieldData, we can't use the
63 // regular SO_NODE_SOURCE macro.
64 SO__NODE_VARScxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:195:9`!(SoUnknownNode);
65
66 SoTypecxx . . $ SoType#
67 SoUnknownNodecxx . . $ SoUnknownNode#::getTypeIdcxx . . $ SoUnknownNode#getTypeId(70775439ff16cb15).() const
68 {
69 return classTypeIdcxx . . $ SoUnknownNode#classTypeId.;
70 }
71
72 const SoFieldDatacxx . . $ SoFieldData# *
73 SoUnknownNodecxx . . $ SoUnknownNode#::getFieldDatacxx . . $ SoUnknownNode#getFieldData(56e90abbfb485471).() const
74 {
75 return instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.;
76 }
77
78 void *
79 SoUnknownNodecxx . . $ SoUnknownNode#::createInstancecxx . . $ SoUnknownNode#createInstance(50c7df7de5344ebb).()
80 {
81 #ifdef DEBUG
82 SoDebugError::post("SoUnknownNode::createInstance",
83 "Unknown nodes should be created only by "
84 "SoBase::read methods when reading");
85 #endif
86 return (void *)(new SoUnknownNodecxx . . $ SoUnknownNode#());
87 }
88
89
90 ////////////////////////////////////////////////////////////////////////
91 //
92 // Description:
93 // Constructor
94 //
95 // Use: public
96
97 SoUnknownNodecxx . . $ SoUnknownNode#::SoUnknownNodecxx . . $ SoUnknownNode#SoUnknownNode(49f6e7a06ebc5aa8).() : hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren.(this)
98 //
99 ////////////////////////////////////////////////////////////////////////
100 {
101 SO_NODE_CONSTRUCTORcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:309:9`!(SoUnknownNode);
102
103 instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData. = new SoFieldDatacxx . . $ SoFieldData#SoFieldData(2c1142d05cf29340).(fieldDatacxx . . $ SoUnknownNode#fieldData.);
104 classNamecxx . . $ SoUnknownNode#className. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
105
106 hasChildrencxx . . $ SoUnknownNode#hasChildren. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
107 }
108
109 ////////////////////////////////////////////////////////////////////////
110 //
111 // Description:
112 // Set the class name of the unknown node
113 //
114 // Use: public
115
116 void
117 SoUnknownNodecxx . . $ SoUnknownNode#::setClassNamecxx . . $ SoUnknownNode#setClassName(85c52e162fed56f9).( const char *name )
118
119 //
120 ////////////////////////////////////////////////////////////////////////
121 {
122 classNamecxx . . $ SoUnknownNode#className. = strdup(name);
123 }
124
125 ////////////////////////////////////////////////////////////////////////
126 //
127 // Description:
128 // Destructor
129 //
130 // Use: private
131
132 SoUnknownNodecxx . . $ SoUnknownNode#::~cxx . . $ SoUnknownNode#`~SoUnknownNode`(49f6e7a06ebc5aa8).SoUnknownNodecxx . . $ SoUnknownNode#()
133 //
134 ////////////////////////////////////////////////////////////////////////
135 {
136 //
137 // The fields of the unknown node have been allocated by the SoFieldData
138 // class. The unknown node will delete them here, because the field
139 // data does not have enough information to know where its fields are
140 // stored. This could be redesigned.
141 //
142 SoFieldListcxx . . $ SoFieldList# fieldListcxx . . $ SoFieldList#SoFieldList(49f6e7a06ebc5aa8).;
143 int numFields = getFieldscxx . . $ SoFieldContainer#getFields(517625c0f7c00408).(fieldList);
144
145 for (int i=0; i<numFields; i++)
146 delete fieldList[cxx . . $ SoFieldList#`operator[]`(f04f5c02c62994cc).i];
147
148 delete instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.;
149
150 if (classNamecxx . . $ SoUnknownNode#className.) free((void *)classNamecxx . . $ SoUnknownNode#className.);
151 }
152
153 ////////////////////////////////////////////////////////////////////////
154 //
155 // Description:
156 // Reads field type data, fields, and children into instance of
157 // SoUnknownNode. Returns FALSE on error.
158 //
159 // Use: virtual, protected
160
161 SbBoolcxx . . $ SbBool#
162 SoUnknownNodecxx . . $ SoUnknownNode#::readInstancecxx . . $ SoUnknownNode#readInstance(9e4ba99a4b4184f8).(SoInputcxx . . $ SoInput# *in, unsigned short flags)
163
164 //
165 ////////////////////////////////////////////////////////////////////////
166 {
167 int i;
168
169 // This is mostly the normal SoGroup reading code, but we look for
170 // an alternateRep field after reading and move our public
171 // children onto the hidden children list:
172
173 hasChildrencxx . . $ SoUnknownNode#hasChildren. = (!in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).() || (flags & IS_GROUPcxx . . $ SoBase#IS_GROUP.));
174 SbBoolcxx . . $ SbBool# result;
175 if (hasChildrencxx . . $ SoUnknownNode#hasChildren.) {
176 result = SoGroupcxx . . $ SoGroup#::readInstancecxx . . $ SoGroup#readInstance(9e4ba99a4b4184f8).(in, flags);
177
178 // If read ASCII AND didn't read any children, set hasChildren
179 // to FALSE:
180 if (!in->isBinarycxx . . $ SoInput#isBinary(b126dc7c1de90089).() && getNumChildrencxx . . $ SoGroup#getNumChildren(455f465bc33b4cdf).() == 0) hasChildrencxx . . $ SoUnknownNode#hasChildren. = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
181
182 // Add all kids to hiddenChildren, then remove them all from the
183 // regular (SoGroup) list
184 for (i = 0; i < getNumChildrencxx . . $ SoGroup#getNumChildren(455f465bc33b4cdf).(); i++) {
185 hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren..appendcxx . . $ SoChildList#append(da6c7544ccee32bd).(getChildcxx . . $ SoGroup#getChild(fd675789997d09c2).(i));
186 }
187 removeAllChildrencxx . . $ SoGroup#removeAllChildren(49f6e7a06ebc5aa8).();
188 }
189 else {
190 result = SoNodecxx . . $ SoNode#::readInstancecxx . . $ SoFieldContainer#readInstance(9e4ba99a4b4184f8).(in, flags);
191 }
192
193 // Check to see if an alternate representation was read and
194 // store a pointer to it if one is found.
195 int num = instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getNumFieldscxx . . $ SoFieldData#getNumFields(455f465bc33b4cdf).();
196 SbBoolcxx . . $ SbBool# haveAlternateRep = FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!;
197 for (i=0; i<num; i++) {
198 if (instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(i) ==cxx . . $ `operator==`(edde533be586f7a2). SbNamecxx . . $ SbName#SbName(85c52e162fed56f9).("alternateRep")) {
199 SoFieldcxx . . $ SoField# *f = instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(this, i);
200 if (f->isOfTypecxx . . $ SoField#isOfType(1fd66475a268b64e).(SoSFNodecxx . . $ SoSFNode#::getClassTypeIdcxx . . $ SoSFNode#getClassTypeId(c00c150378d2b968).())) {
201 haveAlternateRep = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
202 SoSFNodecxx . . $ SoSFNode# *alternateRepField = (SoSFNodecxx . . $ SoSFNode# *)f;
203 SoNodecxx . . $ SoNode# *n = alternateRepField->getValuecxx . . $ SoSFNode#getValue(b794963b450d51b3).();
204 if (n != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
205 addChildcxx . . $ SoGroup#addChild(da6c7544ccee32bd).(n);
206 }
207 break;
208 }
209 }
210
211 // If no alternateRep was specified, look for a field named "isA"
212 // of type MFString and try to automatically create an
213 // alternateRep:
214 if (!haveAlternateRep) for (i=0; i<num; i++) {
215 if (instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(i) ==cxx . . $ `operator==`(edde533be586f7a2). SbNamecxx . . $ SbName#SbName(85c52e162fed56f9).("isA")) {
216 SoFieldcxx . . $ SoField# *f = instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(this, i);
217 if (f->isOfTypecxx . . $ SoField#isOfType(1fd66475a268b64e).(SoMFStringcxx . . $ SoMFString#::getClassTypeIdcxx . . $ SoMFString#getClassTypeId(c00c150378d2b968).())) {
218 createFromIsAcxx . . $ SoUnknownNode#createFromIsA(1bd9cc1612ced328).((SoMFStringcxx . . $ SoMFString# *)f);
219 }
220 }
221 }
222
223 return result;
224 }
225
226 ////////////////////////////////////////////////////////////////////////
227 //
228 // Description:
229 // Given an MFString "isA", create an appropriate alternateRep and
230 // adds it as a child.
231 //
232 // Use: private
233
234 void
235 SoUnknownNodecxx . . $ SoUnknownNode#::createFromIsAcxx . . $ SoUnknownNode#createFromIsA(1bd9cc1612ced328).(SoMFStringcxx . . $ SoMFString# *isA)
236 //
237 ////////////////////////////////////////////////////////////////////////
238 {
239 for (int i = 0; i < isA->getNumcxx . . $ SoMField#getNum(455f465bc33b4cdf).(); i++) {
240 SoTypecxx . . $ SoType# t = SoTypecxx . . $ SoType#::fromNamecxx . . $ SoType#fromName(9c5a3237ca15d417).((cxx . . $ SbName#SbName(78e67776a82c5be1).*isA)[cxx . . $ SoMFString#`operator[]`(1f64d4776649c045).i]);
241
242 if (t.canCreateInstancecxx . . $ SoType#canCreateInstance(455f465bc33b4cdf).() &&
243 t.isDerivedFromcxx . . $ SoType#isDerivedFrom(1fd66475a268b64e).(SoNodecxx . . $ SoNode#::getClassTypeIdcxx . . $ SoNode#getClassTypeId(c00c150378d2b968).())) {
244
245 SoNodecxx . . $ SoNode# *alternateRep = (SoNodecxx . . $ SoNode# *)t.createInstancecxx . . $ SoType#createInstance(45a5c5ac6be858a8).();
246 alternateRep->refcxx . . $ SoBase#ref(83f5f38750778ac8).();
247 #ifdef DEBUG
248 if (alternateRep == NULL) {
249 SoDebugError::post("SoUnknownNode::createFromIsA",
250 "SoType.createInstance returned "
251 "NULL (type %s)",
252 t.getName().getString());
253 return;
254 }
255 #endif
256 // Copy over all fields that are shared:
257 int num = instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getNumFieldscxx . . $ SoFieldData#getNumFields(455f465bc33b4cdf).();
258 for (int j=0; j<num; j++) {
259 const SbNamecxx . . $ SbName# &fieldName = instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(j);
260 SoFieldcxx . . $ SoField# *f = instanceFieldDatacxx . . $ SoUnknownNode#instanceFieldData.->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(this, j);
261 // Don't copy over fields with default values:
262 if (f->isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).()) continue;
263
264 SoFieldcxx . . $ SoField# *nf = alternateRep->getFieldcxx . . $ SoFieldContainer#getField(c5cb3b179879bcd).(fieldName);
265 if (nf != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! && nf->getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).() ==cxx . . $ SoType#`operator==`(1fd66475a268b64e). f->getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).()) {
266 nf->copyFromcxx . . $ SoField#copyFrom(cf274881b46fe863).(*f);
267 if (f->isConnectedFromFieldcxx . . $ SoField#isConnectedFromField(455f465bc33b4cdf).()) {
268 SoFieldcxx . . $ SoField# *cf;
269 f->getConnectedFieldcxx . . $ SoField#getConnectedField(9688a3793c9b5caa).(cf);
270 nf->connectFromcxx . . $ SoField#connectFrom(b5126a9b660c5c40).(cf);
271 } else if (f->isConnectedFromEnginecxx . . $ SoField#isConnectedFromEngine(455f465bc33b4cdf).()) {
272 SoEngineOutputcxx . . $ SoEngineOutput# *eo;
273 f->getConnectedEnginecxx . . $ SoField#getConnectedEngine(d90a32d7bcd50feb).(eo);
274 nf->connectFromcxx . . $ SoField#connectFrom(8f75f3dee2b2cd82).(eo);
275 }
276 }
277 }
278 // And if alternateRep is a group, copy over hidden
279 // children:
280 if (alternateRep->isOfTypecxx . . $ SoBase#isOfType(1fd66475a268b64e).(SoGroupcxx . . $ SoGroup#::getClassTypeIdcxx . . $ SoGroup#getClassTypeId(c00c150378d2b968).())) {
281 SoGroupcxx . . $ SoGroup# *g = (SoGroupcxx . . $ SoGroup# *)alternateRep;
282 for (int kid = 0; kid < hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).();
283 kid++) {
284 g->addChildcxx . . $ SoGroup#addChild(da6c7544ccee32bd).(hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren.[cxx . . $ SoNodeList#`operator[]`(fd675789997d09c2).kid]);
285 }
286 }
287 addChildcxx . . $ SoGroup#addChild(da6c7544ccee32bd).(alternateRep);
288 return;
289 }
290 }
291 }
292
293 ////////////////////////////////////////////////////////////////////////
294 //
295 // Description:
296 // Implements write action. We use SoGroup's write method, after
297 // fooling around with some stuff so the correct class name and the
298 // correct children get written.
299 //
300 // Use: private
301
302 void
303 SoUnknownNodecxx . . $ SoUnknownNode#::writecxx . . $ SoUnknownNode#write(a375a81bffae2638).(SoWriteActioncxx . . $ SoWriteAction# *action)
304 //
305 ////////////////////////////////////////////////////////////////////////
306 {
307 int i;
308
309 SbBoolcxx . . $ SbBool# saveNotify = enableNotifycxx . . $ SoFieldContainer#enableNotify(7864480464b09eea).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
310
311 // Remember alternateRep, if set:
312 SoNodecxx . . $ SoNode# *alternateRep = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
313
314 if (hasChildrencxx . . $ SoUnknownNode#hasChildren.) {
315 if (getNumChildrencxx . . $ SoGroup#getNumChildren(455f465bc33b4cdf).() != 0) {
316 alternateRep = getChildcxx . . $ SoGroup#getChild(fd675789997d09c2).(0);
317 alternateRep->refcxx . . $ SoBase#ref(83f5f38750778ac8).();
318 }
319
320 // Add hiddenChildren to regular child list temporarily:
321 removeAllChildrencxx . . $ SoGroup#removeAllChildren(49f6e7a06ebc5aa8).();
322 for (i = 0; i < hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
323 addChildcxx . . $ SoGroup#addChild(da6c7544ccee32bd).(hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren.[cxx . . $ SoNodeList#`operator[]`(fd675789997d09c2).i]);
324 }
325 // Now write:
326 SoGroupcxx . . $ SoGroup#::writecxx . . $ SoGroup#write(a375a81bffae2638).(action);
327
328 removeAllChildrencxx . . $ SoGroup#removeAllChildren(49f6e7a06ebc5aa8).();
329 }
330 else {
331 SoNodecxx . . $ SoNode#::writecxx . . $ SoNode#write(a375a81bffae2638).(action);
332 }
333
334 if (alternateRep != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
335 addChildcxx . . $ SoGroup#addChild(da6c7544ccee32bd).(alternateRep);
336 alternateRep->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).();
337 }
338
339 enableNotifycxx . . $ SoFieldContainer#enableNotify(7864480464b09eea).(saveNotify);
340 }
341
342 ////////////////////////////////////////////////////////////////////////
343 //
344 // Description:
345 // Override searchAction so children (alternateRep) aren't
346 // searched.
347 //
348 // Use: public
349
350 void
351 SoUnknownNodecxx . . $ SoUnknownNode#::searchcxx . . $ SoUnknownNode#search(ecd330ee9b1f803b).(SoSearchActioncxx . . $ SoSearchAction# *action)
352 //
353 ////////////////////////////////////////////////////////////////////////
354 {
355 SoNodecxx . . $ SoNode#::searchcxx . . $ SoNode#search(ecd330ee9b1f803b).(action);
356 }
357
358 ////////////////////////////////////////////////////////////////////////
359 //
360 // Description:
361 // Recursively adds this node and all nodes under it to the copy
362 // dictionary. Returns the copy of this node.
363 //
364 // Use: protected, virtual
365
366 SoNodecxx . . $ SoNode# *
367 SoUnknownNodecxx . . $ SoUnknownNode#::addToCopyDictcxx . . $ SoUnknownNode#addToCopyDict(b794963b450d51b3).() const
368 //
369 ////////////////////////////////////////////////////////////////////////
370 {
371 // If this node is already in the dictionary, nothing else to do
372 SoNodecxx . . $ SoNode# *copy = (SoNodecxx . . $ SoNode# *) checkCopycxx . . $ SoFieldContainer#checkCopy(39a6da8fb59a7efc).(this);
373 if (copy == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
374
375 // Create and add a new instance to the dictionary
376 copy = new SoUnknownNodecxx . . $ SoUnknownNode#;
377 copy->refcxx . . $ SoBase#ref(83f5f38750778ac8).();
378 addCopycxx . . $ SoFieldContainer#addCopy(4708885bf4a3e61e).(this, copy); // Adds a ref()
379 copy->unrefNoDeletecxx . . $ SoBase#unrefNoDelete(83f5f38750778ac8).();
380
381 // Recurse on children, if any
382 for (int i = 0; i < hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++)
383 hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren.[cxx . . $ SoNodeList#`operator[]`(fd675789997d09c2).i]->addToCopyDictcxx . . $ SoNode#addToCopyDict(b794963b450d51b3).();
384 }
385
386 return copy;
387 }
388
389 ////////////////////////////////////////////////////////////////////////
390 //
391 // Description:
392 // Copies the contents of the given node into this instance.
393 //
394 // Use: protected, virtual
395
396 void
397 SoUnknownNodecxx . . $ SoUnknownNode#::copyContentscxx . . $ SoUnknownNode#copyContents(502fcadd2953076).(const SoFieldContainercxx . . $ SoFieldContainer# *fromFC,
398 SbBoolcxx . . $ SbBool# copyConnections)
399 //
400 ////////////////////////////////////////////////////////////////////////
401 {
402 // Make sure the copy has the correct class name
403 const SoUnknownNodecxx . . $ SoUnknownNode# *fromUnk = (const SoUnknownNodecxx . . $ SoUnknownNode# *) fromFC;
404 setClassNamecxx . . $ SoUnknownNode#setClassName(85c52e162fed56f9).(fromUnk->classNamecxx . . $ SoUnknownNode#className.);
405
406 // For each field in the original node, create a new field and add
407 // it to the new node
408
409 // NOTE: We can't use SoNode::copyContents() to copy the field
410 // data, since that uses SoFieldData::overlay(), which assumes the
411 // fields have the same offsets in both nodes. Instead, we just
412 // copy the field values ourselves.
413
414 const SoFieldDatacxx . . $ SoFieldData# *fromData = fromUnk->getFieldDatacxx . . $ SoUnknownNode#getFieldData(56e90abbfb485471).();
415 SoFieldDatacxx . . $ SoFieldData# *toData = (SoFieldDatacxx . . $ SoFieldData# *) getFieldDatacxx . . $ SoUnknownNode#getFieldData(56e90abbfb485471).();
416
417 int i;
418 for (i = 0; i < fromData->getNumFieldscxx . . $ SoFieldData#getNumFields(455f465bc33b4cdf).(); i++) {
419
420 SoFieldcxx . . $ SoField# *fromField = fromData->getFieldcxx . . $ SoFieldData#getField(f4cd4e797bb371f6).(fromUnk, i);
421 const SbNamecxx . . $ SbName# fieldName = fromDatacxx . . $ SbName#SbName(78e67776a82c5be1).->getFieldNamecxx . . $ SoFieldData#getFieldName(e603ed4d11f0a676).(i);
422 SoTypecxx . . $ SoType# fieldType = fromField->getTypeIdcxx . . $ SoField#getTypeId(70775439ff16cb15).();
423 SoFieldcxx . . $ SoField# *toField = (SoFieldcxx . . $ SoField# *) (fieldType.createInstancecxx . . $ SoType#createInstance(45a5c5ac6be858a8).());
424
425 toField->enableNotifycxx . . $ SoField#enableNotify(7864480464b09eea).(FALSEcxx . . $ `lib/database/include/Inventor/SbBasic.h:79:12`!);
426 toField->setContainercxx . . $ SoField#setContainer(1c5659d1d94c054f).(this);
427 toField->setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
428 toField->enableNotifycxx . . $ SoField#enableNotify(7864480464b09eea).(TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
429
430 toData->addFieldcxx . . $ SoFieldData#addField(62ec4b1f920ec561).(this, fieldName.getStringcxx . . $ SbName#getString(a9f41ea0e82d88cf).(), toField);
431
432 toField->setContainercxx . . $ SoField#setContainer(1c5659d1d94c054f).(this);
433 toField->copyFromcxx . . $ SoField#copyFrom(cf274881b46fe863).(*fromField);
434 toField->setIgnoredcxx . . $ SoField#setIgnored(d4f767463ce0a6b3).(fromField->isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).());
435 toField->setDefaultcxx . . $ SoField#setDefault(d4f767463ce0a6b3).(fromField->isDefaultcxx . . $ SoField#isDefault(455f465bc33b4cdf).());
436 toField->fixCopycxx . . $ SoField#fixCopy(d4f767463ce0a6b3).(copyConnections);
437 if (fromField->isConnectedcxx . . $ SoField#isConnected(455f465bc33b4cdf).() && copyConnections)
438 toField->copyConnectioncxx . . $ SoField#copyConnection(4e16df535ad78f95).(fromField);
439 }
440
441 // Copy the kids
442 for (i = 0; i < fromUnk->hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren..getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) {
443
444 // If this node is being copied, it must be "inside" (see
445 // SoNode::copy() for details.) Therefore, all of its children
446 // must be inside, as well, since our addToCopyDict() takes
447 // care of that.
448 SoNodecxx . . $ SoNode# *fromKid = fromUnk->getChildcxx . . $ SoGroup#getChild(fd675789997d09c2).(i);
449 SoNodecxx . . $ SoNode# *kidCopy = (SoNodecxx . . $ SoNode# *) findCopycxx . . $ SoFieldContainer#findCopy(764c84fe9fa40e97).(fromKid, copyConnections);
450
451 #ifdef DEBUG
452 if (kidCopy == NULL)
453 SoDebugError::post("(internal) SoUnknownNode::copyContents",
454 "Child %d has not been copied yet", i);
455 #endif /* DEBUG */
456
457 hiddenChildrencxx . . $ SoUnknownNode#hiddenChildren..appendcxx . . $ SoChildList#append(da6c7544ccee32bd).(kidCopy);
458 }
459
460 // No need to copy the override flag, since this flag will have no
461 // effect on an unknown node, and it is not read from or written
462 // to files.
463 }
464
465 ////////////////////////////////////////////////////////////////////////
466 //
467 // Description:
468 // Returns file format name.
469 //
470 // Use: protected
471
472 const char *
473 SoUnknownNodecxx . . $ SoUnknownNode#::getFileFormatNamecxx . . $ SoUnknownNode#getFileFormatName(a9f41ea0e82d88cf).() const
474 //
475 ////////////////////////////////////////////////////////////////////////
476 {
477 return classNamecxx . . $ SoUnknownNode#className.;
478 }
479