API Reference¶
-
class
base_event: public tuber::events::event¶ - #include <base_event.hpp>
Base class for events
Subclassed by tuber::core::logging::log_event
Public Functions
-
base_event()¶
-
base_event(const std::string &event_type)¶ Creates an event with the given type
- Parameters
event_type: The type of the event
-
base_event(base_event &&other)¶
-
base_event &
operator=(base_event &&other)¶
-
const std::string &
get_event_identifier() const¶ - Return
- The identifier of the event
Private Members
-
std::string
event_identifier¶
-
-
class
base_logger: public tuber::core::logging::logger¶ - #include <base_logger.hpp>
Base implementation for loggers
Subclassed by tuber::core::logging::console_logger
Public Functions
-
void
log(const std::string &message, message_type type) = 0¶
-
void
-
class
console_logger: public tuber::core::logging::base_logger¶ - #include <console_logger.hpp>
Logger that logs to the standard output
Public Functions
-
void
log(const std::string &message, message_type type)¶
-
void
-
class
engine¶ - #include <engine.hpp>
Main engine class, used to initialize the system
Public Functions
-
void
start() const¶ Starts the engine
-
void
-
class
event¶ - #include <event.hpp>
Interface for events
Subclassed by tuber::events::base_event
-
class
event_bus¶ - #include <event_bus.hpp>
Dispatches events
Public Functions
-
event_bus()¶
-
~event_bus()¶
-
void
start()¶ Starts the event bus thread
-
void
stop()¶ Stops the event bus thread
-
template <typename event_type = event*, typename callable_type = std::function<void(event_type)>>
voidregister_handler(const std::string &event_identifier, callable_type &&handler)¶ Registers an event handler
- Template Parameters
event_type: The type of the event to registercallable_type: The type of the callback method
- Parameters
event_identifier: The identifier of the eventhandler: The handler function
-
-
class
log_event: public tuber::events::base_event¶ - #include <log_event.hpp>
Event for logging messages
Public Functions
-
log_event()¶
-
log_event(const std::string &message, message_type type = message_type::INFO)¶ Creates a log event with the given message
- Parameters
message: The message to logtype: The type of the message
-
const std::string &
get_message() const¶ - Return
- The message to log
-
message_type
get_type() const¶ - Return
- The type of the message
-
-
class
logger¶ - #include <logger.hpp>
Interface for loggers
Subclassed by tuber::core::logging::base_logger
Public Functions
-
virtual
~logger()¶
-
virtual void
log(const std::string &message, message_type type) = 0¶
-
virtual
-
namespace
tuber¶
-
namespace
core¶
-
namespace
logging¶ -
Functions
-
std::string
message_type_to_string(message_type type)¶ Converts a message_type to a string
- Return
- The message_type as a string
- Parameters
type: The message_type to convert
-
std::string
-
namespace
events¶ Typedefs
-
using
tuber::events::handler_type = typedef std::function<void(event*)>
-
using
-
file
engine.hpp
-
file
base_logger.hpp - #include “core/logging/logger.hpp”#include “events/event_bus.hpp”
-
file
console_logger.hpp - #include “core/logging/base_logger.hpp”
-
file
log_event.hpp - #include “events/base_event.hpp”#include “core/logging/message_type.hpp”
-
file
logger.hpp - #include <string>#include “core/logging/message_type.hpp”
-
file
message_type.hpp - #include <string>
-
file
base_event.hpp - #include “events/event.hpp”
-
file
event.hpp - #include <string>
-
file
event_bus.hpp - #include <functional>#include <list>#include <queue>#include <thread>#include <mutex>#include <condition_variable>#include “events/event.hpp”
-
file
engine.cpp - #include “core/engine.hpp”#include <iostream>
-
file
base_logger.cpp - #include “core/logging/base_logger.hpp”#include “core/logging/log_event.hpp”
-
file
console_logger.cpp - #include “core/logging/console_logger.hpp”#include <iostream>
-
file
log_event.cpp - #include “core/logging/log_event.hpp”#include “core/logging/message_type.hpp”
-
file
base_event.cpp - #include “events/base_event.hpp”
-
file
event_bus.cpp - #include “events/event_bus.hpp”
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/src/tuber/core
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/include/tuber/core
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/src/tuber/events
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/include/tuber/events
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/include
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/src/tuber/core/logging
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/include/tuber/core/logging
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/src
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/src/tuber
-
dir
/home/docs/checkouts/readthedocs.org/user_builds/tuber/checkouts/develop/include/tuber