Boost logo

Boost Users :

Subject: [Boost-users] [Boost State Chart] Where to include, where to declare?
From: Philipp Bender (pbender_at_[hidden])
Date: 2012-04-13 09:06:33


Hi all,

today I face some major problems with the state charts. Mostly this
comes from incorrect forward declarations and so on.

I use this scheme for e.g. decaring a state which has orthogonal substates.

I hope my pseudocode is readable.

############# Outer.h ##############

struct Inner1
struct Inner2

struct Outer < Context, InnerDefaults< Inner1, Inner2> > {
        // implementation
}

#include Inner1 // this is the really important part
#include Inner2

############## Inner(1|2).h ########

struct Inner(1|2) < Outer > {
        // implementation
}

#################################

Doing so, I am able to use Outer in the Inner files without including
something and so on -- but as soon as I start to create a file called
"Inner1.cpp" and only write '#include "Inner.h" ' the problems start and
the compiler complains that "Outer" ist not declared (what is true I
guess). What works is to include the "Outermost" which is the state
machine in my case ... but this would mean that every state knows about
my state machine. Also, in my approach the cpp files need to be
recompiled completely every time I think also if only the header of a
completely unrelated state changes (because each cpp includes the
complete state chain).

So ... what's the suggested way to go? I'd like to have as little
dependencies as possible, so not "all_forward_declarations.h" or some
such. I had it like that, and it was a big mess. And I like the states
to be separated ...

Best regards, Philipp


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