fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / FieldContainer / Misc / testNode.cpp
blobf994e74f3bbba8ec409fbbd02f9b6bc596142feb
2 #include "OSGBaseInitFunctions.h"
3 #include "OSGNode.h"
4 #include "OSGNameAttachment.h"
5 #include "OSGDynamicAttachmentMixin.h"
7 OSG_BEGIN_NAMESPACE
9 struct TestAttDesc
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)
18 return "Attachment";
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)
32 OSG_END_NAMESPACE
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(),
44 "foo",
45 "bar",
46 0,
48 false,
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();
72 tp->getType().dump();
74 OSG::SFUnrecNodePtr::getClassType().dump();
75 OSG::MFUnrecNodePtr::getClassType().dump();
77 OSG::SFUnrecFieldContainerPtr::getClassType().dump();
78 OSG::MFUnrecFieldContainerPtr::getClassType().dump();
80 tp = NULL;
82 return 0;