Thanks for all, I'll try with reference and not by copy (I didn't think
about that)
Thanks
Regards,
Vincent.
2008/5/23 Paul Melis <[EMAIL PROTECTED]>:
> Are you sure you understand the basic concept that ref_ptr together with
> osg::Referenced implements?
> You might want to read
> http://andesengineering.com/OSG_ProducerArticles/RefPointers/RefPointers.html.
> ..
>
> The return value is the instance being pointed to by the ref_ptr instance.
> When you call release() it decrements the instances it's pointing at and
> returns it.
> Method unref_nodelete() is a method of osg::Referenced (of which osg::Node
> is a subclass) and, while it decrements the reference count of the instance
> it will not delete it when the reference count reaches zero.
>
> Paul
>
> Vincent Bourdier wrote:
>
> Hi
>>
>> I'm not sure to understand what release() do...
>>
>> T* release() { T* tmp=_ptr; if (_ptr) _ptr->unref_nodelete();
>> _ptr=0; return tmp; }
>>
>>
>> what does unref_nodelete() do ?
>> what does it return really ?
>>
>> Thanks
>> Vincent.
>>
>>
>> 2008/5/23 Paul Melis <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
>>
>>
>> Vincent Bourdier wrote:
>>
>> Hi Robert
>>
>> I've a ref_ptr to put to NULL, but I can't do a simple
>> my_refptr = NULL;
>> I need to set it in a function.
>>
>> In argument of my function, I get a ref_ptr, and in the
>> function, I put this ref_ptr to NULL;
>> I do not return anything.
>>
>>
>> Perhaps ref_ptr::release()?
>>
>> Paul
>>
>>
>> but at the end (going out of the function), my original
>> ref_ptr hasn't been modified...
>>
>> I don't know if it is more understandable, but it's not easy
>> to explain...
>>
>> Thanks for help.
>> Vincent.
>>
>> 2008/5/23 Robert Osfield <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>
>> <mailto:[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>>>:
>>
>>
>> Hi Vincent,
>>
>> I don't know if anyone else can make sense of what you are
>> trying to
>> do, based on your email, but I'm just lost. I kinda doubt
>> the problem
>> is really about ref_ptr<>, but something related to the
>> overall code
>> that you have written, but since I can't really spot what
>> you intend
>> or what might be going on I certainly can't help.
>>
>> Robert.
>>
>> On Fri, May 23, 2008 at 9:02 AM, Vincent Bourdier
>> <[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>
>> <mailto:[EMAIL PROTECTED]
>> <mailto:[EMAIL PROTECTED]>>>
>>
>> wrote:
>> > Hi all,
>> >
>> > I'm making some function to modify graph after some
>> operation,
>> and so I need
>> > to call some simple actions in functions.
>> >
>> > The problem is about ref_ptr :
>> >
>> > I need to do this :
>> >
>> > osg::ref_ptr<osg::Group> mygroup;
>> > [..]
>> > mygroup = NULL;
>> > [...]
>> >
>> > To do that in a function, I use someting like :
>> > addonstack(mygroup, NULL); //prototype is :
>> > addonstack(osg::ref_ptr<osg::Group> caller, osg::Node* arg1);
>> >
>> > which did this :
>> > osg::ref_ptr<osg::Node> nd =
>> dynamic_cast<osg::Node*>(caller.get());
>> > if(nd.get()){
>> > nd =arg1;
>> >
>> > But, the problem is that it doesn't change anything... I
>> need,
>> without
>> > making some modifications in the addonstack prototype, a
>> way to
>> put the
>> > ref_ptr to NULL .
>> >
>> > Any idea ?
>> > Thanks.
>> >
>> > Regards,
>> > Vincent.
>> >
>> > _______________________________________________
>> > osg-users mailing list
>> > [email protected]
>> <mailto:[email protected]>
>> <mailto:[email protected]
>> <mailto:[email protected]>>
>>
>> >
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> >
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> <mailto:[email protected]>
>> <mailto:[email protected]
>> <mailto:[email protected]>>
>>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> <mailto:[email protected]>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> <mailto:[email protected]>
>>
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org