|
C++ YASMIN (Yet Another State MachINe)
|
#include <gtest/gtest.h>#include <chrono>#include <condition_variable>#include <future>#include <iostream>#include <memory>#include <string>#include <thread>#include "yasmin/blackboard.hpp"#include "yasmin/concurrence.hpp"#include "yasmin/state.hpp"#include "yasmin/state_machine.hpp"#include "yasmin/types.hpp"
Classes | |
| class | FooState |
| Represents the "Foo" state in the state machine. More... | |
| class | BarState |
| Represents the "Bar" state in the state machine. More... | |
| class | TestConcurrence |
| class | ConfigurableConcurrentState |
| struct | ConcurrentWriteSync |
| class | BlockingWriteState |
| State that waits until both concurrent branches are ready and then writes a value through the remapped blackboard key. More... | |
| class | DelayedStartStateMachine |
| Small helper state machine that delays its start. More... | |
Functions | |
| TEST_F (TestConcurrence, TestCall) | |
| TEST_F (TestConcurrence, TestCancel) | |
| TEST_F (TestConcurrence, TestStr) | |
| int | main (int argc, char **argv) |
| TEST_F (TestConcurrence, TestConfigureAppliesParameterMappingsAndRunsOnce) | |
| TEST_F (TestConcurrence, TestConcurrentNestedStateMachinesKeepRemappingsIsolatedPerBranch) | |
| Verify that concurrent nested state machines keep remappings isolated. | |
| int main | ( | int | argc, |
| char ** | argv ) |
| TEST_F | ( | TestConcurrence | , |
| TestCall | ) |
| TEST_F | ( | TestConcurrence | , |
| TestCancel | ) |
| TEST_F | ( | TestConcurrence | , |
| TestConcurrentNestedStateMachinesKeepRemappingsIsolatedPerBranch | ) |
Verify that concurrent nested state machines keep remappings isolated.
Each branch has its own nested remapping chain: Branch A: foo_str -> foo_inner_a -> foo_branch_a Branch B: foo_str -> foo_inner_b -> foo_branch_b
Both branches run at the same time and write through "foo_str". If remapping state is still shared globally, one branch can overwrite the remapping context of the other and the values may end up under the wrong keys.
The expected behavior is:
| TEST_F | ( | TestConcurrence | , |
| TestConfigureAppliesParameterMappingsAndRunsOnce | ) |
| TEST_F | ( | TestConcurrence | , |
| TestStr | ) |