2 #include "OSGBaseInitFunctions.h"
4 #include "OSGNameAttachment.h"
5 #include "OSGDynamicAttachmentMixin.h"
11 typedef OSG::Attachment Parent
;
12 typedef OSG::Attachment
*ParentPtr
;
14 // TODO rename it to VRMLGenericAtt ????
15 static const OSG::Char8
*getTypeName (void) { return "TestAtt"; }
16 static const OSG::Char8
*getParentTypeName (void)
20 static const OSG::Char8
*getGroupName (void) { return "TestGenAtt"; }
22 static OSG::InitContainerF
getInitMethod(void) { return NULL
; }
24 static OSG::FieldDescriptionBase
**getDesc (void) { return NULL
; }
27 typedef OSG::DynFieldAttachment
<TestAttDesc
> TestAtt
;
28 typedef TestAtt::ObjRecPtr TestAttRecPtr
;
30 OSG_DYNFIELDATTACHMENT_INST(TestAttDesc
)
34 int main(int argc
, char **argv
)
36 OSG::osgInit(argc
, argv
);
38 OSG::TestAttRecPtr tp
= OSG::TestAtt::create();
40 OSG::FieldDescriptionBase
*pDesc
= NULL
;
42 pDesc
= new OSG::SFInt32::Description(
43 OSG::SFInt32::getClassType(),
49 OSG::Field::SFDefaultFlags
,
50 static_cast<OSG::FieldIndexEditMethodSig
>(
51 &OSG::TestAtt::editDynamicField
),
52 static_cast<OSG::FieldIndexGetMethodSig
>(
53 &OSG::TestAtt::getDynamicField
));
56 // CHECK(tp != OSG::NULL);
58 OSG::UInt32 fIndex
= tp
->addField(*pDesc
);
60 // CHECK(fIndex != 0);
62 OSG::GetFieldHandlePtr pFI
= tp
->getDynamicField(fIndex
);
64 // CHECK(pFI != NULL);
66 OSG::GetFieldHandlePtr pFN
= tp
->getDynamicFieldByName("foo");
68 // CHECK(pFI != NULL);
70 OSG::Attachment::getClassType().dump();
71 OSG::TestAtt::getClassType().dump();
74 OSG::SFUnrecNodePtr::getClassType().dump();
75 OSG::MFUnrecNodePtr::getClassType().dump();
77 OSG::SFUnrecFieldContainerPtr::getClassType().dump();
78 OSG::MFUnrecFieldContainerPtr::getClassType().dump();