.. _program_listing_file__tmp_ws_src_smacc2_smacc2_include_smacc2_smacc_state.hpp: Program Listing for File smacc_state.hpp ======================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/smacc2/smacc2/include/smacc2/smacc_state.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2021 RobosoftAI Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /***************************************************************************************************************** * * Authors: Pablo Inigo Blasco, Brett Aldrich * ******************************************************************************************************************/ #pragma once #include namespace smacc2 { class ISmaccState { public: virtual ISmaccStateMachine & getStateMachine() = 0; virtual std::string getName() = 0; inline ISmaccState * getParentState() { return parentState_; } inline rclcpp::Node::SharedPtr & getNode() { return node_; } inline rclcpp::Logger getLogger() { return *logger_; } virtual std::string getClassName(); template std::shared_ptr configure(Args &&... args); template void requiresComponent(SmaccComponentType *& storage); template void requiresClient(SmaccClientType *& storage); template bool getGlobalSMData(std::string name, T & ret); // Store globally in this state machine. (By value parameter ) template void setGlobalSMData(std::string name, T value); template < typename TStateReactor, typename TTriggerEvent, typename TEventList, typename... TEvArgs> std::shared_ptr createStateReactor(TEvArgs... args); template std::shared_ptr createStateReactor(TEvArgs... args); template std::shared_ptr createEventGenerator(TEvArgs... args); template void postEvent(const EventType & ev); template void postEvent(); // used for transition logging template void notifyTransition(); // used for transition logging void notifyTransitionFromTransitionTypeInfo( std::shared_ptr & transitionTypeInfo); inline std::vector> & getStateReactors() { return stateReactors_; } inline std::vector> & getEventGenerators() { return eventGenerators_; } template TOrthogonal * getOrthogonal(); // gets the client behavior given the client type and orthogonal type // if the client behavior is not found, it returns nullptr // the index parameter is used to specify the client behavior in case there are more than one template TClientBehavior * getClientBehavior(int index = 0); template TEventGenerator * getEventGenerator(); template TStateReactor * getStateReactor(); protected: rclcpp::Node::SharedPtr node_; std::shared_ptr logger_; std::vector> stateReactors_; std::vector> eventGenerators_; ISmaccState * parentState_; const smacc2::introspection::SmaccStateInfo * stateInfo_; }; } // namespace smacc2