
On 02/21/13 12:53, Chris Stankevitz wrote:
On Thu, Feb 21, 2013 at 9:04 AM, Larry Evans
wrote: How do you decide whether the Stream argument to Decode contains a String or a Double? Is that already known? IOW, if you open the istream, do you *know* what types it contains already and only need to fill in the values?
Thank you all for your interest and help. I LOVE boost and have been using it for almost a year now. I cannot live without signals2, thread, and shared_ptr. They have changed the way I. I am eager to learn about the other components.
I created a simple program that basically does what I want to do. Of course in my real application the objects are more complicated and this is just one small piece of everything I need to do.
What I hope to highlight with this sample cpp is:
1. I am decoding data. The format is about as simple and "fixed" as you can imagine.
2. The data is not "POD-encoded" values. Sometimes I have to perform conversions on the values. For example "temperature" in the example.
3. I would like to keep track of some static known-at-compile-time meta-data for each of the values such as the units they are in. This I use for display purposes.
4. Some values have meta data that other values do not, such as floating point values which have a "number of significant digits after the decimal point" which I illustrate with the "temperature" example.
5. I will have many values. ~60. In my example I attempt to highlight what a mess the class will turn into if I make no attempt to use boost::variant, boost::any, polymorphism, etc.
6. An external class "TCTimer" in my example will want access to Get/Set values in the class.
7. I appear to be confusing/merging several concepts: 1) decoding 2) tracking meta data for members 3) replace-lots-of-members-and-with-a-vector-of-something-like-boost::variant
This 7th feature is not represented by your example code. The example
code suggests the type being read is already known. OTOH, your
previous example code had a vector of pointers to an abstract class:
class EmployeePacket
{
std::vector
Again, thank you,
Chris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users