Boost Graph Library: Python Bindings
Hi guys, I report a small bug related to bgl.file_kind.adjlist. I tried it using an inputfile in the specified format, but got nothing. And i checked the source code, basic_graph.cpp and found on line 129: case gfk_adjlist: break; which means simply not dealing with it at all. I guess those two guys are so busy to fill some codes in it. Thanks, Yu
On Sep 2, 2005, at 7:37 PM, Yu Huang wrote:
I report a small bug related to bgl.file_kind.adjlist.
I tried it using an inputfile in the specified format, but got nothing. And i checked the source code, basic_graph.cpp and found on line 129:
case gfk_adjlist: break;
which means simply not dealing with it at all.
Oops. Thanks for pointing this out.
I guess those two guys are so busy to fill some codes in it.
Busy, yes, but this was just an oversight. I've just implemented the functionality and committed it to CVS. It will be release as part of Boost 1.33.1; or, you can get it from CVS on the RC_1_33_0 branch. Doug
I'm playing with the statechart library, in conjunction with Boost 1.33
and VC 7.1. I'm having trouble using the state history functionality; I
can't get it to compile, even taking into account the useful static
assertions that ought to be helping me. Can someone suggest what I might
be missing?
Here's a boiled down sample: there are 2 top-level states, StateA and
StateB. Event2 transitions between them. When in StateA, Event1
transitions between 2 sub-states, StateA1 and StateA2. When transitioning
from StateB to StateA, I want to use StateA's history to determine which
of StateA1 and Stae2 become active. From reading the tutorial,
references, and sample code, it looks like this should work:
////////////////////////////////////////////////////////////////////
#include
john.wismar@autozone.com wrote:
I'm playing with the statechart library, in conjunction with Boost 1.33 and VC 7.1. I'm having trouble using the state history functionality; I can't get it to compile, even taking into account the useful static assertions that ought to be helping me. Can someone suggest what I might be missing?
Here's a boiled down sample: there are 2 top-level states, StateA and StateB. Event2 transitions between them. When in StateA, Event1 transitions between 2 sub-states, StateA1 and StateA2. When transitioning from StateB to StateA, I want to use StateA's history to determine which of StateA1 and Stae2 become active. From reading the tutorial, references, and sample code, it looks like this should work: //////////////////////////////////////////////////////////////////// #include
#include #include #include #include namespace sc = boost::statechart;
//Events struct Event1 : sc::event<Event1> {}; struct Event2 : sc::event<Event2> {};
//States struct StateA; struct StateA1; struct StateA2; struct StateB;
struct SCTest : sc::state_machine
{}; struct StateA : sc::simple_state
{ typedef sc::transition reactions; }; struct StateB : sc::simple_state
{ typedef sc::transition reactions; }; struct StateA1 : sc::simple_state
{ typedef sc::transition reactions; }; struct StateA2 : sc::simple_state
{ typedef sc::transition reactions; }; int main(int argc, char* argv[]) { SCTest test; return 0; }
This gives me the following error: c:\boost\boost\statechart\shallow_history.hpp(34) : error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>' with [ x=false ] <snip> [ DefaultState=StateA ]
etc., and comments at that point in the statechart source direct me to: "...pass either statechart::has_deep_history or statechart::has_full_history as the last parameter of DefaultState's context."
This doesn't seem to help, though. If I use has_deep_history or has_full_history in StateA's definition, the errors do not go away.
Any help would be greatly appreciated!
I'm still using boost::fsm, but if the history mechanism
hasn't changed in the transition to boost:statechart
then I believe you need to change:
struct StateB : sc::simple_state
I'm playing with the statechart library, in conjunction with Boost 1.33 and VC 7.1. I'm having trouble using the state history functionality; I can't get it to compile, even taking into account the useful static assertions that ought to be helping me. Can someone suggest what I might be missing?Here's a boiled down sample:
Hi John
are 2 top-level states, StateA and StateB. Event2 transitions between them. When in StateA, Event1 transitions between 2 sub-states, StateA1 and StateA2. When transitioning from StateB to StateA, I want to use StateA's history to determine which of StateA1 and Stae2 become active.
I'm very sorry for the late answer, but I missed your post back in September because it was sent in reply to an unrelated post (Boost Graph Library). Mick's analysis of the problem is correct. When you make a transition to history then you must specify the *default* *state* that is entered in case the history has never been saved before. The *outer* *state* of the default state must then pass the appropriate has_xxx_history. Note that this is very much in line with the UML notation. A transition to history always goes to a H disc first and from that H disc you have another arrow to the default state. The state containing the H disc is said to be the one "having history".
From reading the tutorial, references, and sample code, it looks like this should work: [example snipped]
I checked the docs and I can't find any examples that display the wrong syntax you used. A pointer would be appreciated. HTH & Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
Andreas Huber wrote:
Hi John
writes: I'm playing with the statechart library, in conjunction with Boost 1.33 and VC 7.1. I'm having trouble using the state history functionality; I can't get it to compile, even taking into account the useful static assertions that ought to be helping me. Can someone suggest what I might be missing?Here's a boiled down sample:
there
are 2 top-level states, StateA and StateB. Event2 transitions between them. When in StateA, Event1 transitions between 2 sub-states, StateA1 and StateA2. When transitioning from StateB to StateA, I want to use StateA's history to determine which of StateA1 and Stae2 become active.
I'm very sorry for the late answer, but I missed your post back in September because it was sent in reply to an unrelated post (Boost Graph Library).
Mick's analysis of the problem is correct. When you make a transition to history then you must specify the *default* *state* that is entered in case the history has never been saved before. The *outer* *state* of the default state must then pass the appropriate has_xxx_history.
Note that this is very much in line with the UML notation. A transition to history always goes to a H disc first and from that H disc you have another arrow to the default state.
Initially I thought it was not quite in line with UML since the boost::statechart implementation allows a different default arrow to be specified for each transition to a H disc, whereas UML only allows a single arrow out of a H disc. But I just realised that afaict UML does not disallow having more than one H disc in a parent state. As such you can have 2 H discs each with a different default state, and boost::statechart supports that.
The state containing the H disc is said to be the one "having history".
From reading the tutorial, references, and sample code, it looks like this should work:
[example snipped]
I checked the docs and I can't find any examples that display the wrong syntax you used. A pointer would be appreciated.
I don't believe your docs are wrong. It is just that it is easy to misread them as it seems natural to expect that you
would say:
sc::shallow_history<StateA>
since you are requesting a transition to one of the sub-states of StateA. Saying:
sc::shallow_history<StateA1>
just reads a little funny since you may or may not be transitioning to StateA1. The following, while redundant, might
actually be easier for people to read:
sc::shallow_history
Mick Hollins wrote:
Note that this is very much in line with the UML notation. A transition to history always goes to a H disc first and from that H disc you have another arrow to the default state.
Initially I thought it was not quite in line with UML since the boost::statechart implementation allows a different default arrow to be specified for each transition to a H disc, whereas UML only allows a single arrow out of a H disc.
But I just realised that afaict UML does not disallow having more than one H disc in a parent state. As such you can have 2 H discs each with a different default state, and boost::statechart supports that.
I faintly remember seeing a statechart diagram with more than one history disc in one state. This was enough for me to choose a design that allows for that. I can't say offhand whether or not UML explicitly allows it.
I checked the docs and I can't find any examples that display the wrong syntax you used. A pointer would be appreciated.
I don't believe your docs are wrong. It is just that it is easy to misread them as it seems natural to expect that you would say:
sc::shallow_history<StateA>
since you are requesting a transition to one of the sub-states of StateA. Saying:
sc::shallow_history<StateA1>
just reads a little funny since you may or may not be transitioning to StateA1. The following, while redundant, might actually be easier for people to read:
sc::shallow_history
where the first parameter specifies the parent state to which you are performing a history transition, and the second parameter specifies the default state.
I'm not sure. In the UML diagram the arrow doesn't point to StateA either so you have a very similar problem there. Plus, I don't like the unnecessary redundancy. Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (5)
-
Andreas Huber
-
Doug Gregor
-
john.wismar@autozone.com
-
Mick Hollins
-
Yu Huang