in my opinion, PIStateMachine is ready to real work
This commit is contained in:
@@ -97,8 +97,8 @@ void PIStateBase::print(PIString prefix) {
|
||||
}
|
||||
|
||||
|
||||
bool PIStateBase::start() {
|
||||
if (isActive()) return true;
|
||||
bool PIStateBase::start(bool force) {
|
||||
if (!force && isActive()) return true;
|
||||
if (isAtomic()) {
|
||||
setActive(true);
|
||||
return true;
|
||||
@@ -197,6 +197,20 @@ void PIStateBase::propagateRoot(PIStateMachine * r) {
|
||||
}
|
||||
|
||||
|
||||
PIVector<PIStateBase *> PIStateBase::gatherStates() {
|
||||
PIVector<PIStateBase *> ret, slice, prev_slice({this});
|
||||
while (prev_slice.isNotEmpty()) {
|
||||
slice.clear();
|
||||
for (auto s: prev_slice) {
|
||||
ret << s;
|
||||
slice << s->children;
|
||||
}
|
||||
prev_slice.swap(slice);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void PIStateBase::gatherActiveStates(PIVector<PIStateBase *> & output) {
|
||||
for (auto * c: children)
|
||||
c->gatherActiveStates(output);
|
||||
|
||||
Reference in New Issue
Block a user