1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2003 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 //---------------------------------------------------------------------------
41 //---------------------------------------------------------------------------
46 #include "OSGConfig.h"
49 #include "OSGContainerPtrFuncs.h"
50 #include "OSGTestFC.h"
54 void TestFC::classDescInserter(TypeObject
&oType
)
56 FieldDescriptionBase
*pDesc
= NULL
;
58 pDesc
= new MFUInt32::Description(
59 MFUInt32::getClassType(),
62 OSG_RC_FIELD_DESC(TestFC::Field1
),
64 Field::MFDefaultFlags
,
65 reinterpret_cast<FieldEditMethodSig
>(&TestFC::editHandleField1
),
66 reinterpret_cast<FieldGetMethodSig
>(&TestFC::getHandleField1
));
68 oType
.addInitialDesc(pDesc
);
70 pDesc
= new SFUInt32::Description(
71 SFUInt32::getClassType(),
74 OSG_RC_FIELD_DESC(TestFC::Field2
),
76 Field::SFDefaultFlags
,
77 reinterpret_cast<FieldEditMethodSig
>(&TestFC::editHandleField2
),
78 reinterpret_cast<FieldGetMethodSig
>(&TestFC::getHandleField2
));
80 oType
.addInitialDesc(pDesc
);
82 pDesc
= new MFUInt32::Description(
83 MFUInt32::getClassType(),
86 OSG_RC_FIELD_DESC(TestFC::Field3
),
88 Field::MFDefaultFlags
,
89 reinterpret_cast<FieldEditMethodSig
>(&TestFC::editHandleField3
),
90 reinterpret_cast<FieldGetMethodSig
>(&TestFC::getHandleField3
));
92 oType
.addInitialDesc(pDesc
);
94 pDesc
= new SFUInt32::Description(
95 SFUInt32::getClassType(),
98 OSG_RC_FIELD_DESC(TestFC::Field4
),
100 Field::SFDefaultFlags
,
101 reinterpret_cast<FieldEditMethodSig
>(&TestFC::editHandleField4
),
102 reinterpret_cast<FieldGetMethodSig
>(&TestFC::getHandleField4
));
104 oType
.addInitialDesc(pDesc
);
107 TestFC::TypeObject
TestFC::_type(
108 TestFC ::getClassname(),
109 Inherited::getClassname(),
112 reinterpret_cast<PrototypeCreateF
>(&TestFC::createEmptyLocal
),
115 reinterpret_cast<InitalInsertDescFunc
>(&TestFC::classDescInserter
),
120 OSG_FIELD_CONTAINER_DEF(TestFC
)
122 /*-------------------------------------------------------------------------*/
125 /*-------------------------------------------------------------------------*/
128 TestFC::TestFC(void) :
137 TestFC::TestFC(const TestFC
&source
) :
139 _mfField1 (source
._mfField1
),
140 _sfField2 (source
._sfField2
),
141 _mfField3 (source
._mfField3
),
142 _sfField4 (source
._sfField4
)
145 /*-------------------------------------------------------------------------*/
148 TestFC::~TestFC(void)
152 void TestFC::onDestroyAspect(UInt32 uiContainerId
,
155 // _mfField1.terminateShare(uiAspect, getContainerSize());
156 // _mfField3.terminateShare(uiAspect, getContainerSize());
159 #ifdef OSG_MT_CPTR_ASPECT
160 TestFC::ObjCPtr
TestFC::createAspectCopy(const FieldContainer
*pRefAspect
) const
164 newAspectCopy(returnValue
,
165 dynamic_cast<const TestFC
*>(pRefAspect
),
166 dynamic_cast<const TestFC
*>(this));
172 void TestFC::changed(ConstFieldMaskArg whichField
,
176 fprintf(stderr
, "TestFC changed\n");
178 Inherited::changed(whichField
, origin
, details
);
181 void TestFC::dump( UInt32 uiIndent
,
182 const BitVector bvFlags
) const
184 #ifdef OSG_MT_CPTR_ASPECT
185 fprintf(stderr
, "TestFC %p %p\n", this, _pAspectStore
);
187 _pAspectStore
->dump();
190 fprintf(stderr
, "%p %p | 0x%016" PRIx64
"\n",
195 _mfField1
.dump(uiIndent
+ 4, bvFlags
);
197 for(UInt32 i
= 0; i
< _mfField1
.size(); ++i
)
199 fprintf(stderr
, "%d ", _mfField1
[i
]);
201 fprintf(stderr
, "\n");
203 fprintf(stderr
, "%d\n", _sfField2
.getValue());
205 _mfField3
.dump(uiIndent
+ 4, bvFlags
);
207 for(UInt32 i
= 0; i
< _mfField3
.size(); ++i
)
209 fprintf(stderr
, "%d ", _mfField3
[i
]);
211 fprintf(stderr
, "\n");
214 MFUInt32
*TestFC::editMFField1(void)
216 editMField(Field1FieldMask
, _mfField1
);
221 const MFUInt32
*TestFC::getMFField1(void) const
226 SFUInt32
*TestFC::editSFField2(void)
228 editSField(Field2FieldMask
);
233 const SFUInt32
*TestFC::getSFField2(void) const
238 MFUInt32
*TestFC::editMFField3(void)
240 editMField(Field3FieldMask
, _mfField3
);
245 const MFUInt32
*TestFC::getMFField3(void) const
250 SFUInt32
*TestFC::editSFField4(void)
252 editSField(Field4FieldMask
);
257 const SFUInt32
*TestFC::getSFField4(void) const
262 /*-------------------------------------------------------------------------*/
265 #ifdef OSG_MT_CPTR_ASPECT
266 void TestFC::execSyncV( FieldContainer
&oFrom
,
267 ConstFieldMaskArg whichField
,
268 AspectOffsetStore
&oOffsets
,
269 ConstFieldMaskArg syncMode
,
270 const UInt32 uiSyncInfo
)
272 this->execSync(static_cast<TestFC
*>(&oFrom
),
280 void TestFC::resolveLinks(void)
282 Inherited::resolveLinks();
285 /*-------------------------------------------------------------------------*/
288 MFUInt32::EditHandlePtr
TestFC::editHandleField1(void)
290 MFUInt32::EditHandlePtr
returnValue(
291 new MFUInt32::EditHandle(
293 this->getType().getFieldDesc(Field1FieldId
),
296 editMField(Field1FieldMask
, _mfField1
);
301 MFUInt32::GetHandlePtr
TestFC::getHandleField1 (void) const
303 MFUInt32::GetHandlePtr
returnValue(
304 new MFUInt32::GetHandle(
306 this->getType().getFieldDesc(Field1FieldId
),
307 const_cast<TestFC
*>(this)));
312 SFUInt32::EditHandlePtr
TestFC::editHandleField2(void)
314 SFUInt32::EditHandlePtr
returnValue(
315 new SFUInt32::EditHandle(
317 this->getType().getFieldDesc(Field2FieldId
),
320 editSField(Field2FieldMask
);
325 SFUInt32::GetHandlePtr
TestFC::getHandleField2 (void) const
327 SFUInt32::GetHandlePtr
returnValue(
328 new SFUInt32::GetHandle(
330 this->getType().getFieldDesc(Field2FieldId
),
331 const_cast<TestFC
*>(this)));
337 MFUInt32::EditHandlePtr
TestFC::editHandleField3(void)
339 MFUInt32::EditHandlePtr
returnValue(
340 new MFUInt32::EditHandle(
342 this->getType().getFieldDesc(Field3FieldId
),
345 editMField(Field3FieldMask
, _mfField3
);
350 MFUInt32::GetHandlePtr
TestFC::getHandleField3 (void) const
352 MFUInt32::GetHandlePtr
returnValue(
353 new MFUInt32::GetHandle(
355 this->getType().getFieldDesc(Field3FieldId
),
356 const_cast<TestFC
*>(this)));
361 SFUInt32::EditHandlePtr
TestFC::editHandleField4(void)
363 SFUInt32::EditHandlePtr
returnValue(
364 new SFUInt32::EditHandle(
366 this->getType().getFieldDesc(Field4FieldId
),
369 editSField(Field4FieldMask
);
374 SFUInt32::GetHandlePtr
TestFC::getHandleField4 (void) const
376 SFUInt32::GetHandlePtr
returnValue(
377 new SFUInt32::GetHandle(
379 this->getType().getFieldDesc(Field4FieldId
),
380 const_cast<TestFC
*>(this)));