C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin_ros::RosSerializeCppState Class Reference

A state for serializing C++ objects into ROS 2 messages. More...

#include <ros_serialize_cpp_state.hpp>

Inheritance diagram for yasmin_ros::RosSerializeCppState:
Collaboration diagram for yasmin_ros::RosSerializeCppState:

Public Member Functions

 RosSerializeCppState ()
 Construct a new RosSerializeCppState.
 ~RosSerializeCppState () override=default
 Destroy the RosSerializeCppState.
void configure () override
 Configure the state before execution.
std::string execute (yasmin::Blackboard::SharedPtr blackboard) override
 Execute the serialization operation.
Public Member Functions inherited from yasmin::State
 State (const Outcomes &outcomes)
 Shared pointer type for State.
virtual ~State ()
 Virtual destructor.
Blackboard::SharedPtr get_parameters_blackboard () const
 Gets the private parameter blackboard of this state.
bool is_idle () const noexcept
 Checks if the state is idle.
bool is_running () const noexcept
 Checks if the state is currently running.
bool is_canceled () const noexcept
 Checks if the state has been canceled.
bool is_completed () const noexcept
 Checks if the state has completed execution.
std::string operator() (Blackboard::SharedPtr blackboard)
 Executes the state and returns the outcome.
virtual void cancel_state ()
 Cancels the current state execution.
Outcomes const & get_outcomes () const noexcept
 Gets the set of possible outcomes for this state.
void set_description (const std::string &description)
 Sets the description for this state.
const std::string & get_description () const
 Gets the description of this state.
void set_outcome_description (const std::string &outcome, const std::string &description)
 Sets a human-readable description for an outcome.
const std::string & get_outcome_description (const std::string &outcome) const
 Gets the human-readable description for an outcome.
const std::unordered_map< std::string, std::string > & get_outcome_descriptions () const
 Gets all outcome descriptions.
void add_input_key (const BlackboardKeyInfo &key_info)
 Adds an input key to the state's metadata.
void add_input_key (const std::string &key_name)
 Adds an input key with a name only.
void add_input_key (const std::string &key_name, const std::string &description)
 Adds an input key with a name and description.
template<typename T>
void add_input_key (const std::string &key_name, const std::string &description, T default_value)
 Adds an input key with a name, default value and description.
void add_output_key (const BlackboardKeyInfo &key_info)
 Adds an output key to the state's metadata.
void add_output_key (const std::string &key_name)
 Adds an output key with a name only.
void add_output_key (const std::string &key_name, const std::string &description)
 Adds an output key with a name and description.
const std::vector< BlackboardKeyInfo > & get_input_keys () const
 Gets the input keys metadata.
const std::vector< BlackboardKeyInfo > & get_output_keys () const
 Gets the output keys metadata.
void declare_parameter (const BlackboardKeyInfo &parameter_info)
 Declares a parameter in the state metadata.
void declare_parameter (const std::string &parameter_name)
 Declares a parameter with a name only.
void declare_parameter (const std::string &parameter_name, const std::string &description)
 Declares a parameter with a name and description.
template<typename T>
void declare_parameter (const std::string &parameter_name, const std::string &description, T default_value)
 Declares a parameter with a name, description, and default value.
bool has_parameter (const std::string &parameter_name) const
 Checks if a parameter exists in the state-local parameter storage.
template<typename T>
T get_parameter (const std::string &parameter_name) const
 Gets a parameter from the state-local parameter storage.
template<typename T>
void set_parameter (const std::string &parameter_name, T value)
 Sets a parameter in the state-local parameter storage.
bool is_parameter_declared (const std::string &parameter_name) const
 Checks whether a parameter was declared in the state metadata.
void copy_parameter_from (const State &source_state, const std::string &source_parameter_name, const std::string &target_parameter_name)
 Copies a parameter value from another state.
const std::vector< BlackboardKeyInfo > & get_parameters () const
 Gets the declared parameter metadata.
const StateMetadata & get_metadata () const
 Gets the complete state metadata.
virtual std::string to_string () const
 Converts the state to a string representation.

Private Attributes

std::string interface_type_
 The type of the ROS 2 interface to serialize.
const InterfaceSerializationHandler * handler_
 The handler for serializing the ROS 2 message.

Additional Inherited Members

Protected Attributes inherited from yasmin::State
Outcomes outcomes
 The possible outcomes of this state.

Detailed Description

A state for serializing C++ objects into ROS 2 messages.

Constructor & Destructor Documentation

◆ RosSerializeCppState()

yasmin_ros::RosSerializeCppState::RosSerializeCppState ( )

Construct a new RosSerializeCppState.

◆ ~RosSerializeCppState()

yasmin_ros::RosSerializeCppState::~RosSerializeCppState ( )
overridedefault

Destroy the RosSerializeCppState.

Member Function Documentation

◆ configure()

void yasmin_ros::RosSerializeCppState::configure ( )
overridevirtual

Configure the state before execution.

Reimplemented from yasmin::State.

◆ execute()

std::string yasmin_ros::RosSerializeCppState::execute ( yasmin::Blackboard::SharedPtr blackboard)
overridevirtual

Execute the serialization operation.

Parameters
blackboardA shared pointer to the blackboard for data storage.
Returns
A string outcome indicating the result of the serialization operation.

Reimplemented from yasmin::State.

Member Data Documentation

◆ handler_

const InterfaceSerializationHandler* yasmin_ros::RosSerializeCppState::handler_
private

The handler for serializing the ROS 2 message.

◆ interface_type_

std::string yasmin_ros::RosSerializeCppState::interface_type_
private

The type of the ROS 2 interface to serialize.


The documentation for this class was generated from the following files: