Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions olp-cpp-sdk-dataservice-write/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
project(olp-cpp-sdk-dataservice-write VERSION 1.24.0)
set(DESCRIPTION "C++ API library for writing data to OLP")

find_package(Boost REQUIRED)

set(OLP_SDK_DATASERVICE_WRITE_API_HEADERS
./include/olp/dataservice/write/DataServiceWriteApi.h
./include/olp/dataservice/write/IndexLayerClient.h
Expand Down Expand Up @@ -159,16 +161,21 @@ set(OLP_SDK_DATASERVICE_WRITE_SOURCES
./src/generated/serializer/PublishPartitionsSerializer.h
./src/generated/serializer/UpdateIndexRequestSerializer.cpp
./src/generated/serializer/UpdateIndexRequestSerializer.h

./src/utils/BoostJsonSrc.cpp
)

add_library(${PROJECT_NAME}
${OLP_SDK_DATASERVICE_WRITE_INCLUDES}
${OLP_SDK_DATASERVICE_WRITE_SOURCES})

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
$<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>)

target_compile_definitions(${PROJECT_NAME}
PRIVATE DATASERVICE_WRITE_LIBRARY)
Expand All @@ -177,6 +184,11 @@ if(BUILD_SHARED_LIBS)
PUBLIC DATASERVICE_WRITE_SHARED_LIBRARY)
endif()

target_compile_definitions(${PROJECT_NAME}
PRIVATE
BOOST_ALL_NO_LIB
BOOST_JSON_NO_LIB)

# Used also in the package config file
set(PROJECT_LIBS olp-cpp-sdk-core)

Expand Down
6 changes: 4 additions & 2 deletions olp-cpp-sdk-dataservice-write/src/CatalogSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 HERE Europe B.V.
* Copyright (C) 2020-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,8 @@

#include "CatalogSettings.h"

#include <utility>

#include <olp/core/cache/CacheSettings.h>
#include <olp/core/client/OlpClientSettingsFactory.h>
#include <boost/format.hpp>
Expand All @@ -29,7 +31,7 @@
#include <generated/serializer/CatalogSerializer.h>
#include <generated/serializer/JsonSerializer.h>
#include <generated/parser/CatalogParser.h>
#include <olp/core/generated/parser/JsonParser.h>
#include <generated/parser/JsonParser.h>
// clang-format on

namespace olp {
Expand Down
4 changes: 2 additions & 2 deletions olp-cpp-sdk-dataservice-write/src/JsonResultParser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 HERE Europe B.V.
* Copyright (C) 2020-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,8 +23,8 @@
#include <string>
#include <utility>

#include <generated/parser/JsonParser.h>
#include <olp/core/client/ApiError.h>
#include <olp/core/generated/parser/JsonParser.h>
#include <olp/core/logging/Log.h>

namespace olp {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 HERE Europe B.V.
* Copyright (C) 2019-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,13 @@

#include "ApiParser.h"

#include <olp/core/generated/parser/ParserWrapper.h>
#include <map>

#include <generated/parser/ParserWrapper.h>

namespace olp {
namespace parser {
void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Api& x) {
x.SetApi(parse<std::string>(value, "api"));
x.SetVersion(parse<std::string>(value, "version"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 HERE Europe B.V.
* Copyright (C) 2019-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,14 +19,14 @@

#pragma once

#include <rapidjson/document.h>
#include <boost/json/value.hpp>
#include "generated/model/Api.h"

#include <string>

namespace olp {
namespace parser {
void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Api& x);

} // namespace parser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 HERE Europe B.V.
* Copyright (C) 2019-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,48 +19,50 @@

#include "CatalogParser.h"

#include <olp/core/generated/parser/ParserWrapper.h>
#include <vector>

#include <generated/parser/ParserWrapper.h>

namespace olp {
namespace parser {
using namespace olp::dataservice::write;
namespace model = olp::dataservice::write::model;

void from_json(const rapidjson::Value& value, model::Coverage& x) {
void from_json(const boost::json::value& value, model::Coverage& x) {
x.SetAdminAreas(parse<std::vector<std::string> >(value, "adminAreas"));
}

void from_json(const rapidjson::Value& value, model::IndexDefinition& x) {
void from_json(const boost::json::value& value, model::IndexDefinition& x) {
x.SetName(parse<std::string>(value, "name"));
x.SetType(parse<std::string>(value, "type"));
x.SetDuration(parse<int64_t>(value, "duration"));
x.SetZoomLevel(parse<int64_t>(value, "zoomLevel"));
}

void from_json(const rapidjson::Value& value, model::IndexProperties& x) {
void from_json(const boost::json::value& value, model::IndexProperties& x) {
x.SetTtl(parse<std::string>(value, "ttl"));
x.SetIndexDefinitions(
parse<std::vector<model::IndexDefinition> >(value, "indexDefinitions"));
}

void from_json(const rapidjson::Value& value, model::Creator& x) {
void from_json(const boost::json::value& value, model::Creator& x) {
x.SetId(parse<std::string>(value, "id"));
}

void from_json(const rapidjson::Value& value, model::Owner& x) {
void from_json(const boost::json::value& value, model::Owner& x) {
x.SetCreator(parse<model::Creator>(value, "creator"));
x.SetOrganisation(parse<model::Creator>(value, "organisation"));
}

void from_json(const rapidjson::Value& value, model::Partitioning& x) {
void from_json(const boost::json::value& value, model::Partitioning& x) {
x.SetScheme(parse<std::string>(value, "scheme"));
x.SetTileLevels(parse<std::vector<int64_t> >(value, "tileLevels"));
}

void from_json(const rapidjson::Value& value, model::Schema& x) {
void from_json(const boost::json::value& value, model::Schema& x) {
x.SetHrn(parse<std::string>(value, "hrn"));
}

void from_json(const rapidjson::Value& value, model::StreamProperties& x) {
void from_json(const boost::json::value& value, model::StreamProperties& x) {
// Parsing these as double even though OepnAPI sepcs says int64 because
// Backend returns the value in decimal format (e.g. 1.0) and this triggers an
// assert in RapidJSON when parsing.
Expand All @@ -70,18 +72,18 @@ void from_json(const rapidjson::Value& value, model::StreamProperties& x) {
static_cast<int64_t>(parse<double>(value, "dataOutThroughputMbps")));
}

void from_json(const rapidjson::Value& value, model::Encryption& x) {
void from_json(const boost::json::value& value, model::Encryption& x) {
x.SetAlgorithm(parse<std::string>(value, "algorithm"));
}

void from_json(const rapidjson::Value& value, model::Volume& x) {
void from_json(const boost::json::value& value, model::Volume& x) {
x.SetVolumeType(parse<std::string>(value, "volumeType"));
x.SetMaxMemoryPolicy(parse<std::string>(value, "maxMemoryPolicy"));
x.SetPackageType(parse<std::string>(value, "packageType"));
x.SetEncryption(parse<model::Encryption>(value, "encryption"));
}

void from_json(const rapidjson::Value& value, model::Layer& x) {
void from_json(const boost::json::value& value, model::Layer& x) {
x.SetId(parse<std::string>(value, "id"));
x.SetName(parse<std::string>(value, "name"));
x.SetSummary(parse<std::string>(value, "summary"));
Expand All @@ -103,11 +105,11 @@ void from_json(const rapidjson::Value& value, model::Layer& x) {
x.SetVolume(parse<model::Volume>(value, "volume"));
}

void from_json(const rapidjson::Value& value, model::Notifications& x) {
void from_json(const boost::json::value& value, model::Notifications& x) {
x.SetEnabled(parse<bool>(value, "enabled"));
}

void from_json(const rapidjson::Value& value, model::Catalog& x) {
void from_json(const boost::json::value& value, model::Catalog& x) {
x.SetId(parse<std::string>(value, "id"));
x.SetHrn(parse<std::string>(value, "hrn"));
x.SetName(parse<std::string>(value, "name"));
Expand Down
30 changes: 15 additions & 15 deletions olp-cpp-sdk-dataservice-write/src/generated/parser/CatalogParser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 HERE Europe B.V.
* Copyright (C) 2019-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,49 +21,49 @@

#include <string>

#include <rapidjson/document.h>
#include <boost/json/value.hpp>

#include <generated/model/Catalog.h>

namespace olp {
namespace parser {
void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Coverage& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::IndexDefinition& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::IndexProperties& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Creator& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Owner& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Partitioning& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Schema& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::StreamProperties& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Encryption& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Volume& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Layer& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Notifications& x);

void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Catalog& x);
} // namespace parser
} // namespace olp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 HERE Europe B.V.
* Copyright (C) 2019-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,13 @@

#include "DetailsParser.h"

#include <olp/core/generated/parser/ParserWrapper.h>
#include <string>

#include <generated/parser/ParserWrapper.h>

namespace olp {
namespace parser {
void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
olp::dataservice::write::model::Details& x) {
x.SetState(parse<std::string>(value, "state"));
x.SetMessage(parse<std::string>(value, "message"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 HERE Europe B.V.
* Copyright (C) 2019-2026 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,13 +19,13 @@

#pragma once

#include <rapidjson/document.h>
#include <boost/json/value.hpp>

#include <olp/dataservice/write/generated/model/Details.h>

namespace olp {
namespace parser {
void from_json(const rapidjson::Value& value,
void from_json(const boost::json::value& value,
dataservice::write::model::Details& x);
} // namespace parser
} // namespace olp
Loading
Loading