Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][Variant] Sequence instantiation
From: Ryan McConnehey (mccorywork_at_[hidden])
Date: 2009-08-27 18:43:51


> 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.

Ryan


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