SMACC2
Loading...
Searching...
No Matches
smacc_client_behavior_base.cpp
Go to the documentation of this file.
1// Copyright 2021 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
22
23namespace smacc2
24{
26{
27 stateMachine_ = nullptr;
28 currentState = nullptr;
29}
30
32{
33 RCLCPP_WARN_STREAM(getLogger(), "[" << getName() << "Client behavior deallocated.");
34}
35
36std::string ISmaccClientBehavior::getName() const { return demangleSymbol(typeid(*this).name()); }
37
38rclcpp::Node::SharedPtr ISmaccClientBehavior::getNode() const
39{
40 return this->stateMachine_->getNode();
41}
42
43rclcpp::Logger ISmaccClientBehavior::getLogger() const
44{
45 auto nh = this->getNode();
46 if (nh != nullptr)
47 {
48 return nh->get_logger();
49 }
50 else
51 {
52 return rclcpp::get_logger("SMACC");
53 }
54}
55
57{
58 RCLCPP_DEBUG(
59 getLogger(), "[%s] Default empty SmaccClientBehavior runtimeConfigure",
60 this->getName().c_str());
61}
62
64{
65 RCLCPP_DEBUG(
66 getLogger(), "[%s] Default empty SmaccClientBehavior onEntry", this->getName().c_str());
67 this->onEntry();
68}
69
71{
72 RCLCPP_DEBUG(
73 getLogger(), "[%s] Default empty SmaccClientBehavior onExit", this->getName().c_str());
74 this->onExit();
75}
76
78
79} // namespace smacc2
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
rclcpp::Node::SharedPtr getNode()
std::string demangleSymbol()