Skip to content
Snippets Groups Projects
user avatar
authored
user avatar

Hi, you have downloaded the C++ thin client for TGenBase.

So, how to proceed?

Setup

The project requires ROOT. Configure the ROOT environment before, e.g.:

. /path/to/root/bin/thisroot.sh

Build the project with following commands

mkdir -p build && cd build
cmake ..
make

To install the project run make install. Pass -DCMAKE_INSTALL_PREFIX=/your/installation/path to cmake command to change the installation path.

Configuration

The TGenBase client for C++ needs to know where to fetch the data from. The client uses the ServerURI entry in the TGenBaseClientConfig.json file to point to a correct TGenBase database server installation.

The authentication information will be stored in this file between C++ sessions under the AccessToken configuration key.

The data is stored there automatically upon every successful user login.

Querying data

To query any data you need to configure the client and auth with TGenBase.

The simpliest script in ROOT command line can look like this:

TGenBase::Client::Instance()->SetServerURI("https://127.0.0.1:8008")
auto user = TGenBase::User::Login("user@example.com", "very_secure/password")
if (user) {
  user->Print()
}

Exception safety

Note, that code by default is explicitly exception safe. This means you should pay attention to the standard output. In case of exception, return values for getters with single queries are nullptr and for array queries are empty vectors.

If you want to enable the exception handling compile the package with -DTGENBASECLIENT_WITH_EXCEPTIONS