Hi,
I'm still not completly sure about the correct smart pointer usage.
Please allow me to outline a usage scenario I found in my code:
I have a home grown scene manager class which does manage the scene.
class scene_manager
{
public:
Node* getRoot() { return _node; }
void setRoot(Node* node);
private:
NodeRecPtr _node;
};
At some other place the scene_manager come into existence and the scene
is build.
scene_manager* sm;
void f() {
sm = new scene_manager;
NodeUnrecPtr node = some_create_func();
sm->setRoot(node);
}
NodeTransitPtr some_create_func()
{
NodeUnrecPtr node = Node::create();
NodeUnrecPtr core = Group::create();
node->setCore(core);
return NodeTransitPtr(node);
}
So now for my questions. Can I use the XUnrecPtr pointers in the
'some_create_func' function, or is it necessary to use the XRecPtr
variant? Will my scene be correct in a cluster environment after the
next commitChanges call? Is it then correct that I only need the XRecPtr
at the terminal points of my structures?
Another scenario: Imagine that I have some function f which takes a
native Node pointer parameter. This function internally does store the
Node pointer into a Node(Un)RecPtr. Is my assumption correct that node p
is still valid after f has finished? I.e. that the OpenSG smart pointers
are different from the boost shared_ptr pointers which would delete the
native heap object they are responsible for? Thinking about it, is it
correct that the OpenSG smart pointers are like the boost intrusive
pointers?
void f(Node* p)
{
NodeUnrecPtr x(p);
NodeUnrecPtr y = p;
}
Sorry for boring with these qustions but I would like to do it right in
the first place.
Best regards,
Johannes
____________
Virus checked by G DATA AntiVirusKit
Version: AVF 19.495 from 11.08.2009
Virus news: www.antiviruslab.com
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users