Skip to content

Initializing the framework Core::System

Gautier lefebvre edited this page Dec 26, 2015 · 1 revision

The main class of the framework is the Core::System class. It is intended to be singleton.

The Core::System class allows you to initialize the modules (HTTP / TCP / UDP network, Worker threads, Logger).

#include "Core/System.hh"

int main(void)
{
    Core::System *system = new Core::System();

    system->initTCP(); // only use the TCP module.

    ... // subscribe to various events of the TCP module ? see the TCP wiki page for an example.

    system->run(); // wait until the system->end() method is called by another thread.
    delete sytem;
    return 0;
}

Once the system->end() method is called, the method system->run() returns and you just need to delete the system. It will clear any resource allocated by the framework.

See the documentation of the Core::System class for the initialization of any module.

Note that if you build the framework with make nodebug, the Core::System::initLogger method does nothing.

Clone this wiki locally