Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][Variant] Sequence instantiation
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-08-27 19:45:21


On Thu, Aug 27, 2009 at 4:43 PM, Ryan McConnehey<mccorywork_at_[hidden]> wrote:
>
>> I do not suppose you could show some pseudo-code of what you want?
>>
>
> In the xml file a parameter has an element entry and is placed into the
> following structure.
>
> <field name="velocity_x" type="uint8_t" destination_byte="0"/>
>
> struct Desintation {
>  unsigned char source_bit;
>  unsigned long length;
>  unsigned long destination_byte;
>  unsigned char destinatoin_bit_of_byte;
> };
>
> Upon parsing the xml file the string name of the type must be converted into
> the actual type.  Then the size of the type must calculated and placed into
> the length variable.  From this class the Destination structure needs to be
> passed back if the parameter name and type matches the recorded information
> in the xml file.  A peudo function is as follows.
>
> template <typename T>
> std::vector<Destination> get(std::string name) {
>  Assert if T isn't in the defined list of support types.
>  Search the storage container for the parameter name and type.
>  if parameter name and type match return the stored vector of Destination
> structures.
>  else return an empty vector of Destination structures.
> }
>
> A vector of Destination structures is stored because a parameter name can
> have sub-elements that describe bit locations of data that are used to
> retrieve the overall parameter value.
>
> Let me know what you think.

Ah, for something like that I personally would use Variant to hold it
all, Spirit2.1 (with stringtable > continued parsing trick, Spirit2.1
is in the boost trunk but it works on older boosts' too) to parse it,
would give the best speed and is easily extensible in the future while
being completely typesafe.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net