C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin Namespace Reference

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 Documentation

◆ LogFunction

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.

Parameters
fileThe name of the source file where the log function is called.
functionThe name of the function where the log function is called.
lineThe line number in the source file where the log function is called.
textThe format string for the log message, similar to printf.
...Additional arguments for the format string.

Function Documentation

◆ default_log_debug()

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.

Parameters
fileThe name of the source file where the log function is called.
functionThe name of the function where the log function is called.
lineThe line number in the source file where the log function is called.
textThe format string for the log message.
...Additional arguments for the format string.

◆ default_log_error()

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.

Parameters
fileThe name of the source file where the log function is called.
functionThe name of the function where the log function is called.
lineThe line number in the source file where the log function is called.
textThe format string for the log message.
...Additional arguments for the format string.

◆ default_log_info()

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.

Parameters
fileThe name of the source file where the log function is called.
functionThe name of the function where the log function is called.
lineThe line number in the source file where the log function is called.
textThe format string for the log message.
...Additional arguments for the format string.

◆ default_log_warn()

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.

Parameters
fileThe name of the source file where the log function is called.
functionThe name of the function where the log function is called.
lineThe line number in the source file where the log function is called.
textThe format string for the log message.
...Additional arguments for the format string.

◆ extract_filename()

const char * yasmin::extract_filename ( const char * path)
inline

Extracts the filename from a given file path.

This function takes a full path to a file and returns just the file name.

Parameters
pathThe full path to the file.
Returns
A pointer to the extracted filename.

◆ set_default_loggers()

void yasmin::set_default_loggers ( )

Sets the default logging functions for all log levels.

This function initializes the logging functions to the default implementations.

◆ set_loggers()

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.

Parameters
errorPointer to the custom error logging function.
warnPointer to the custom warning logging function.
infoPointer to the custom info logging function.
debugPointer to the custom debug logging function.

Variable Documentation

◆ log_debug

LogFunction yasmin::log_debug = default_log_debug

Pointer to the debug logging function.

◆ log_error

LogFunction yasmin::log_error = default_log_error

Pointer to the error logging function.

◆ log_info

LogFunction yasmin::log_info = default_log_info

Pointer to the info logging function.

◆ log_warn

LogFunction yasmin::log_warn = default_log_warn

Pointer to the warning logging function.