Hi Gerrit,
Gerrit Voss wrote:
- If there are no constraints on the fields, like custom access
or NULL checks forced by the container, fields can be written
directly.
nice, I like having this in the fcd.
- Old XXPtr typedefs and NullFC are gone
Mainly because I want to reuse them to get the 1.x compat stuff right.
NullFC for example has the problem that it is used as OSG::NullFC by
1.x app code and this does not work well with the 2.x
#define NullFC NULL.
so the right way to test this is to compare with NULL, yes ?
And what is the preferred way to refer to SomeContainer * ?
SomeContainer * or SomeContainerCPtr or SomeContainer::ObjCPtr ?
Similar the old Ptr typedef would be C ptrs now and keeping them this
way will interfere with the RefCounting as during porting the compiler
complains only about the initial XXPtr = XX::create() assignments.
Hope I did not miss any major point, so any comments ??
- the ability to get either a reference or a pointer to field is gone,
the {get|edit}{SF|MF}<FieldName>() accessors always return pointers
(this is not new) and the {get|edit}<FieldName> accessors are gone. Just
mentioning it, as it requires (basically) mechanical changes in
potentionally many spots.
PS: There are still some open issues, e.g. completion of the generic
interface, DynFieldAttachment stuff but these usually are not the
central interface pieces.
But I'm running already really late on other things I have to
finish, so I want to put this out and collect some feedback while
doing other stuff.
Later I'll commit two patches (also attached), one to add a missing
c'tor to RefCountPtr<> and remove one redundant one; the other one fixes
the unittests (expect maybe
Source/System/NodeCores/Drawables/Geometry/Base/WS/OSGGeometryTest.cpp
which has additional changes here and will be committed separately).
Thanks,
Carsten
Index: Source/System/FieldContainer/Base/OSGRefCountPtr.h
===================================================================
--- Source/System/FieldContainer/Base/OSGRefCountPtr.h (revision 1202)
+++ Source/System/FieldContainer/Base/OSGRefCountPtr.h (working copy)
@@ -90,10 +90,11 @@
template <class OtherObjectT>
RefCountPtr(TransitPtr<OtherObjectT> const &other);
+
+ template <class OtherObjectT, class OtherRefCountPolicyT>
+ RefCountPtr(RefCountPtr<OtherObjectT,
+ OtherRefCountPolicyT> const &other);
- explicit
- RefCountPtr(ObjectTransitPtr &other);
-
RefCountPtr(Object * const pObj );
/*! \} */
Index: Source/System/FieldContainer/Base/OSGRefCountPtr.inl
===================================================================
--- Source/System/FieldContainer/Base/OSGRefCountPtr.inl (revision 1202)
+++ Source/System/FieldContainer/Base/OSGRefCountPtr.inl (working copy)
@@ -58,13 +58,6 @@
}
template <class ObjectT,
- class RefCountPolicyT> inline
-RefCountPtr<ObjectT, RefCountPolicyT>::RefCountPtr(ObjectTransitPtr &other)
-{
- RefCountPolicy::convertTransitPtr(_pObj, other._pObj);
-}
-
-template <class ObjectT,
class RefCountPolicyT>
template <class OtherObjectT > inline
RefCountPtr<ObjectT, RefCountPolicyT>::RefCountPtr(
@@ -75,7 +68,22 @@
RefCountPolicy::convertTransitPtr(_pObj, other._pObj);
}
+template <class ObjectT,
+ class RefCountPolicyT >
+template <class OtherObjectT,
+ class OtherRefCountPolicyT> inline
+RefCountPtr<ObjectT, RefCountPolicyT>::RefCountPtr(
+ RefCountPtr<OtherObjectT, OtherRefCountPolicyT> const &other) :
+
+ _pObj(NULL)
+{
+ ObjectT *pOther = other.get();
+ RefCountPolicyT::addRef(pOther);
+
+ _pObj = pOther;
+}
+
template <class ObjectT,
class RefCountPolicyT> inline
RefCountPtr<ObjectT, RefCountPolicyT>::RefCountPtr(
Index: Source/System/NodeCores/Groups/Misc/OSGNodeTest.cpp
===================================================================
--- Source/System/NodeCores/Groups/Misc/OSGNodeTest.cpp (revision 1202)
+++ Source/System/NodeCores/Groups/Misc/OSGNodeTest.cpp (working copy)
@@ -40,7 +40,7 @@
#include <OpenSG/OSGNode.h>
#include <OpenSG/OSGNameAttachment.h>
-#include <OpenSG/OSGFieldContainerAttachment.h>
+#include <OpenSG/OSGAttachment.h>
#include <OpenSG/OSGDynamicAttachmentMixin.h>
#include <OpenSG/OSGBillboard.h>
@@ -55,14 +55,13 @@
struct TestAttDesc
{
- typedef OSG::FieldContainerAttachment Parent;
- typedef OSG::FieldContainerAttachmentPtr ParentPtr;
+ typedef OSG::Attachment Parent;
// TODO rename it to VRMLGenericAtt ????
static const OSG::Char8 *getTypeName (void) { return "TestAtt"; }
static const OSG::Char8 *getParentTypeName (void)
{
- return "FieldContainerAttachment";
+ return "Attachment";
}
static const OSG::Char8 *getGroupName (void) { return "TestGenAtt"; }
@@ -72,7 +71,10 @@
};
typedef OSG::DynFieldAttachment<TestAttDesc> TestAtt;
-typedef TestAtt::ObjPtr TestAttPtr;
+typedef TestAtt::ObjTransitPtr TestAttTransitPtr;
+typedef TestAtt::ObjRecPtr TestAttRecPtr;
+typedef TestAtt::ObjUnrecPtr TestAttUnrecPtr;
+typedef TestAtt::ObjWeakPtr TestAttWeakPtr;
OSG_DYNFIELDATTACHMENT_INST(TestAttDesc)
@@ -83,20 +85,20 @@
TEST(CreateNode)
{
- OSG::NodePtr n = OSG::Node::create();
- CHECK(n != OSGNullFC);
+ OSG::NodeUnrecPtr n = OSG::Node::create();
+ CHECK(n != NULL);
}
// --- Cloning --- //
TEST(TreeCloningName)
{
- OSG::NodePtr root = OSG::Node::create();
- OSG::NodePtr child_node = OSG::Node::create();
+ OSG::NodeUnrecPtr root = OSG::Node::create();
+ OSG::NodeUnrecPtr child_node = OSG::Node::create();
root->addChild(child_node);
OSG::setName(root, "root");
OSG::setName(child_node, "child_node");
- OSG::NodePtr new_root = OSG::cloneTree(root);
+ OSG::NodeUnrecPtr new_root = OSG::cloneTree(root);
CHECK(new_root->getNChildren() == 1);
CHECK(new_root != root);
@@ -148,35 +150,35 @@
s02Node->addChild(g06Node);
}
- OSG::GroupPtr g01Core;
- OSG::SwitchPtr s01Core;
- OSG::TransformPtr t01Core;
- OSG::GroupPtr g02Core;
- OSG::BillboardPtr b01Core;
- OSG::GroupPtr g03Core;
- OSG::GroupPtr g04Core;
- OSG::BillboardPtr b02Core;
- OSG::SwitchPtr s02Core;
- OSG::GroupPtr g05Core;
- OSG::GroupPtr g06Core;
+ OSG::GroupRecPtr g01Core;
+ OSG::SwitchRecPtr s01Core;
+ OSG::TransformRecPtr t01Core;
+ OSG::GroupRecPtr g02Core;
+ OSG::BillboardRecPtr b01Core;
+ OSG::GroupRecPtr g03Core;
+ OSG::GroupRecPtr g04Core;
+ OSG::BillboardRecPtr b02Core;
+ OSG::SwitchRecPtr s02Core;
+ OSG::GroupRecPtr g05Core;
+ OSG::GroupRecPtr g06Core;
- OSG::NodePtr g01Node;
- OSG::NodePtr s01Node;
- OSG::NodePtr t01Node;
- OSG::NodePtr g02Node;
- OSG::NodePtr b01Node;
- OSG::NodePtr g03Node;
- OSG::NodePtr g04Node;
- OSG::NodePtr b02Node;
- OSG::NodePtr s02Node;
- OSG::NodePtr g05Node;
- OSG::NodePtr g06Node;
+ OSG::NodeRecPtr g01Node;
+ OSG::NodeRecPtr s01Node;
+ OSG::NodeRecPtr t01Node;
+ OSG::NodeRecPtr g02Node;
+ OSG::NodeRecPtr b01Node;
+ OSG::NodeRecPtr g03Node;
+ OSG::NodeRecPtr g04Node;
+ OSG::NodeRecPtr b02Node;
+ OSG::NodeRecPtr s02Node;
+ OSG::NodeRecPtr g05Node;
+ OSG::NodeRecPtr g06Node;
};
TEST_FIXTURE(CloneFixture, CloneTree)
{
// test cloneTree - all shared
- OSG::NodePtr clone01 = OSG::cloneTree(g01Node);
+ OSG::NodeUnrecPtr clone01 = OSG::cloneTree(g01Node);
CHECK(clone01 != g01Node);
CHECK(clone01->getCore() == g01Core);
@@ -185,7 +187,7 @@
CHECK(clone01->getChild(2)->getCore() == g02Core);
// test cloneTree - clone Switch
- OSG::NodePtr clone02 = OSG::cloneTree(g01Node, "Switch", "");
+ OSG::NodeUnrecPtr clone02 = OSG::cloneTree(g01Node, "Switch", "");
CHECK(clone02->getCore() == g01Core);
CHECK(clone02->getChild(0)->getCore() != s01Core);
@@ -195,19 +197,19 @@
CHECK(clone02->getChild(2)->getCore() == g02Core);
// test cloneTree - clone Billboard, ignore Switch
- OSG::NodePtr clone03 = OSG::cloneTree(g01Node, "Billboard", "Switch");
+ OSG::NodeUnrecPtr clone03 = OSG::cloneTree(g01Node, "Billboard", "Switch");
CHECK(clone03->getCore() == g01Core);
CHECK(clone03->getChild(0)->getChild(0)->getCore() != b01Core);
- CHECK(clone03->getChild(0)->getCore() == OSGNullFC);
+ CHECK(clone03->getChild(0)->getCore() == NULL);
CHECK(clone03->getChild(2)->getChild(0)->getCore() != b02Core);
- CHECK(clone03->getChild(2)->getChild(1)->getCore() == OSGNullFC);
+ CHECK(clone03->getChild(2)->getChild(1)->getCore() == NULL);
}
TEST_FIXTURE(CloneFixture, DeepCloneTree)
{
// test deepCloneTree - all cloned
- OSG::NodePtr clone01 = OSG::deepCloneTree(g01Node);
+ OSG::NodeUnrecPtr clone01 = OSG::deepCloneTree(g01Node);
CHECK(clone01 != g01Node);
CHECK(clone01->getCore() != g01Core);
@@ -219,25 +221,25 @@
"Switch") == 0 );
// test deepCloneTree - share Switch
- OSG::NodePtr clone02 = OSG::deepCloneTree(g01Node, "Switch");
+ OSG::NodeUnrecPtr clone02 = OSG::deepCloneTree(g01Node, "Switch");
CHECK(clone02->getCore() != g01Core);
CHECK(clone02->getChild(0) != s01Node);
CHECK(clone02->getChild(0)->getCore() == s01Core);
// test deepCloneTree - share Billboard, ignore Switch
- OSG::NodePtr clone03 = OSG::deepCloneTree(g01Node, "Billboard", "Switch");
+ OSG::NodeUnrecPtr clone03 = OSG::deepCloneTree(g01Node, "Billboard", "Switch");
CHECK(clone03->getCore() != g01Core);
- CHECK(clone03->getChild(0)->getCore() == OSGNullFC);
+ CHECK(clone03->getChild(0)->getCore() == NULL);
CHECK(clone03->getChild(0)->getChild(0)->getCore() == b01Core);
CHECK(clone03->getChild(2)->getChild(0)->getCore() == b02Core);
- CHECK(clone03->getChild(2)->getChild(1)->getCore() == OSGNullFC);
+ CHECK(clone03->getChild(2)->getChild(1)->getCore() == NULL);
}
TEST(DynFieldAttachment)
{
- OSG::TestAttPtr pT = OSG::TestAtt::create();
+ OSG::TestAttUnrecPtr pT = OSG::TestAtt::create();
OSG::FieldDescriptionBase *pDesc = NULL;
@@ -254,7 +256,7 @@
static_cast<OSG::FieldIndexGetMethodSig >(
&OSG::TestAtt::getDynamicField ));
- CHECK(pT != OSGNullFC);
+ CHECK(pT != NULL);
OSG::UInt32 fIndex = pT->addField(*pDesc);
Index: Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorPropertyTest.cpp
===================================================================
--- Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorPropertyTest.cpp (revision 1202)
+++ Source/System/NodeCores/Drawables/Geometry/Properties/OSGGeoVectorPropertyTest.cpp (working copy)
@@ -48,7 +48,7 @@
p3f_0(1.0, 2.0, 3.0),
p3f_1(2.0, 3.0, 4.0),
p3f_2(3.0, 4.0, 5.0),
- propP3f(OSGNullFC)
+ propP3f()
{
propP3f = OSG::GeoPnt3fProperty::create();
@@ -65,13 +65,13 @@
const OSG::Pnt3f p3f_1;
const OSG::Pnt3f p3f_2;
- OSG::GeoPnt3fPropertyPtr propP3f;
+ OSG::GeoPnt3fPropertyUnrecPtr propP3f;
};
TEST_FIXTURE(GeoVectorPropertyFixture, GeoVectorProperty_Pnt3f)
{
- OSG::GeoVectorPropertyPtr prop = propP3f; // throw away static type info
+ OSG::GeoVectorPropertyUnrecPtr prop = propP3f; // throw away static type info
OSG::Pnt2f p2f;
OSG::Pnt2d p2d;
OSG::Pnt2ub p2ub;
Index: Source/System/FieldContainer/Mixins/OSGDynamicAttachmentMixin.h
===================================================================
--- Source/System/FieldContainer/Mixins/OSGDynamicAttachmentMixin.h (revision 1202)
+++ Source/System/FieldContainer/Mixins/OSGDynamicAttachmentMixin.h (working copy)
@@ -80,8 +80,6 @@
OSG_GEN_INTERNALPTR(Self);
- typedef typename AttachmentDescT::ParentPtr ParentPtrType;
-
typedef typename Inherited::TypeObject TypeObject;
typedef typename TypeObject::InitPhase InitPhase;
Index: Source/System/FieldContainer/Base/OSGFieldContainerTest.cpp
===================================================================
--- Source/System/FieldContainer/Base/OSGFieldContainerTest.cpp (revision 1202)
+++ Source/System/FieldContainer/Base/OSGFieldContainerTest.cpp (working copy)
@@ -50,26 +50,26 @@
TEST(refCountAndRefPtr)
{
- OSG::NodePtr np = OSG::Node::create();
- CHECK(np->getRefCount() == 0);
- CHECK(np->getWeakRefCount() == 0);
+ OSG::NodeUnrecPtr np = OSG::Node::create();
+ CHECK_EQUAL(1, np->getRefCount() );
+ CHECK_EQUAL(0, np->getWeakRefCount());
- OSG::UInt32 node_id = getContainerId(np);
+ OSG::UInt32 node_id = np->getId();
CHECK(OSG::FieldContainerFactory::the()->getContainer(node_id) == np);
- OSG::NodeRefPtr r;
+ OSG::NodeUnrecPtr r;
CHECK(!r);
r = np;
CHECK(r);
CHECK(r.get() == np);
- CHECK(np->getRefCount() == 1);
+ CHECK_EQUAL(2, np->getRefCount());
{
- OSG::NodeRefPtr r2(np);
- CHECK(r2);
- CHECK(r2.get() == np);
- CHECK(np->getRefCount() == 2);
+ OSG::NodeUnrecPtr r2(np);
+ CHECK(r2);
+ CHECK(r2.get() == np);
+ CHECK_EQUAL(3, np->getRefCount());
}
}
@@ -140,16 +140,16 @@
TEST(checkMemoryCleanup)
{
// Check to make sure the memory is cleaned up correctly with an FCPtr
- OSG::NodeRefPtr node(OSG::Node::create());
- OSG::UInt32 node_id = OSG::getContainerId(node.get());
- OSG::Int32 ref_count = getRefCount(node.get());
+ OSG::NodeUnrecPtr node(OSG::Node::create());
+ OSG::UInt32 node_id = node->getId();
+ OSG::Int32 ref_count = node->getRefCount();
OSG::commitChanges();
- CHECK(OSG::FieldContainerFactory::the()->getContainer(node_id) != OSGNullFC);
+ CHECK(OSG::FieldContainerFactory::the()->getContainer(node_id) != NULL);
// Now release the ref and check that it was collected
- node = OSGNullFC;
+ node = NULL;
OSG::commitChanges();
- CHECK(OSG::FieldContainerFactory::the()->getContainer(node_id) == OSGNullFC);
+ CHECK(OSG::FieldContainerFactory::the()->getContainer(node_id) == NULL);
}
@@ -159,15 +159,15 @@
{
// The idea here is to try to force a subref/addref change using an old
// entry that would contain invalid data
- OSG::NodeRefPtr outer_node(OSG::Node::create());
- OSG::NodeRefPtr outer_node2(OSG::Node::create());
+ OSG::NodeUnrecPtr outer_node(OSG::Node::create());
+ OSG::NodeUnrecPtr outer_node2(OSG::Node::create());
for(unsigned i=0;i<100;i++)
{
if ((i%5) == 0)
- { outer_node = OSG::NodeRefPtr(OSG::Node::create()); }
+ { outer_node = OSG::NodeUnrecPtr(OSG::Node::create()); }
- OSG::NodeRefPtr temp_node = outer_node2;
- OSG::NodeRefPtr temp_node2 = outer_node2;
+ OSG::NodeUnrecPtr temp_node = outer_node2;
+ OSG::NodeUnrecPtr temp_node2 = outer_node2;
OSG::commitChanges();
OSG::Thread::getCurrentChangeList()->commitChangesAndClear();
@@ -233,7 +233,7 @@
// Allocate and deallocate some memory
for (unsigned i=0; i<1000;i++)
{
- OSG::NodeRefPtr n(OSG::Node::create());
+ OSG::NodeUnrecPtr n(OSG::Node::create());
}
// Now try some things that should fail
Index: Source/System/FieldContainer/Base/OSGFieldContainerTypeTest.cpp
===================================================================
--- Source/System/FieldContainer/Base/OSGFieldContainerTypeTest.cpp (revision 1202)
+++ Source/System/FieldContainer/Base/OSGFieldContainerTypeTest.cpp (working copy)
@@ -49,14 +49,14 @@
TEST(CreateType)
{
- OSG::NodePtr n = OSG::Node::create();
+ OSG::NodeUnrecPtr n = OSG::Node::create();
OSG::FieldContainerType& n_type(n->getType());
- CHECK(n != OSGNullFC);
+ CHECK(n != NULL);
}
TEST(GetDocs)
{
- OSG::GroupPtr tc = OSG::Group::create();
+ OSG::GroupUnrecPtr tc = OSG::Group::create();
OSG::FieldContainerType& group_type = tc->getType();
std::string fcd_xml = group_type.getFcdXML();
@@ -68,7 +68,7 @@
TEST(GetFieldDocs)
{
- OSG::GroupPtr tc = OSG::Group::create();
+ OSG::GroupUnrecPtr tc = OSG::Group::create();
OSG::FieldContainerType& group_type(tc->getType());
unsigned num_field_descs = group_type.getNumFieldDescs();
Index: Source/System/FieldContainer/Base/OSGReflexiveContainerTypePredicatesTest.cpp
===================================================================
--- Source/System/FieldContainer/Base/OSGReflexiveContainerTypePredicatesTest.cpp (revision 1202)
+++ Source/System/FieldContainer/Base/OSGReflexiveContainerTypePredicatesTest.cpp (working copy)
@@ -46,7 +46,7 @@
#include <OpenSG/OSGReflexiveContainerTypePredicates.h>
#include <OpenSG/OSGAttachmentContainer.h>
-#include <OpenSG/OSGFieldContainerAttachment.h>
+#include <OpenSG/OSGAttachment.h>
#include <OpenSG/OSGNode.h>
#include <OpenSG/OSGNodeCore.h>
Index: Source/System/FieldContainer/Misc/OSGContainerCollectionTest.cpp
===================================================================
--- Source/System/FieldContainer/Misc/OSGContainerCollectionTest.cpp (revision 1202)
+++ Source/System/FieldContainer/Misc/OSGContainerCollectionTest.cpp (working copy)
@@ -38,128 +38,131 @@
// Unit tests for vec classes
-#include <OpenSG/OSGContainerPool.h>
+#include <OpenSG/OSGContainerCollection.h>
#include <OpenSG/OSGNode.h>
#include <OpenSG/OSGGroup.h>
#include <OpenSG/OSGBlendChunk.h>
#include <OpenSG/OSGNameAttachment.h>
-SUITE(ContainerPoolTests)
+SUITE(ContainerCollectionTests)
{
TEST(CreatePool)
{
- OSG::ContainerPoolPtr cp = OSG::ContainerPool::create();
- CHECK(cp != OSGNullFC);
+ OSG::ContainerCollectionUnrecPtr cc = OSG::ContainerCollection::create();
+ CHECK(cc != NULL);
}
TEST(SettingName)
{
- OSG::ContainerPoolPtr cp1(OSG::ContainerPool::create()),
- cp2(OSG::ContainerPool::create()),
- cp3(OSG::ContainerPool::create());
+ OSG::ContainerCollectionUnrecPtr cc1(OSG::ContainerCollection::create()),
+ cc2(OSG::ContainerCollection::create()),
+ cc3(OSG::ContainerCollection::create());
- CHECK(cp1 != OSGNullFC);
- CHECK(cp2 != OSGNullFC);
- CHECK(cp3 != OSGNullFC);
+ CHECK(cc1 != NULL);
+ CHECK(cc2 != NULL);
+ CHECK(cc3 != NULL);
- CHECK(cp1 != cp2);
- CHECK(cp1 != cp3);
- CHECK(cp2 != cp3);
+ CHECK(cc1 != cc2);
+ CHECK(cc1 != cc3);
+ CHECK(cc2 != cc3);
- cp1->setName("cp1");
- cp2->setName("cp2");
- cp3->setName("cp3");
+ cc1->setName("cc1");
+ cc2->setName("cc2");
+ cc3->setName("cc3");
- CHECK(cp1->getName() == "cp1");
- CHECK(cp2->getName() == "cp2");
- CHECK(cp3->getName() == "cp3");
+ CHECK(cc1->getName() == "cc1");
+ CHECK(cc2->getName() == "cc2");
+ CHECK(cc3->getName() == "cc3");
- CHECK(cp1->getName() != "cp2");
- CHECK(cp1->getName() != "cp3");
+ CHECK(cc1->getName() != "cc2");
+ CHECK(cc1->getName() != "cc3");
}
TEST(UsePool)
{
- OSG::ContainerPoolPtr cp = OSG::ContainerPool::create();
- CHECK(cp != OSGNullFC);
+ OSG::ContainerCollectionUnrecPtr cc = OSG::ContainerCollection::create();
+ CHECK(cc != NULL);
- OSG::GroupPtr t = OSG::Group ::create();
- OSG::NodePtr n = OSG::Node ::create();
- OSG::BlendChunkPtr bc = OSG::BlendChunk::create();
+ OSG::GroupUnrecPtr t = OSG::Group ::create();
+ OSG::NodeUnrecPtr n = OSG::Node ::create();
+ OSG::BlendChunkUnrecPtr bc = OSG::BlendChunk::create();
- cp->setName("cp container");
- cp->addContainer(t);
- cp->addContainer(n);
- cp->addContainer(bc);
+ cc->setName("cc container");
+ cc->addContainer(t);
+ cc->addContainer(n);
+ cc->addContainer(bc);
- CHECK(cp->getNContainers() == 3);
- CHECK(cp->getContainers().size() == 3);
+ CHECK_EQUAL(3, cc->getNContainers());
+ CHECK_EQUAL(3, cc->getMFContainers()->size());
- OSG::FieldContainerPtr t_ptr = cp->getContainers(0);
- OSG::FieldContainerPtr n_ptr = cp->getContainers(1);
- OSG::FieldContainerPtr bc_ptr = cp->getContainers(2);
+ OSG::FieldContainerUnrecPtr t_ptr = cc->getContainers(0);
+ OSG::FieldContainerUnrecPtr n_ptr = cc->getContainers(1);
+ OSG::FieldContainerUnrecPtr bc_ptr = cc->getContainers(2);
CHECK(true);
// Test removal
- cp->subContainer(t);
- CHECK(cp->getNContainers() == 2);
+ cc->subContainer(t);
+ CHECK_EQUAL(2, cc->getNContainers());
- cp->subContainer(n);
- CHECK(cp->getNContainers() == 1);
+ cc->subContainer(n);
+ CHECK_EQUAL(1, cc->getNContainers());
- cp->subContainer(bc);
- CHECK(cp->getNContainers() == 0);
+ cc->subContainer(bc);
+ CHECK_EQUAL(0, cc->getNContainers());
// Try it as an attachment
- OSG::NodePtr root_node = OSG::Node::create();
+ OSG::NodeUnrecPtr root_node = OSG::Node::create();
- OSG::ContainerPoolPtr cp2;
- CHECK(root_node->findAttachment(OSG::ContainerPool::getClassType()) == OSGNullFC);
+ OSG::ContainerCollectionUnrecPtr cc2;
+ CHECK(root_node->findAttachment(OSG::ContainerCollection::getClassType()) == NULL);
- root_node->addAttachment(cp);
+ root_node->addAttachment(cc);
// now find it
- cp2 = dynamic_cast<OSG::ContainerPoolPtr>(
- root_node->findAttachment(OSG::ContainerPool::getClassType()));
- CHECK(cp2 != OSGNullFC);
- CHECK(cp2 == cp);
+ cc2 = dynamic_cast<OSG::ContainerCollection::ObjCPtr>(
+ root_node->findAttachment(OSG::ContainerCollection::getClassType()));
+ CHECK(cc2 != NULL);
+ CHECK(cc2 == cc);
// Name it and find it by name
- OSG::ContainerPoolPtr named_cp = OSG::ContainerPool::create();
- named_cp->setName("MyPool");
+ OSG::ContainerCollectionUnrecPtr named_cc = OSG::ContainerCollection::create();
+ named_cc->setName("MyPool");
for(unsigned i=0;i<10;i++)
{
if(i%2)
{
- root_node->addAttachment(OSG::ContainerPool::create(), i);
+ OSG::ContainerCollectionUnrecPtr new_cc =
+ OSG::ContainerCollection::create();
+
+ root_node->addAttachment(new_cc, i);
}
}
- root_node->addAttachment(named_cp, 7);
+ root_node->addAttachment(named_cc, 7);
unsigned x = 0;
- OSG::ContainerPoolPtr cp3(OSGNullFC);
+ OSG::ContainerCollectionUnrecPtr cc3(NULL);
- while(OSGNullFC == cp3)
+ while(NULL == cc3)
{
- OSG::ContainerPoolPtr temp_cp;
- temp_cp = dynamic_cast<OSG::ContainerPoolPtr>(
- root_node->findAttachment(OSG::ContainerPool::getClassType(), x));
- if((OSGNullFC != temp_cp) && (temp_cp->getName() == "MyPool"))
+ OSG::ContainerCollectionUnrecPtr temp_cc;
+ temp_cc = dynamic_cast<OSG::ContainerCollection::ObjCPtr>(
+ root_node->findAttachment(OSG::ContainerCollection::getClassType(), x));
+ if((NULL != temp_cc) && (temp_cc->getName() == "MyPool"))
{
- cp3 = temp_cp;
- CHECK(cp3 == named_cp);
+ cc3 = temp_cc;
+ CHECK(cc3 == named_cc);
break;
}
x++;
}
CHECK_EQUAL(7, x);
- CHECK_EQUAL(cp3->getName(), "MyPool");
+ CHECK_EQUAL("MyPool", cc3->getName());
}
} // SUITE
Index: Source/System/FileIO/OSB/OSGOSBTest.cpp
===================================================================
--- Source/System/FileIO/OSB/OSGOSBTest.cpp (revision 1202)
+++ Source/System/FileIO/OSB/OSGOSBTest.cpp (working copy)
@@ -69,24 +69,24 @@
TEST_FIXTURE(FileFixture, CreateOSBFile)
{
- OSG::NodePtr n = OSG::Node::create();
+ OSG::NodeUnrecPtr n = OSG::Node::create();
n->setCore(OSG::Group::create());
CHECK(!bf::exists(test_file));
OSG::SceneFileHandler::the()->write(n, test_file.native_file_string().c_str());
CHECK(bf::exists(test_file));
- OSG::NodePtr new_n =
+ OSG::NodeUnrecPtr new_n =
OSG::SceneFileHandler::the()->read(test_file.native_file_string().c_str());
- CHECK(new_n != OSGNullFC);
+ CHECK(new_n != NULL);
}
TEST_FIXTURE(FileFixture, CreateOSBTree)
{
// Test larger tree
- OSG::NodePtr base_node = OSG::Node::create();
+ OSG::NodeUnrecPtr base_node = OSG::Node::create();
base_node->setCore(OSG::Group::create());
- OSG::NodePtr child_node = OSG::Node::create();
+ OSG::NodeUnrecPtr child_node = OSG::Node::create();
child_node->setCore(OSG::Group::create());
base_node->addChild(child_node);
@@ -95,20 +95,20 @@
OSG::SceneFileHandler::the()->write(base_node, test_file.native_file_string().c_str());
CHECK(bf::exists(test_file));
- OSG::NodePtr new_n =
+ OSG::NodeUnrecPtr new_n =
OSG::SceneFileHandler::the()->read(test_file.native_file_string().c_str());
- CHECK(new_n != OSGNullFC);
- CHECK(new_n->getCore() != OSGNullFC);
+ CHECK(new_n != NULL);
+ CHECK(new_n->getCore() != NULL);
CHECK(new_n->getNChildren() == 1);
- CHECK(new_n->getChild(0) != OSGNullFC);
- CHECK(new_n->getChild(0)->getCore() != OSGNullFC);
+ CHECK(new_n->getChild(0) != NULL);
+ CHECK(new_n->getChild(0)->getCore() != NULL);
}
TEST_FIXTURE(FileFixture, TestNameRetention)
{
std::string start_name("node");
- OSG::NodePtr n = OSG::Node::create();
+ OSG::NodeUnrecPtr n = OSG::Node::create();
OSG::setName(n, start_name);
n->setCore(OSG::Group::create());
@@ -116,9 +116,9 @@
OSG::SceneFileHandler::the()->write(n, test_file.native_file_string().c_str());
CHECK(bf::exists(test_file));
- OSG::NodePtr new_n =
+ OSG::NodeUnrecPtr new_n =
OSG::SceneFileHandler::the()->read(test_file.native_file_string().c_str());
- CHECK(new_n != OSGNullFC);
+ CHECK(new_n != NULL);
CHECK(OSG::getName(new_n) != NULL);
std::string cur_name = std::string(OSG::getName(new_n));
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core