Class Application

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Application >

Class Documentation

class core::Application : public std::enable_shared_from_this<Application>

This is the main application which is created by the executable. It will load the selected server task, connect to the database and connect to the cache.

Public Functions

Application()

Initialize all required components for the core.

void Start(std::shared_ptr<ApplicationAbstract> application)

Will start the given application type and start the io context.

const boost::property_tree::ptree &GetConfiguration() const

Return

The configuration of the core.

std::shared_ptr<mysql::MySQL> GetMySQL() const

Return

The configured database connection.

boost::asio::io_context &GetContext()

Return

The network io context, used for handling async processing.

std::shared_ptr<cache::Redis> GetRedis() const

Return

The connection to redis. It is recommended to always use the prepared cache objects.

std::shared_ptr<event::EventSystem> GetEventSystem() const

Return

The event system, used for enqueing functions and timeouts.

uint32_t GetCoreTime()

Return

Past milliseconds since the application was started.

const std::string &GetType()

Return

The application type configured in the configuration

std::shared_ptr<scripting::ScriptingEngineAbstract> GetScriptEngine(const std::string &name)

Search for a script engine given by it’s name

Return

shared pointer to the script engine or a nullptr if the engine is not available

Parameters
  • name: name of script engine

template<typename T>
T GetRandomNumber(T min, T max)

Generate a random number between the given range

Return

Template Parameters
  • T:

Parameters
  • min:

  • max: