nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Boost::Statechart - Problem Exit Codes

Von: Georg Gast (schorsch_76@gmx.de) [Profil]
Datum: 08.05.2009 19:46
Message-ID: <gu1r5t$r01$1@online.de>
Newsgroup: de.comp.lang.iso-c++
Hallo NG,

ich schau mir grad die Boost::Statechart Library an. Bisher hab ich
immer "hausgemachte" Statemachines verwendet. Jetzt binich auf ein
Problem gestossen.

Ich möchte einen kleinen Zylinder programmieren, welcher ein- und
ausfährt. Eigentlich nix grosses. 5 Zustände. Hier nur mal ein Zustand.

Mein System:
Vista x32
Boost 1.39.0
MSVC8 SP1

Hier erstmal der Minimalcode:

MYTRACE_CLASS ist ein Macro das mir in ein Singleton Daten wegschreibt,
was Threadsicher ist. Das wird dann im Release "rauskompiliert"

<code>
----- cylinder.h -----
// our statemachine
// first state is always the stopped state
struct Cylinder : public sc::state_machine<Cylinder, Stopped>
{
Cylinder();
~Cylinder();
};

// our state definitions
struct Stopped		: public sc::state< Stopped, Cylinder>
{
Stopped( my_context ctx );
~Stopped();
};
----- cylinder.cpp
Cylinder::Cylinder()
{
MYTRACE_CLASS(_T("Cylinder::Cylinder()"));
}
Cylinder::~Cylinder()
{
MYTRACE_CLASS(_T("Cylinder::~Cylinder()"));
}

// states
Stopped::Stopped( my_context ctx ) : my_base( ctx )
{
MYTRACE_CLASS(_T("Stopped::Stopped()"));
}
Stopped::~Stopped()
{
MYTRACE_CLASS(_T("Stopped::~Stopped()"));
}
----- main.cpp
int main (int argc, char** argv)
{
Cylinder cyl;
cyl.initiate();

return 0;
}
</code>

Das Debuglog sagt:
2009.05.08_18.01.57	Class:	Cylinder::Cylinder()
2009.05.08_18.01.57	Class:	Stopped::Stopped()
2009.05.08_18.01.57	Class:	Cylinder::~Cylinder()
2009.05.08_18.01.57	Class:	Stopped::~Stopped()

Das erwarte ich so aber echt nicht ....

Das Problem ist, dass die Exit Codes in der absolut unerwarteten
Reihenfolge aufgerufen werden. Sowohl mein DebugLog als auch der
Debugger melden mir diese Reihenfolge. Laut FAQ soll das nur in
"multiple inherence" states passieren. Das hab ich aber nicht.

FAQ Eintrag:
http://www.boost.org/doc/libs/1_39_0/libs/statechart/doc/faq.html#WrongExitActionOrder

Hat einer eine Idee?

Gruß

Georg

[ Auf dieses Posting antworten ]

Antworten