Nick, there's, as usual, no single right answer.
What's the average length of 'offsets' and what's
the length variability?
( 'size_t' is not a good starting point for a machine
independent representation.)

Representing 'offsets' a VLEN has its price: you'll loose
some performance and the ability to use compression on the data set.

If there's a sensible upper bound on the length and only slight
variation in the length, you might stick with a (fixed-size) ARRAY
component.

A compromise would be to separate the two parts of your compound
and have a 'bounding boxes' (+ HDF5 reference) dataset and an 'offsets'
dataset. Entries in the former would be compounds of your
bounding boxes and an HDF5 region reference into a global
'offsets' dataset. (In this simple case, you can think of a region
reference as a (offset, count) pair which references a contiguous
region in a global 'offsets' dataset.)

G.


From: Hdf-forum [mailto:[email protected]] On Behalf Of 
Nicholas Yue
Sent: Monday, October 28, 2013 3:53 PM
To: HDF Users Discussion List
Subject: [Hdf-forum] Creating/storing data of variable length compound members

Hi,

  I would like to store a collection of the following as a compound data

struct MyBox {
  double minX;
  double minY;
  double minZ;
  double maxX;
  double maxY;
  double maxZ;
  std::vector<size_t> offsets;
};

  I have no problem with the POD min* and max*

  However, I am unsure how best to handle std::vector<size_t>

  I read about variable length for string and was wondering if the information 
is applicable.

  Which example code should I consult to have a better understand of variable 
length as used within a compound type ?

Cheers
--
Nicholas Yue
Graphics - RenderMan, Visualization, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue
https://vimeo.com/channels/naiadtools
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to