C++ Sample App

Lets compile the C++ sample app by going through it step by step. We assume you have installed vcpkg. Install whichever triplet you wish. Here we install the x64-windows triplet.

C:\vcpkg>vcpkg install boost:x64-windows
C:\vcpkg>vcpkg install bond:x64-windows
C:\vcpkg>vcpkg install cppzmq:x64-windows

While all the files are provided in a single folder and you could compile it in one go, we will do so step by step so that you can see how the different pieces fit together.

Step 1: Create A C++ Project

Create a C++ project in your IDE. The samples use C++17 because it simplifies certain things. For example it enables structured bindings like auto [x, y] = some_func(...) which greatly helps with code readability. C++17 also contains std::optional which simplifies control flow.

If your project policy requires any versions lower than C++17, it shouldn’t be too difficult to modify it to run with C++11.

Step 2: Pull In Parietal Numerics Bindings

The following files are generated by the Bond codegen tool. These files contain not only the types and enums, but also the serialization and deserialization logic.


Step 3: Pull In Helper Files

The following is some machinery to help us get going. These are the sets of files you will have to adapt to your project policy.


Our main priority in writing these files (aside from zhelpers.hpp which is external) was to make them easy to understand… or as much as we could. For example, the Parietal context class PC in the file sockets.h is implemented as a Singleton. Whether or not you want Singletons in your project is your call. You can reimplement however you wish. However in the case of this sample app, it made things easy to understand.

Step 4: Pull In Individual Examples

example_cvlasso.h  (async example)

Step 5: Pull In main.cpp

The entrypoint of the program.

Step 6: Compile & Run

You should now be able to compile the sample application. Make sure the Parietal Numerics engine is running in the background before you execute compiled sample application binary.