Skip to content
Dmitry Romanov edited this page Apr 13, 2016 · 17 revisions

##RCDB C++ API overview

C++ API allows one to read RCDB condition values for the run. It doesn't provide possibility of run selection queries at this point. Also it requires C++11 to compile.

##Installation

TL; DR; version:

  • C++ api is located in $RCDB_HOME/cpp directory.
  • C++11 is required.
  • To compile run scons:
cd $RCDB_HOME/cpp
scons

The build scripts outputs binaries to the same directory to the lib and bin folders.

If $RCDB_HOME/environment.yoursh script was sourced, it adjusts LD_LIBRARY and PATH variables to the output.

C++ API requires C++11 in order to compile. This means that probably minimum GCC version to be used is 4.8.

Build options:

  • with-mysql=false/true - build API without or with MySQL support. Without MySQL, RCDB would work with SQLite only.
  • with-tests=false - don't compile unit tests.

##Getting values

The example shows how to get values from RCDB:

Connection con("mysql://rcdb@hallddb/rcdb);    // Connect

auto cnd = prov.GetCondition(10173, "event_count");  // Get event_count for run 10173

if(!cnd) {
   std::cout<< "event_count condition is not set for the run"<<std::endl;
   return;
}
event_count = cnd->ToInt();