Question on Boost::statechart library orthogonal regions

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

Hi Serena
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. [example + error snipped]
I don't see anything suspicious, could you please attach the full source? If it's more than 10KB please send it to me by private email. Thanks, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Hi Andreas, 2007/4/26, Andreas Huber <ahd6974-spamboostorgtrap@yahoo.com>:
Hi Serena
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. [example + error snipped]
I don't see anything suspicious, could you please attach the full source? If it's more than 10KB please send it to me by private email.
Attached you can find the complete source code of the program. Thanks very much for your cooperation. Kind regards Serena Thanks,
-- Andreas Huber
When replying by private email, please remove the words spam and trap from the address shown in the header.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Serena Fritsch wrote:
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. [code & error snipped]
The ultimate problem lies in in Main.cpp (received by private email): <original_code> #include "Machine.h" #include "C.h" #include <iostream> namespace sc = boost::statechart; int main(){ Machine machine; machine.initiate(); machine.displayStateConfiguration(machine); return 0; } </original_code> At the point of initiate() only one part of the initial state configuration is known (C and A). B is missing (which MSVC duly reports with an appropriate error message). Adding the following include to Main.cpp solves the problem: #include "B.h" For more information please see: <http://www.boost-consulting.com/boost/libs/statechart/doc/faq.html#HideInnerWorkings> This item says that the *initial state* must be known at the point of calling initiate() but it should more correctly say that the *initial state configuration* must be known at the point where initiate is called. That is, in addition to the state passed as InitialState to state_machine, all its direct and indirect inner states must also be known. There are ways to enhance encapsulation by means of custom_reactions (which probably need to be triggered by posting internal events in your case), please see: <http://www.boost-consulting.com/boost/libs/statechart/doc/tutorial.html#SpreadingAStateMachineOverMultipleTranslationUnits> HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Andreas Huber wrote:
The ultimate problem lies in in Main.cpp (received by private email):
:-) This should be: "The root problem..." -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (2)
-
Andreas Huber
-
Serena Fritsch