|
Boost Users : |
From: Malcolm Smith (yg-boost-users_at_[hidden])
Date: 2002-12-10 04:48:17
I read Boost.Function info and it sounds like part of the solution.
Is there a way of associating a key with a container of *different*
boost.Function's ?
-- Malcolm Smith MJ Freelancing- http://www.mjfreelancing.com Software Protection for C++Builder Borland Technology Partner "Malcolm Smith" <yg-boost-users_at_[hidden]> wrote in message news:at2uqb$5an$1_at_main.gmane.org... > I'm no expert on these type of libraries but I have come to the point where > I must find time to study *this* library more. > > I have a current project that requires some re-writes in specific areas and > I'm hoping Boost will be able to make this job easier. > > Is there something in boost that will ease the implementation of a > state-machine type functor. > > As an example, I am using a 3rd party C++Builder component that makes socket > connections to hardware devices. I need to modify the connection code so > 'what needs to be done after a connection success/failure' is handled in the > appropriate events. The thing is, this connection event can be called due > to connections in other areas of the application under different conditions. > > If I can implement a state based connection handler then I could re-direct > the calls to the appropriate (alternate) event. > > As an example (I'm only just starting to read up on the STL), I know I could > use a std::map to hold state values as the key and call the appropriate > handler via a pointer to a function in .second - what I'm hoping is there is > a library that allows for unrestricted function signatures (different > parameter lists) to be associated with state values. > > To make this clearer > > // I know this is not valid code but it explains what I'm after > typedef std::map<int, *pf(...)> StateFunctions; > > void Method1(void); > int Method2(TCustomClass &MyClass); > > StateFunctions[1] = Method1; > StateFunctions[2] = Method2; > > > Does this make sense to anyone ? I've probably got all the terminology > wrong so feel free to correct me where ever applicable. > > Thanks in advance. > > -- > Malcolm Smith > MJ Freelancing- http://www.mjfreelancing.com > Software Protection for C++Builder > Borland Technology Partner > > > > > > > > Info: <http://www.boost.org> > Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> > Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]> > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > > >
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