|
RTAB-Map 0.23.12
Real-Time Appearance-Based Mapping
|
UtiLite is a simple library to create small cross-platform applications using threads, events-based communication and a powerful logger. The first three sections show the core classes of the library, then last sections show some useful functions added through time.
UtiLite provides a utility application called uResourceGenerator to generate resources to include in an executable. For example:
This will generate a HEX file "DatabaseSchema_sql.h" which can be included in source files. Data of the file is global and can be accessed by the generated const char * DATABASESCHEMA_SQL.
The ULogger can be used anywhere in the application to log messages (formated like a printf). The logger can be set (ULogger::setType()) to print in a file or in the console (with colors depending on the severity). Convenient macros are given, working like a printf(), as UDEBUG(), UINFO(), UWARN(), UERROR(), UFATAL(), UASSERT(). Small example:
This will print: [Severity] (Time) File:Line:Function() "The message"
The events-based communication framework helps to communicate between objects/threads. The UEventsManager is a singleton with which we can post events anywhere in the application by calling UEventsManager::post(). All UEventsHandler will then receive the event with their protected function UEventsHandler::handleEvent(). Handlers are added to UEventsManager by calling UEventsManager::addHandler(). The UEvent provides an abstract class to implement any event implementations. The only requirement is that the event must implements UEvent::getClassName() to know the event's type.
Look at the full example in page of UEventsHandler on how communication works with threads (UThread).
The multi-threading framework use a UThread as an abstract class to implement a thread in object-style. Reimplement UThread::mainLoop() then call UThread::start() to start the main loop of the thread. Threads can be joined by calling UThread::join() and killed by calling UThread::kill(). Classes UMutex and USemaphore provide blocking mechanisms to protect data between threads.
A useful class to compute processing time:
For files and directories manipulations :
The library provides some simple wrappers of the STL like:
A library of basic array manipulations:
A library of convenient functions to convert some data into another like:
This class can be used to get the process memory usage: UProcessInfo::getMemoryUsage().