C++ YASMIN (Yet Another State MachINe)
|
Namespaces | |
namespace | blackboard |
Classes | |
class | CbState |
Represents a state that executes a callback function. 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... | |
Typedefs | |
typedef void(* | LogFunction) (const char *file, const char *function, int line, const char *text,...) |
Type definition for a logging function. | |
Functions | |
const char * | extract_filename (const char *path) |
Extracts the filename from a given file path. | |
void | set_loggers (LogFunction error, LogFunction warn, LogFunction info, LogFunction debug) |
Sets custom logging functions for different log levels. | |
void | set_default_loggers () |
Sets the default logging functions for all log levels. | |
void | default_log_error (const char *file, const char *function, int line, const char *text,...) |
Default error logging function. | |
void | default_log_warn (const char *file, const char *function, int line, const char *text,...) |
Default warning logging function. | |
void | default_log_info (const char *file, const char *function, int line, const char *text,...) |
Default info logging function. | |
void | default_log_debug (const char *file, const char *function, int line, const char *text,...) |
Default debug logging function. | |
Variables | |
LogFunction | log_error = default_log_error |
Pointer to the error logging function. | |
LogFunction | log_warn = default_log_warn |
Pointer to the warning logging function. | |
LogFunction | log_info = default_log_info |
Pointer to the info logging function. | |
LogFunction | log_debug = default_log_debug |
Pointer to the debug logging function. | |
typedef void(* yasmin::LogFunction) (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.
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. |
void yasmin::default_log_debug | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default debug logging function.
This function logs a debug message to stderr with the format: [DEBUG] [file:function:line] 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. |
... | Additional arguments for the format string. |
void yasmin::default_log_error | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default error logging function.
This function logs an error message to stderr with the format: [ERROR] [file:function:line] 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. |
... | Additional arguments for the format string. |
void yasmin::default_log_info | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default info logging function.
This function logs an informational message to stderr with the format: [INFO] [file:function:line] 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. |
... | Additional arguments for the format string. |
void yasmin::default_log_warn | ( | const char * | file, |
const char * | function, | ||
int | line, | ||
const char * | text, | ||
... ) |
Default warning logging function.
This function logs a warning message to stderr with the format: [WARN] [file:function:line] 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. |
... | Additional arguments for the format string. |
|
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::set_default_loggers | ( | ) |
Sets the default logging functions for all log levels.
This function initializes the logging functions to the default implementations.
void yasmin::set_loggers | ( | LogFunction | error, |
LogFunction | warn, | ||
LogFunction | info, | ||
LogFunction | debug ) |
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. |
LogFunction yasmin::log_debug = default_log_debug |
Pointer to the debug logging function.
LogFunction yasmin::log_error = default_log_error |
Pointer to the error logging function.
LogFunction yasmin::log_info = default_log_info |
Pointer to the info logging function.
LogFunction yasmin::log_warn = default_log_warn |
Pointer to the warning logging function.