|
C++ YASMIN (Yet Another State MachINe)
|
Namespaces | |
| namespace | detail |
| namespace | pybind11_utils |
Classes | |
| class | Blackboard |
| A thread-safe storage for key-value pairs of varying types. More... | |
| struct | BlackboardKeyInfo |
| Information about a blackboard key including name and optional default value. More... | |
| struct | StateMetadata |
| Metadata for a state including description and blackboard key information. More... | |
| struct | BlackboardKeyInfoPy |
| Extension methods for BlackboardKeyInfo. Added via ADL-friendly free functions used by the pybind code. More... | |
| class | BlackboardPyWrapper |
| Python-facing wrapper around the native Blackboard. More... | |
| class | CbState |
| Represents a state that executes a callback function. More... | |
| class | Concurrence |
| Runs a series of states in parallel. More... | |
| class | State |
| Represents a state in a state machine. More... | |
| class | StateMachine |
| A class that implements a state machine with a set of states, transitions, and callback mechanisms for state changes. More... | |
| class | StateMachineCancelException |
| Exception thrown when a state machine is canceled as a whole. More... | |
| class | PyState |
| Trampoline class to enable Python classes to inherit from C++ State. More... | |
Typedefs | |
| typedef void(* | LogFunction) (LogLevel level, const char *file, const char *function, int line, const char *text) |
| Type definition for a logging function. | |
| using | StringSet = std::set<std::string> |
| Set of strings. | |
| using | StringMap = std::unordered_map<std::string, std::string> |
| Map from string to string. | |
| using | Outcomes = StringSet |
| Set of possible outcomes for states. | |
| using | StateOutcomeMap = StringMap |
| Map of state names to their outcomes. | |
| using | OutcomeMap = std::unordered_map<std::string, StateOutcomeMap> |
| Map of outcomes to state outcome maps. | |
| using | Transitions = StringMap |
| Map of transitions (string to string). | |
| using | TransitionsMap = std::unordered_map<std::string, Transitions> |
| Map of state names to transitions. | |
| using | Remappings = StringMap |
| Map of remappings (string to string). | |
| using | RemappingsMap = std::unordered_map<std::string, Remappings> |
| Map of keys to remappings. | |
| using | ParameterMappings = StringMap |
| Map of child parameter names to parent parameter names. | |
| using | ParameterMappingsMap = std::unordered_map<std::string, ParameterMappings> |
| Map of state names to parameter mappings. | |
| using | TypeRegistry = StringMap |
| Registry for type information. | |
| using | BlackboardPtr = std::shared_ptr<Blackboard> |
| Shared pointer to Blackboard. | |
| using | StatePtr = std::shared_ptr<State> |
| Shared pointer to State. | |
| using | StateMachinePtr = std::shared_ptr<StateMachine> |
| Shared pointer to StateMachine. | |
| using | ConcurrencePtr = std::shared_ptr<Concurrence> |
| Shared pointer to Concurrence. | |
| using | StateMap = std::unordered_map<std::string, std::shared_ptr<State>> |
| Map of state names to state pointers. | |
| using | CbStateCallback = std::function<std::string(std::shared_ptr<Blackboard>)> |
| Callback function type for CbState. | |
Enumerations | |
| enum | LogLevel { ERROR = 0 , WARN , INFO , DEBUG } |
| Enum representing different log levels for controlling log verbosity. More... | |
| enum class | StateStatus { IDLE , RUNNING , CANCELED , COMPLETED } |
| Enumeration representing the current status of a state. More... | |
Functions | |
| std::string | demangle_type (const std::string &mangled_name) |
| Demangle a C++ type name to a human-readable format. | |
| BlackboardKeyInfo | blackboard_key_info_from_pyobject (const std::string &key_name, py::object value) |
| Create a BlackboardKeyInfo from a Python object default value. | |
| py::object | blackboard_key_info_get_py_default (const BlackboardKeyInfo &info) |
| Convert a BlackboardKeyInfo default value back to a Python object. | |
| void | default_log_message (LogLevel level, const char *file, const char *function, int line, const char *text) |
| Default logging function. | |
| void | set_log_level (LogLevel new_log_level) |
| Sets the log level for the logs. | |
| const char * | log_level_to_name (LogLevel level) |
| Parse LogLevel to string. | |
| template<yasmin::LogLevel LEVEL> | |
| void | log_helper (const char *file, const char *function, int line, const char *text,...) |
| Variadic template function to log messages at different levels. | |
| const char * | extract_filename (const char *path) |
| Extracts the filename from a given file path. | |
| void | set_loggers (LogFunction log_message) |
| Sets custom logging functions for different log levels. | |
| void | set_default_loggers () |
| Sets the default logging function for all log levels. | |
Variables | |
| LogLevel | log_level = INFO |
| The current log level for the application. | |
| LogFunction | log_message = default_log_message |
| Pointer to the logging function. | |
| using yasmin::BlackboardPtr = std::shared_ptr<Blackboard> |
Shared pointer to Blackboard.
| using yasmin::CbStateCallback = std::function<std::string(std::shared_ptr<Blackboard>)> |
Callback function type for CbState.
| using yasmin::ConcurrencePtr = std::shared_ptr<Concurrence> |
Shared pointer to Concurrence.
| typedef void(* yasmin::LogFunction) (LogLevel level, const char *file, const char *function, int line, const char *text) |
Type definition for a logging function.
This type represents a function pointer that takes a file name, function name, line number, log message, and a variable number of additional arguments for formatting the log message.
| level | The log level of the message |
| file | The name of the source file where the log function is called. |
| function | The name of the function where the log function is called. |
| line | The line number in the source file where the log function is called. |
| text | The format string for the log message, similar to printf. |
| ... | Additional arguments for the format string. |
| using yasmin::OutcomeMap = std::unordered_map<std::string, StateOutcomeMap> |
Map of outcomes to state outcome maps.
| using yasmin::Outcomes = StringSet |
Set of possible outcomes for states.
| using yasmin::ParameterMappings = StringMap |
Map of child parameter names to parent parameter names.
| using yasmin::ParameterMappingsMap = std::unordered_map<std::string, ParameterMappings> |
Map of state names to parameter mappings.
| using yasmin::Remappings = StringMap |
Map of remappings (string to string).
| using yasmin::RemappingsMap = std::unordered_map<std::string, Remappings> |
Map of keys to remappings.
| using yasmin::StateMachinePtr = std::shared_ptr<StateMachine> |
Shared pointer to StateMachine.
| using yasmin::StateMap = std::unordered_map<std::string, std::shared_ptr<State>> |
Map of state names to state pointers.
| using yasmin::StateOutcomeMap = StringMap |
Map of state names to their outcomes.
| using yasmin::StatePtr = std::shared_ptr<State> |
Shared pointer to State.
| using yasmin::StringMap = std::unordered_map<std::string, std::string> |
Map from string to string.
| using yasmin::StringSet = std::set<std::string> |
Set of strings.
| using yasmin::Transitions = StringMap |
Map of transitions (string to string).
| using yasmin::TransitionsMap = std::unordered_map<std::string, Transitions> |
Map of state names to transitions.
| using yasmin::TypeRegistry = StringMap |
Registry for type information.
| enum yasmin::LogLevel |
Enum representing different log levels for controlling log verbosity.
This enum defines the severity levels of logs that can be used to control which log messages should be displayed. The levels are ordered from most severe to least severe. Only logs at or above the current log level will be shown.
|
strong |
|
inline |
Create a BlackboardKeyInfo from a Python object default value.
The conversion rules mirror the BlackboardPyWrapper so metadata created from Python states uses the same native storage types as values written to the runtime blackboard.
|
inline |
Convert a BlackboardKeyInfo default value back to a Python object.
Exact type matching is used so container metadata remains unambiguous when scalar and container types share substrings such as int and std::vector<int>.
| void yasmin::default_log_message | ( | LogLevel | level, |
| const char * | file, | ||
| const char * | function, | ||
| int | line, | ||
| const char * | text ) |
Default logging function.
| level | The log level as a string (e.g., "ERROR", "WARN", "INFO", "DEBUG"). |
| file | The source file where the log function is called. |
| function | The function where the log function is called. |
| line | The line number in the source file. |
| text | The format string for the log message. |
|
inline |
Demangle a C++ type name to a human-readable format.
| mangled_name | The mangled type name. |
|
inline |
Extracts the filename from a given file path.
This function takes a full path to a file and returns just the file name.
| path | The full path to the file. |
| void yasmin::log_helper | ( | const char * | file, |
| const char * | function, | ||
| int | line, | ||
| const char * | text, | ||
| ... ) |
Variadic template function to log messages at different levels.
This function wraps log_message and allows logging messages with different log levels while reducing redundant code. It provides a consistent logging format across all levels.
| LEVEL | The log level LogLevel (e.g., 0 -> "ERROR", 1 -> "WARN", 2 -> "INFO", 3 -> "DEBUG"). |
| file | The source file where the log function is called. |
| function | The function where the log function is called. |
| line | The line number in the source file. |
| text | The format string for the log message. |
| ... | Additional arguments for the format string. |
| const char * yasmin::log_level_to_name | ( | LogLevel | level | ) |
Parse LogLevel to string.
This function returns the name of a given log level.
| level | Log level. |
| void yasmin::set_default_loggers | ( | ) |
Sets the default logging function for all log levels.
This function initializes the logging function to the default implementations.
| void yasmin::set_log_level | ( | LogLevel | new_log_level | ) |
Sets the log level for the logs.
This function allows the user to specify the log level error, warning, info, or debug.
| new_log_level | Log level. |
| void yasmin::set_loggers | ( | LogFunction | log_message | ) |
Sets custom logging functions for different log levels.
This function allows the user to specify custom logging functions for error, warning, info, and debug logs. If a null function is provided for any log level, the default logging function will be used instead.
| error | Pointer to the custom error logging function. |
| warn | Pointer to the custom warning logging function. |
| info | Pointer to the custom info logging function. |
| debug | Pointer to the custom debug logging function. |
The current log level for the application.
This global variable holds the current log level, which determines the verbosity of the logs. Logs at or above this level will be displayed. The default level is set to INFO.
| LogFunction yasmin::log_message = default_log_message |
Pointer to the logging function.