26#define statename stateMachine_->getCurrentState()->getClassName().c_str()
27#define orthogonalName getName().c_str()
28#define cbName clBehavior->getName().c_str()
51 std::lock_guard<std::mutex> lock(this->
mutex_);
53 if (clBehavior !=
nullptr)
56 getLogger(),
"[Orthogonal: %s] Adding client behavior: %s.", this->
getName().c_str(),
57 clBehavior->getName().c_str());
59 clBehavior->currentOrthogonal =
this;
60 clBehavior->currentState = clBehavior->stateMachine_->getCurrentState();
67 getLogger(),
"[Orthogonal: %s] No client behaviors in this state.", this->
getName().c_str());
78 clientBehaviors_.push_back(std::vector<std::shared_ptr<smacc2::ISmaccClientBehavior>>());
87std::vector<std::shared_ptr<smacc2::ISmaccClientBehavior>>
90 std::lock_guard<std::mutex> lock(this->
mutex_);
98 for (
auto & clBehavior : behaviors)
101 getLogger(),
"[Orthogonal: %s] runtimeConfigure(), current behavior: %s.",
102 this->
getName().c_str(), clBehavior->getName().c_str());
106 clBehavior->runtimeConfigure();
108 catch (
const std::exception & e)
112 "[ClientBehavior: %s] Exception in runtimeConfigure - continuing with next client "
114 "Exception info: %s",
115 clBehavior->getName().c_str(), e.what());
116 clBehavior->postInitializationFailureEvent(e.what());
125 if (behaviors.size() > 0)
127 for (
auto & clBehavior : behaviors)
134 TRACETOOLS_TRACEPOINT(
136 clBehavior->executeOnEntry();
138 catch (
const std::exception & e)
142 "[ClientBehavior: %s] Exception on Entry - continuing with next client behavior. "
146 clBehavior->postInitializationFailureEvent(e.what());
154 getLogger(),
"[Orthogonal: %s] OnEntry -> empty orthogonal (no client behavior).",
163 if (behaviors.size() > 0)
165 for (
auto & clBehavior : behaviors)
171 TRACETOOLS_TRACEPOINT(
173 clBehavior->executeOnExit();
175 catch (
const std::exception & e)
179 "[ClientBehavior: %s] Exception onExit - continuing with next client behavior. Exception "
196 clBehavior->dispose();
std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > currentClientBehaviors()
void addClientBehavior(std::shared_ptr< smacc2::ISmaccClientBehavior > clBehavior)
ISmaccStateMachine * getStateMachine()
void setStateMachine(ISmaccStateMachine *value)
rclcpp::Logger getLogger()
virtual void onInitialize()
std::vector< std::shared_ptr< smacc2::ISmaccClient > > clients_
void initState(ISmaccState *state)
ISmaccStateMachine * stateMachine_
std::vector< std::vector< std::shared_ptr< smacc2::ISmaccClientBehavior > > > clientBehaviors_
virtual std::string getName() const
rclcpp::Node::SharedPtr getNode()
rclcpp::Node::SharedPtr getNode()
void disconnectSmaccSignalObject(void *object_ptr)
virtual std::string getClassName()
std::string demangleSymbol()
smacc2_client_behavior_on_exit_end
smacc2_client_behavior_on_exit_start
smacc2_client_behavior_on_entry_start
smacc2_client_behavior_on_entry_end