Inspirel banner

Programming Distributed Systems with YAMI4

12.1 Data Model

The data model is exactly the same as in the general-purpose library - in fact, in the case of Ada, the API of the parameters object is exactly the same in both core and general-purpose part (as defined in the YAMI.Parameters package).

The C++ API for the parameters object is different and is heavily influenced by the lack of exceptions. Every function that could possibly fail returns the result enumeration value. Another important difference is that the std::string class is not used and all strings are passed as a pair of values containing pointer to the beginning of the string buffer and its length (this allows for strings with embedded zeros) or as a pointer to the null-terminated string.

An example usage is:

#include <parameters.h>

using namespace yami::core;

{
    parameters content;

    result res = content.set_boolean("some_flag", true);
    if (res == ok)
    {
        // ...
    }

    bool flag;
    res = content.get_boolean("some_flag", flag);
    if (res == ok)
    {
        // ...
    }

    // etc.
}

Of course, when a core parameters object is serialized, it can be deserialized as a general-purpose parameters object and the other way round.