WYRDTEK Home Features Reference Downloads About


Reference/C++ Interface

The exstreamspeed C++ API closely matches the C API. Each C interface corresponds to a C++ class and each function in the interface corresponds to a method in that class.

The C++ interface is fully inlined and contained within the files es/es.H and es/esINLINES.C.

In general, C function names that begin with an es_ prefix, followed by an interface name and method name - eg. es_sd_getstr() - map to a C++ namespace (es), class (sd) and method (getstr) - i.e. es::sd::getstr().

General Structure

In general, C++ classes contain a handle member variable. Constructors call a _new() function to initialize it and destructors call a _delete() function to destroy it.

Exceptions to this include the classes: es::date, es::sock, es::mbc and es::mbn. es::date has a date-id integer member (see struct es_date for a discussion of date-ids) and es::sock has an integer file descriptor member.

es::mbc instances are instead constructed via es::mbd::newclass() and es::mbn via es::mb::newnode() and have no destructor implementations.

Return Codes and Exceptions

Error return codes in the C API are replaced by exceptions in the C++ interface:

es::err wraps the standard return code and is thrown if the underlying C function fails to return ES_ERROR_NONE.

es::sockerr is thrown by members of the es::sock class and wraps the system error code errno.

es::errmsg is thrown by the mba interface and contains both return code and error message.

Iterator and sorted iterator methods (defined in class es::mbi and class es::mbs) that have bool return codes (such as es::mbi::findfetch ) map ES_ERROR_NONE to true and ES_ERROR_FAILTOFIND to false. All other error codes trigger an exception.

Database Nodes

An additional class, es::mbnref, has been introduced to implement the binding of database node handles by reference - see es_mbb_mbn_r().

es::mbnref contains a struct es_mbn ** member and contains methods to de-reference or retrieve and update the underlying node handle accordingly.

[Back To Reference]