Boost logo

Boost Users :

Subject: Re: [Boost-users] Separating templatized on_entry/on_exit into cpp/h
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-04-20 17:40:17


> Hi, thank you for the clarification.
>
> Unfortunately this type of limitations or design constrains really prevent
> Boost from being applied efficiently in production-grade code.

I know of a lot of production-grade code using boost. Anyway I have no
interest in starting such a discussion again.

> 1. Exposing the "guts" is not applicable in wide range of applications, so
> using templates is this case actually makes this library less attractive.

Well yes, this is not a java library. The template is made to avoid getting
the event as IEvent then cast it to the one you hope to get. If your fsm
becomes bigger and events start carrying data, you will get what I mean.

> 2. In addition, the moment we put the business logic into the header files
> it's not a "class template" anymore, and therefore cannot be reused
> efficiently (not to mention the mess if header files includes).

If what you want is hide your logic, you have other options, like for
example:

// PublicClass.hpp
struct PublicClass
{
struct Fsm;
boost::shared_ptr<Fsm> fsm_;
// or boost::shared_ptr<void> fsm_;
};

// PublicClass.cpp
// provide definition of Fsm

It's not that hard to hide your logic. Just add some interface methods in
the public class, the OO way if you are allergic to templates and there you
are.

HTH,
Christophe


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