The only barrier to an efficient/elegant solution is accurately determining the size of the object, so that the exact amount of memory can be "malloc"ed for it.
If any less is provided, the OS will SIGSEGV the living daylights out of my app if it tries to access any object member addressed outside the app's memory.
_______________________________________________
Good judgement comes from Experience.
Most of that comes from Bad Judgement.
_______________________________________________
2011/11/28 James Nzomo
<kazikubwa@gmail.com>
I'm using wxWidgets. It's clipboard mechanism extends the underlying platform's clipboard mechanism.
The object is of a custom class.
This class contains various datatypes ranging from ints,doubles,std::strings,char pointers to custom typedefs, structs and other classes.
The objects i want to D&D are of different types. I will have a clipboard data object for each type as opposed to having an abstract implementation which is more complex.
_______________________________________________
Good judgement comes from Experience.
Most of that comes from Bad Judgement.
_______________________________________________
2011/11/28 Josh Handley
<josh@bridgeinternationalacademies.com>
Are you using the Windows clipboard mechanism (OpenClipboard, SetClipboardData...)?
What does the object look like that you are putting on the clipboard? Is it always the same concrete type or do you have an abstract base class and you are putting different derived types on the clipboard? Is it a simple class with only value members or does it have arrays or pointers to other objects?
Josh
On 28/11/11 12:37 PM, skunkworks-request@lists.my.co.ke wrote:
Message: 3
Date: Mon, 28 Nov 2011 12:35:08 +0300
From: James Nzomo<kazikubwa@gmail.com>
To: Skunkworks Mailing List<skunkworks@lists.my.co.ke>
Subject: Re: [Skunkworks] Size of an object in memory at runtime
Message-ID:
<CAChuKuewWX4DQzr3foEo7KU550vAwzRrevtgVDMw2Tp6Qwz2GQ@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
What i'm trying to do is implement drag& drop clipboard opps for a custom
data object (a custom class/object in this case) that works accross
multiple instances of the same running application.
In order to do this efficiently, i have to allocate the exact amount of
memory required to store the class instance as a D&D object.
The other alternatives would be to give a generous over estimate of the
required memory or to use the objects JSON string as the D&D object. But
the latter requires alot of coding overhead.
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke