In this guide, learn how to authenticate to and start working with the HERE platform using the Data SDK:
- Prerequisites
- Concepts
- Get credentials
- Install the SDK
- Build the SDK
- Available components
- HERE Data SDK for C++ in CMake projects
- Reference documentation
- Examples
To start using HERE Data SDK for C++, you need a platform user account.
Working with the Data SDK requires knowledge of the following subjects:
- Basic understanding of the core HERE platform concepts.
- Basic proficiency with C++11 and CMake.
For the terms and conditions covering this documentation, see the HERE Documentation License.
To use HERE Data SDK for C++, you need to understand the following concepts related to the HERE platform:
For more details, see the Data API Developer Guide.
To work with catalog or service requests to the HERE platform, you need to get authentication and authorization credentials.
You can authenticate to the HERE platform within your application with the platform credentials available on the HERE Portal by means of Data SDK for C++ authentication library. For the available authentication options, see the Identity and Access Management Developer Guide.
By default, the Data SDK downloads and compiles its dependencies. The versions of the downloaded dependencies may conflict with the versions that are already installed on your system. Therefore, the downloaded dependencies are not added to the install targets.
You can use the Data SDK in your CMake project or install it on your system.
Тo use the Data SDK directly in your CMake project, add the Data SDK via add_subdirectory()
.
To install the Data SDK on your system:
-
Install all the dependencies needed for the Data SDK.
For more information on dependencies, see the Dependencies and Linux dependencies sections in the README.md file. -
(Optional) To find the required dependencies in the system, set the
OLP_SDK_BUILD_EXTERNAL_DEPS
flag toOFF
. -
(Optional) To build the Data SDK as a shared library, set the
BUILD_SHARED_LIBS
flag toON
.
Example
The following command builds and installs the Data SDK:
cmake --build . --target install
CMake is the main build system. The minimal required version of CMake is 3.9.
CMake downloads LevelDB, Snappy, RapidJSON, and Boost. To disable downloading, set OLP_SDK_BUILD_EXTERNAL_DEPS
to OFF
. For details on CMake flags, see the related section.
To build the Data SDK:
- Clone the repository folder.
- In the root of the repository folder, run the following commands:
mkdir build && cd build
cmake ..
cmake --build .
If you cannot build the Data SDK on Windows using this instruction, see Build on Windows.
We assume that you have installed CMake, Microsoft Visual Studio 2017, and the Visual C++ tools for CMake component.
To build the Data SDK on Windows:
-
Launch Microsoft Visual Studio as administrator.
-
Open the folder containing the Data SDK or a CMake-based project that uses the Data SDK.
-
In Microsoft Visual Studio, check that the target does not contain "(Default)".
For example, select "x64-Debug" instead of "x64-Debug (Default)". -
Using the CMake menu provided by the Visual C++ tools for CMake, generate the
.cmake
files, and build the entire project with default options.
Microsoft Visual Studio uses a default build directory that has a long path name. Since dependencies for the Data SDK are installed within the build directory, it is recommended that you edit the generated
CMakeSettings.json
file and change the build directory path name to a shorter path name. This ensures that the maximum length of each path is not greater than 260 characters. For details, see the Naming Files, Paths, and Namespaces section of the Windows Dev Center documentation.
If you want to build documentation from annotated source code, you need to have Doxygen and CMake version 3.9 or later.
To generate Doxygen documentation, set the OLP_SDK_BUILD_DOC
flag to ON
when running the CMake configuration:
mkdir build && cd build
cmake -DOLP_SDK_BUILD_DOC=ON ..
cmake --build . --target docs
Flag | Description |
---|---|
BUILD_SHARED_LIBS |
Defaults to OFF . If enabled, all libraries are built as shared. |
OLP_SDK_BUILD_DOC |
Defaults to OFF . If enabled, the API reference is generated in your build directory.Note: Before you download the API reference, install Doxygen. |
OLP_SDK_ENABLE_TESTING |
Defaults to ON . If enabled, unit tests are built for each library. |
OLP_SDK_BUILD_EXTERNAL_DEPS |
Defaults to ON . If enabled, CMake downloads and compiles dependencies. |
OLP_SDK_NO_EXCEPTION |
Defaults to OFF . If enabled, all libraries are built without exceptions. |
OLP_SDK_BOOST_THROW_EXCEPTION_EXTERNAL |
Defaults to OFF . When OLP_SDK_NO_EXCEPTION is ON , boost requires boost::throw_exception() to be defined. If enabled, the external definition of boost::throw_exception() is used. Otherwise, the library uses own definition. |
OLP_SDK_MSVC_PARALLEL_BUILD_ENABLE (Windows Only) |
Defaults to ON . If enabled, the /MP compilation flag is added to build the Data SDK using multiple cores. |
OLP_SDK_DISABLE_DEBUG_LOGGING |
Defaults to OFF . If enabled, the debug and trace level log messages are not printed. |
OLP_SDK_DISABLE_LOCATION_LOGGING |
Defaults to OFF . If enabled, the level messages locations are not generated by compiler. |
OLP_SDK_ENABLE_DEFAULT_CACHE |
Defaults to ON . If enabled, the default cache implementation based on the LevelDB backend is enabled. |
OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB |
Defaults to OFF . If enabled, the default cache implementation based on the LMDB backend is enabled. |
OLP_SDK_ENABLE_ANDROID_CURL |
Defaults to OFF . If enabled, libcurl will be used instead of the Android native HTTP client. |
Data SDK for C++ contains separate libraries, each of which has a distinct functionality. For more information about the components, see the architectural overview.
When the libraries are installed, you can find them using the find_package()
function within your project. For more information on how to install libraries, see Install the SDK.
find_package(olp-cpp-sdk-core REQUIRED)
find_package(olp-cpp-sdk-authentication REQUIRED)
find_package(olp-cpp-sdk-dataservice-read REQUIRED)
find_package(olp-cpp-sdk-dataservice-write REQUIRED)
Once the necessary targets are imported, you can link them to your library:
target_link_libraries(example_app
olp-cpp-sdk-core
olp-cpp-sdk-authentication
olp-cpp-sdk-dataservice-read
olp-cpp-sdk-dataservice-write
)
The API reference documentation for Data SDK for C++ is available on GitHub Pages.
HERE Data SDK for C++ contains several example programs that demonstrate some of the key use cases. These example programs can be found in the examples folder:
- Read example – demonstrates how to get catalog and partition metadata, as well as partition data.
- Read example for a stream layer – demonstrates how to get data from a stream layer.
- Cache example – demonstrates how to get partition data and work with a mutable and protected cache.
- Write example – demonstrates how to publish data to the HERE platform.