Markus Fischer wrote:
> I've been using bit-struct for similar tasks, but it doesn't support
> nesting class definition. However, bit-struct provides a
> round_byte_length() for that purpose.

Can you describe the nesting you are trying to do? Bit-struct does have 
some nesting capability, and my working copy now supports embedded 
vectors (fixed length arrays of bit-structs). This is an addition in the 
last week or so, but I can make it available.

Nesting example:

   class NestedPart < BitStruct
     unsigned :x,    5
     unsigned :y,    3
     char     :s,  5*8
   end

   class Container < BitStruct
     nest    :n1,  NestedPart, "Nest 1"
     nest    :n2,  NestedPart, "Nest 2"
   end

The more or less equivalent effect using vectors instead:

   class MyEntry < BitStruct
     unsigned :x,    5
     unsigned :y,    3
     char     :s,  5*8
   end

   class Container < BitStruct
     vector  :n, MyEntry, "some entries", :length => 2
   end

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407