.. _program_listing_file__tmp_ws_src_smacc2_smacc2_include_smacc2_smacc_orthogonal.hpp: Program Listing for File smacc_orthogonal.hpp ============================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/smacc2/smacc2/include/smacc2/smacc_orthogonal.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 #include namespace smacc2 { class ISmaccOrthogonal { public: void setStateMachine(ISmaccStateMachine * value); inline ISmaccStateMachine * getStateMachine(); void initState(ISmaccState * state); void addClientBehavior(std::shared_ptr clientBehavior); void runtimeConfigure(); void onEntry(); void onExit(); void onDispose(); virtual std::string getName() const; template void requiresComponent(SmaccComponentType *& storage); template bool requiresClient(SmaccClientType *& storage); inline const std::vector> & getClients(); inline const std::vector>> & getClientBehaviors() const; template void setGlobalSMData(std::string name, T value); template bool getGlobalSMData(std::string name, T & ret); // returns a client behavior of a given 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); rclcpp::Node::SharedPtr getNode(); inline rclcpp::Logger getLogger() { return getNode()->get_logger(); } protected: virtual void onInitialize(); void initializeClients(); template void assignClientToOrthogonal(TClient * client); std::vector> clients_; private: ISmaccStateMachine * stateMachine_; std::vector>> clientBehaviors_; friend class ISmaccStateMachine; std::mutex mutex_; }; } // namespace smacc2