From: Braden M. <br...@en...> - 2008-07-23 09:28:43
|
On Wed, 2008-07-23 at 12:31 +0400, Murashov Gleb wrote: > Hi. > > Could you tell me, please, how function > openvrml::node_type::create_node() is supposed to be used? > I'm asking, because I'm little bit confused that one get shared_ptr< > scope > as parameter and openvrml::node use shared_ptr inside, but > node::scope() and scene::root_scope() return scope& and scope*. > Is it bug? No. Nodes participate in ownership of scopes. There's not a reason to propagate ownership of scopes to other types of objects. node_type::create_node is a rather low-level operation from OpenVRML's perspective. That is not to say that you shouldn't be using it; just be aware that browser::create_vrml_from_stream may be an appropriate alternative. > Another question: everywhere, working with object openvrml::node, > intrusive_ptr is used, but openvrml::scope::find_node() returns > openvrml::node*. Although in this case safe work is possible, I think > that it is not in right way. You can safely construct an intrusive_ptr from a raw pointer whenever you need to create an owning pointer. (Notwithstanding, of course, the potential to create ownership cycles--which you are responsible for avoiding/accommodating.) -- Braden McDaniel e-mail: <br...@en...> <http://endoframe.com> Jabber: <br...@ja...> |