|
Boost Users : |
From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2007-07-27 06:42:35
> Don't have a solution yet, although I understand the problem you
> describe about the guard conditions over a completion transition. If I
> come up with an elegant solution I will post it in this newsgroup.
Ok, please do!
> I have yet another question regarding events:
> Can you create a hierarchy of events in such a way that Boost is able to
> distinguish between the new subtypes?
> Here is an example to clarify the question:
>
> class AbstractEvent : public sc::event<AbstractEvent>{};
> class EventA : public AbstractEvent{};
> class EventB : public AbstractEvent{};
>
> In this example, events EventA and EventB have the same type ID as
> AbstractEvent in Boost. Is there a way of giving EventA and EventB
> different type IDs, without inheriting directly from event< ... >?
Only if you make AbstractEvent a template:
template<class MostDerived>
class AbstractEvent : public sc::event<MostDerived>{};
class EventA : public AbstractEvent<EventA>{};
class EventB : public AbstractEvent<EventA>{};
Please see
<http://www.boost.org/libs/statechart/doc/faq.html#PolymorphicEvents>
for more information.
HTH,
-- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
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