Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / clone and Instance object?

Author
Message
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 13th Aug 2005 03:53
not sure if this is a bug or my bad coding. anyways does clone object and Instance object work. i have tried both and all of them displays nothing.

has anybody used them yet.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 13th Aug 2005 11:07
Try this :



AtomZ - its got an A. Its got a Z. Now its just needs U
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 14th Aug 2005 08:42
thanks man, didn't think of doing that at the time seams like there is is bug in my code somewhere.

if i do this it will not work.


but if i do this it will.


for that i will find out whats going on. but do you know how to have a class that inherts from another access private varibles.

this is my BasicObject class witch InstanceObject inherits from.
i would like to keep ObjectRef private but i am not sure how i can do that and still have InstanceObject work by passing the object to it.
do you have any ideas how to. or is it not possible.


http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 14th Aug 2005 13:41
It sounds like your trying to pass instance/clone values of which both parameters are the same.

Maybe worth putting in an ASSERT(O->Ref()== Other.O->Ref()); in that function...

As for your private problem, I cant really help there - dont use C++ that much I'm afraid. IanM may be able to help - he's a rabid fan of C++

AtomZ - its got an A. Its got a Z. Now its just needs U
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 15th Aug 2005 07:23
i added some more code to see if there where the same and O->ref() = 9 and Other->Ref() = 7 so there not the same. something is going on there haven't had the time today to check it out. probally won't get around to it tell next weekend.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 15th Aug 2005 08:47
Its also possible of course that the object trying to be cloned doesn't exist.

AtomZ - its got an A. Its got a Z. Now its just needs U
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Aug 2005 14:52 Edited at: 15th Aug 2005 14:53
Create a new InstancedObject class that inherits from BasicObject ... something like this:



I've never used instanced objects before, but if you must ensure that the original always exists while an instance exists, then just add a shared_ptr (boost::shared_ptr<ObjectRef> ) to this class and copy the base objects O pointer to it - call it something like 'OtherO'.

You may also need to create another constructor for when you construct from another instanced object, to use the 'OtherO' instead of 'O' to get the reference.

[EDIT]Darned smilies! Corrupting my code.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
zao420
21
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 20th Aug 2005 23:03
well i had some time to look at my code today, and i realized the problem, i forgot about scope, so when i instanced a object it would go out of scope and then destroy that object. so when i add the ref()+1 it would destroy a object that wasn't there and keep the object.

but it wasn't a total waste of time i did learn some new stuff well debuging it.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com

Login to post a reply

Server time is: 2024-11-19 01:33:34
Your offset time is: 2024-11-19 01:33:34