[hdf-forum] How best to model objects that have lists of sub objects.
Peter Alexander
vel.accel at gmail.com
Tue Jun 23 13:37:59 EDT 2009
On Tue, Jun 23, 2009 at 11:34 AM, Richard
Corden<richard.corden at gmail.com> wrote:
> Hi Quincey,
>
>
> Quincey Koziol wrote:
>>
>> Hi Richard,
>>
>> On Jun 18, 2009, at 3:36 PM, Richard Corden wrote:
>>
>>> Hi,
>>>
>>> I am unable to find a satisfactory way to model object hierarchies,
>>> specifically something as follows:
>>>
>>> class B { ... };
>>>
>>> class A {
>>> std::vector <B> m_b;
>>> };
>>>
>>>
>>> Here are some of my requirements:
>>> * The number of B's is relatively small, probably lower than 10
>>> * There's no upper bound
>>> * It needs to be possible to append data later
>>> * The order the items are written needs to be preserved
>>>
> [...]
>
>> Have you tried creating a group for each 'A' and making each 'B' a
>> dataset with an unlimited 1-D dimension, with a datatype that matches 'B' in
>> memory? Then, each vector of 'B' elements can be easily extended and
>> appended to in an independent way.
>
> I haven't tried this yet, but it will have to be a last resort as I've
> invested quite a bit of time designing a framework based on HDF5 where each
> object is a dataset row. (FYI, I've written reader/writer objects where the
> interface uses tuples from the boost library (www.boost.org). Each part of
> the tuple has an identifier and a value, which write out as if it was a HDF
> Compound type).
>
> I've managed to work around the size problem by storing the start and end
> indexes rather than references. I always know the dataset that it refers to
> so that information wasn't required. So far, read/write times are good and
> file size is good too.
>
> Thanks for your help!
>
> Cheers,
>
> Richard
>
>
>
>>
>> Quincey
>>
>
>
> ----------------------------------------------------------------------
> This mailing list is for HDF software users discussion.
> To subscribe to this list, send a message to
> hdf-forum-subscribe at hdfgroup.org.
> To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
>
>
The 'Root' software package seems to have a successful object state
persistence model where scalability and the file format specification
is similar to that of the HDF5 spec. With there model in mind, I could
see scalable, flexible, object persistence in HDF5 with out too much
difficulty.
The 'Root' documentation has detailed their persistence model in
detail. It's worth seeing what they do and how it might be adopted to
our favorite data storage facility... HDF5 :-)
----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.
More information about the Hdf-forum
mailing list