Headers and namespaces

Zenoh C++ API is available through one of the following headers: “zenohc.hxx”, “zenohpico.hxx” and “zenoh.hxx”. The first two defines C++ wrappers for C libraries zenoh-c and zenoh-pico respectively in namespaces zenohc and zenohpico:

#include "zenohc.hxx"
using namespace zenohc;
#include "zenohpico.hxx"
using namespace zenohpico;

The header “zenoh.hxx” selects between one of headers above depending on the macro ZENOHCXX_ZENOHC or ZENOHCXX_ZENOHPICO. It also aliases the corrresponding namespace to zenoh:

#define ZENOHCXX_ZENOHC
// #define ZENOHCXX_ZENOHPICO
#include "zenoh.hxx"
using namespace zenoh;

This can be useful if it’s necessary to compile the same source for both zenoh-c and zenoh-pico.

There is also z:: namespace which appears in the method and function prototypes in source files. It is an internal alias for the current namespace (zenohc or zenohpico), it’s never used in the user code.

In the documentation below, we will use the zenoh namespace.