Boost logo

Boost :

From: Scott Woods (scottw_at_[hidden])
Date: 2002-08-11 20:10:53


Hi Boosters,

This is my first post so I will include a bit of a preamble.

Have been listening in for a few months and have been blown away by the quality
of discussions (at least those that I have understood). Have only recently got to
a position of confidence with C++ myself and then I discover a new level going on
at boost.org. Bring it on!

I have enjoyed introducing regex and some ptr into my work. As I understand it
more, I hope to incorporate more of boost. At the moment I think its my hurting brain
slowing the process down. But anyway, I'll jump to the (hopefully) interesting bit...

The area that I have been working in for a few years (telephony) is full of state
machines. Cleanly capturing this abstraction in C/C++ has been an interest for
some time. After working my way through STL and some Boost I have got my
understanding of templates to a point where I can apply them. This application of
templates to capturing of the state machine abtraction, feels strong.

I have attached an example of the technique. The example is missing all sorts of
error checking but hopefully succeeds as a presentation. It intentionally doesnt
use STL or boost.

What I was hoping for was for boost expertise. Diving into the likes of bind (after
discarding mem_fun was interesting but its always a while before you can sift
things down to the "right" way of doing something. Does anyone want to jump
in there and flex some boost muscle? Extending the technique to deal with
polymorphism (different types of state_machines) makes things more interesting.
 
My general goal has been to create a coding environment that allows definition
of state machine code like below. This is in the belief that clarity of this code
has a pretty high priority.

state_machine::handler_for_state( machine_event )
{
    switch( machine_event )
    {
    case E1: return handler_for_next_state;
    default: break;
    }
    return current;
}

Hope I have given enough information and that the subject is appropriate. And
keep it up boost.

Thanks,
Scott Woods





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk