Re: Writing an IDL application using a C++ data model. [message #56776 is a reply to message #56689] |
Mon, 12 November 2007 11:52   |
Robbie
Messages: 165 Registered: February 2006
|
Senior Member |
|
|
Thanks for the reply. I don't envy whoever has to decide on the *best*
binding method.
>> 2) C++ is much faster and flexible for organising meta data. IDL
>> structures are slow and tend towards disorganisation.
It's a bit of a broad statement and I couldn't think about how to
narrow it down. I was actually referring to certain uses of structures
and objects.
A good example is that I have a set of heirarchical meta data. Nuclear
medicine files
have up to 8 dimensions, each representing detector head, energy
window, time sequence... and finally 3D spatial data.
It's far more convenient to simply represent the last 3 dimensions as
an associated variable and then use objects to categorise framesets of
data.
Many objects have vector properties. For example, a time sequence
object might have a 1D array FRAME_DURATION property.
The OO implementation gives me a chance to enforce constraints on the
property types. Because I'm using vectors, I end up with a structure
containing PTRs.
struct = {MY_OBJECT,$
frame_duration: ptr_new()}
I think why bother with a structure at all? In fact I am currently
using an array of PTRs and array of strings because it is easier and
probably just as fast.
struct = {MY_OBJECT,$
identifiers: ptr_new(), $
values: ptr_new() $
}
At this point I wonder if I'm departing from a sensible usage of IDL.
I think IDL is a bit slow with method calls, particularily when I'm
looking for a child object with a particular property. A typical speed
up trick is to use a common variable as the backing store for that
property and search it using WHERE()
function my_object::findHeight, height
common MY_OBJECT, my_objects, my_object_height, my_object_parent
inds = where((height eq my_object_height) and (my_object_parent eq
self))
return, my_objects[inds[0]]
end
pro my_height::setProperty, HEIGHT=h
common MY_OBJECT, my_objects, my_object_height, my_object_parent
inds = where(self eq my_objects)
my_object_height[inds[0]] = h
end
So it seems that in order to get optimal performance from IDL, I must
fiddle with the backing store of objects. From my very limited
experience (very limited!) I suspect that I don't have to worry about
this is C++. I can rely on the standard library to sort this kind of
thing out for me.
Thanks
Robbie
|
|
|