Boost logo

Boost Users :

From: Serena Fritsch (serena.fritsch_at_[hidden])
Date: 2007-04-25 13:02:58


Hi All,
Apologies if there are multiple psoting of this message.
I want to use the boost::statechart library. However i encountered a small
problem with using the orthogonal regions. In the statechart
tutorial, every class declaration is put into one file, however i would like
to put each class declaration into separate files.

An example ( boost specific headers are omitted for readability reasons,
also .cpp files which contain only test functions):
A.h
#include "Machine.h"
class C;
class B;
class A: public sc::simple_state< A, Machine, mpl::list< C, B > > {};

C.h
#include "A.H"
class C: public sc::simple_state<C, A::orthogonal <0> >
{};

B.h
#include "A.H"
class B: public sc::simple_state<B, A::orthogonal <1> >
{};

Machine.h
class A;
class B;
class Machine : public sc::state_machine<Machine, A> {};

Makefile
CXX = g++-3.4
CFLAG = -c -g -w -O0
OBJECTS = Main.o A.o B.o C.o Machine.o

all: $(OBJECTS)
    $(CXX) $(OBJECTS) -o $@

Main.o: Main.cpp
    $(CXX) $(CFLAG) $<

A.o: A.cpp A.h
    $(CXX) $(CFLAG) $<

B.o: B.cpp B.h
    $(CXX) $(CFLAG) $<

C.o : C.cpp C.h
    $(CXX) $(CFLAG) $<
Machine.o: Machine.cpp Machine.h
    $(CXX) $(CFLAG) $<

clean:
    rm -f *.o a.out

.PHONY: clean
.PHONY: all

Compiling this program fails, containing the following error messages
(we only list an excerpt here):

/usr/include/boost/statechart/simple_state.hpp: In static member
function `static void boost::statechart::simple_state<MostDerived,
Context, InnerInitial,
historyMode>::deep_construct_inner_impl_non_empty::deep_construct_inner_impl(const

boost::intrusive_ptr<T>&, typename
Context::inner_context_type::outermost_context_base_type&) [with
InnerList = boost::mpl::list1<B>, MostDerived = A, Context = Machine,
InnerInitial = boost::mpl::list<C, B, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na>, boost::statechart::history_mode historyMode = has_no_history]':

When putting all class declarations into one file, it works perfectly.
So my question now is, is it possible to modularise the different state
 declarations into external files?

Thanks very much for any insights on this

Cheers
Serena



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