To use MLP Library you have to include main header file MlpLib.h
into your source code. This will include necessary initialization macros
and MlpParser object. Initialization macro MLP_LIB_CPP_INIT
must be run before any other
object from MLP Library is used. It should be run exactly once at the
beginning of your code. There is also macro MLP_LIB_CPP_TERMINATE
used to clean environment
before exit. It should also be called exactly once at the and of your
program. Be aware that all objects from MLP Library that were created
should be deleted before MLP_LIB_CPP_TERMINATE
macro call.
All magic that is done in the macros is wrapping around Xerces-c initialization a termination process. On the following code you can find sample initial program that is initializing a terminating environment.
#include <iostream> #include <libmlp-cpp/MlpLib.hpp> int main( int argc, char* argv[ ] ) { // Initialization of environment MLP_LIB_CPP_INIT; MlpParser * myMlpParser = new MlpParser(); delete myMlpParser; // Delete before termination macro // Use dynamically allocated MlpParser so you // can manually delete it before termination // macro. // Initialization of environment MLP_LIB_CPP_TERMINATE; return 0; }