long State::expended_states_ = 0;
-State::State(const RemoteApp& remote_app) : num_(++expended_states_)
+State::State(const RemoteApp& remote_app) : default_transition(std::make_unique<Transition>()), num_(++expended_states_)
{
remote_app.get_actors_status(actors_to_run_);
Transition* State::get_transition() const
{
+ if (transition_ == nullptr) {
+ return default_transition.get();
+ }
return transition_;
}
* we took to leave this state?
*
* The owner of the transition is the `ActorState` instance which exists in this state,
- * or nullptr if the state represents the root
+ * or a reference to the internal default transition `Transition()` if no transition has been
+ * set
*/
- Transition* transition_ = nullptr;
+ Transition* transition_;
+
+ /**
+ * @brief An empty transition that leads to this state by default
+ */
+ const std::unique_ptr<Transition> default_transition;
/** Sequential state ID (used for debugging) */
long num_ = 0;