Skip to content

Commit 925a4ff

Browse files
Move Types to the separate header.
Relates-To: OLPEDGE-957 Signed-off-by: Mykhailo Kuchma <[email protected]>
1 parent 962f738 commit 925a4ff

File tree

8 files changed

+108
-60
lines changed

8 files changed

+108
-60
lines changed

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogClient.h

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,12 @@
2323
#include <memory>
2424

2525
#include <olp/core/cache/CacheSettings.h>
26-
#include <olp/core/client/ApiError.h>
27-
#include <olp/core/client/ApiResponse.h>
2826
#include <olp/core/client/OlpClientSettings.h>
2927
#include <olp/core/geo/tiling/TileKey.h>
3028
#include <olp/core/porting/deprecated.h>
3129
#include "DataServiceReadApi.h"
3230
#include "olp/dataservice/read/PrefetchTileResult.h"
33-
#include "olp/dataservice/read/model/Catalog.h"
34-
#include "olp/dataservice/read/model/Data.h"
35-
#include "olp/dataservice/read/model/Partitions.h"
36-
#include "olp/dataservice/read/model/VersionResponse.h"
31+
#include "olp/dataservice/read/Types.h"
3732

3833
namespace olp {
3934

@@ -44,51 +39,13 @@ class HRN;
4439
namespace dataservice {
4540
namespace read {
4641

47-
class PrefetchTilesRequest;
48-
49-
namespace model {
50-
class Partition;
51-
} // namespace model
42+
class CatalogClientImpl;
5243

5344
class CatalogRequest;
54-
using CatalogResult = model::Catalog;
55-
using CatalogResponse = client::ApiResponse<CatalogResult, client::ApiError>;
56-
using CatalogResponseCallback = std::function<void(CatalogResponse response)>;
57-
5845
class CatalogVersionRequest;
59-
using CatalogVersionResult = model::VersionResponse;
60-
using CatalogVersionResponse =
61-
client::ApiResponse<CatalogVersionResult, client::ApiError>;
62-
using CatalogVersionCallback =
63-
std::function<void(CatalogVersionResponse response)>;
64-
65-
class PartitionsRequest;
66-
using PartitionsResult = model::Partitions;
67-
using PartitionsResponse =
68-
client::ApiResponse<PartitionsResult, client::ApiError>;
69-
using PartitionsResponseCallback =
70-
std::function<void(PartitionsResponse response)>;
71-
7246
class DataRequest;
73-
using DataResult = model::Data;
74-
using DataResponse = client::ApiResponse<DataResult, client::ApiError>;
75-
using DataResponseCallback = std::function<void(DataResponse response)>;
76-
77-
/**
78-
* @brief The PrefetchTilesResponse class encapsulates the result of a prefetch
79-
* operation
80-
*/
81-
using PrefetchTilesResult = std::vector<std::shared_ptr<PrefetchTileResult>>;
82-
using PrefetchTilesResponse =
83-
client::ApiResponse<PrefetchTilesResult, client::ApiError>;
84-
85-
/**
86-
* @brief Prefetch completion callback
87-
*/
88-
using PrefetchTilesResponseCallback =
89-
std::function<void(const PrefetchTilesResponse& response)>;
90-
91-
class CatalogClientImpl;
47+
class PartitionsRequest;
48+
class PrefetchTilesRequest;
9249

9350
/**
9451
* @brief The CatalogClient class. Marshals Requests and their Results.
@@ -241,7 +198,5 @@ class DATASERVICE_READ_API CatalogClient final {
241198
};
242199

243200
} // namespace read
244-
245201
} // namespace dataservice
246-
247202
} // namespace olp
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (C) 2019 HERE Europe B.V.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
#pragma once
21+
22+
#include <memory>
23+
24+
#include <olp/core/client/ApiError.h>
25+
#include <olp/core/client/ApiResponse.h>
26+
27+
#include <olp/dataservice/read/model/Catalog.h>
28+
#include <olp/dataservice/read/model/Data.h>
29+
#include <olp/dataservice/read/model/Partitions.h>
30+
#include <olp/dataservice/read/model/VersionResponse.h>
31+
32+
namespace olp {
33+
namespace dataservice {
34+
namespace read {
35+
36+
class PrefetchTileResult;
37+
38+
/// Response template type
39+
template <typename ResultType>
40+
using Response = client::ApiResponse<ResultType, client::ApiError>;
41+
42+
/// Callback template type
43+
template <typename ResultType>
44+
using Callback = std::function<void(Response<ResultType>)>;
45+
46+
/// Catalog configuration alias type
47+
using CatalogResult = model::Catalog;
48+
/// Catalog configuration response type
49+
using CatalogResponse = Response<CatalogResult>;
50+
/// Catalog configuration response callback type
51+
using CatalogResponseCallback = Callback<CatalogResult>;
52+
53+
/// Catalog version result alias type
54+
using CatalogVersionResult = model::VersionResponse;
55+
/// Catalog version response type
56+
using CatalogVersionResponse = Response<CatalogVersionResult>;
57+
/// Catalog version response callback type
58+
using CatalogVersionCallback = Callback<CatalogVersionResult>;
59+
60+
/// Partition metadata result alias type
61+
using PartitionsResult = model::Partitions;
62+
/// Partition metadata response type
63+
using PartitionsResponse = Response<PartitionsResult>;
64+
/// Partition metadata response callback type
65+
using PartitionsResponseCallback = Callback<PartitionsResult>;
66+
67+
/// Data alias type
68+
using DataResult = model::Data;
69+
/// Data response alias
70+
using DataResponse = Response<DataResult>;
71+
/// Data response callback type
72+
using DataResponseCallback = Callback<DataResult>;
73+
74+
/// Prefetch tiles result alias
75+
using PrefetchTilesResult = std::vector<std::shared_ptr<PrefetchTileResult>>;
76+
/// Prefetch tiles response type
77+
using PrefetchTilesResponse = Response<PrefetchTilesResult>;
78+
/// Prefetch completion callback type
79+
using PrefetchTilesResponseCallback = Callback<PrefetchTilesResult>;
80+
81+
} // namespace read
82+
} // namespace dataservice
83+
} // namespace olp

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionedLayerClient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <olp/dataservice/read/PartitionsRequest.h>
3333
#include <olp/dataservice/read/PrefetchTileResult.h>
3434
#include <olp/dataservice/read/PrefetchTilesRequest.h>
35+
#include <olp/dataservice/read/Types.h>
3536
#include <olp/dataservice/read/model/Data.h>
3637
#include <olp/dataservice/read/model/Partitions.h>
3738

olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,23 @@
1919

2020
#pragma once
2121

22+
#include <olp/core/cache/KeyValueCache.h>
2223
#include <olp/core/client/CancellationContext.h>
2324
#include <olp/core/client/CancellationToken.h>
2425
#include <olp/core/client/HRN.h>
25-
#include "generated/api/MetadataApi.h"
26+
#include <olp/core/client/OlpClientSettings.h>
2627
#include "MultiRequestContext.h"
27-
#include "olp/dataservice/read/CatalogClient.h"
28+
#include "generated/api/MetadataApi.h"
2829
#include "olp/dataservice/read/DataRequest.h"
30+
#include "olp/dataservice/read/Types.h"
2931

3032
namespace olp {
3133
namespace dataservice {
3234
namespace read {
35+
36+
class CatalogRequest;
37+
class CatalogVersionRequest;
38+
3339
namespace repository {
3440
class ApiRepository;
3541
class CatalogCacheRepository;
@@ -53,8 +59,7 @@ class CatalogRepository final {
5359
static MetadataApi::CatalogVersionResponse GetLatestVersion(
5460
const client::HRN& catalog,
5561
client::CancellationContext cancellation_context,
56-
const DataRequest& data_request,
57-
client::OlpClientSettings settings);
62+
const DataRequest& data_request, client::OlpClientSettings settings);
5863

5964
private:
6065
client::HRN hrn_;

olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void DataRepository::GetData(
330330
*cache_);
331331
}
332332

333-
DataRepository::DataResponse DataRepository::GetVersionedData(
333+
DataResponse DataRepository::GetVersionedData(
334334
const client::HRN& catalog, const std::string& layer_id,
335335
DataRequest request, client::CancellationContext context,
336336
client::OlpClientSettings settings) {
@@ -374,7 +374,7 @@ DataRepository::DataResponse DataRepository::GetVersionedData(
374374
catalog, layer_id, kBlobService, request, context, settings);
375375
}
376376

377-
DataRepository::DataResponse DataRepository::GetBlobData(
377+
DataResponse DataRepository::GetBlobData(
378378
const client::HRN& catalog, const std::string& layer,
379379
const std::string& service, const DataRequest& data_request,
380380
client::CancellationContext cancellation_context,
@@ -483,7 +483,7 @@ DataRepository::DataResponse DataRepository::GetBlobData(
483483
return blob_response;
484484
}
485485

486-
DataRepository::DataResponse DataRepository::GetVolatileData(
486+
DataResponse DataRepository::GetVolatileData(
487487
const client::HRN& catalog, const std::string& layer_id,
488488
DataRequest request, client::CancellationContext context,
489489
client::OlpClientSettings settings) {

olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
#include <olp/core/client/CancellationContext.h>
2323
#include <olp/core/client/CancellationToken.h>
2424
#include <olp/core/client/HRN.h>
25+
#include <olp/core/client/OlpClientSettings.h>
2526
#include "MultiRequestContext.h"
2627
#include "generated/api/BlobApi.h"
27-
#include "olp/dataservice/read/CatalogClient.h"
28+
#include "olp/dataservice/read/Types.h"
2829

2930
namespace olp {
3031
namespace dataservice {
3132
namespace read {
33+
class DataRequest;
3234
namespace repository {
3335
class ApiRepository;
3436
class CatalogRepository;
@@ -38,8 +40,6 @@ class DataCacheRepository;
3840

3941
class DataRepository final {
4042
public:
41-
using DataResponse = client::ApiResponse<model::Data, client::ApiError>;
42-
4343
DataRepository(const client::HRN& hrn, std::shared_ptr<ApiRepository> apiRepo,
4444
std::shared_ptr<CatalogRepository> catalogRepo,
4545
std::shared_ptr<PartitionsRepository> partitionsRepo,

olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@
2525
#include <olp/core/client/CancellationContext.h>
2626
#include <olp/core/client/CancellationToken.h>
2727
#include <olp/core/client/HRN.h>
28+
#include <olp/core/client/OlpClientSettings.h>
2829
#include "MultiRequestContext.h"
2930
#include "generated/api/QueryApi.h"
30-
#include "olp/dataservice/read/CatalogClient.h"
31+
#include "olp/dataservice/read/Types.h"
3132

3233
namespace olp {
3334
namespace dataservice {
3435
namespace read {
3536
class DataRequest;
37+
class PartitionsRequest;
38+
3639
namespace repository {
3740
class ApiRepository;
3841
class CatalogRepository;

olp-cpp-sdk-dataservice-read/tests/DataRepositoryTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include <matchers/NetworkUrlMatchers.h>
2323
#include <mocks/NetworkMock.h>
24+
#include <olp/core/cache/CacheSettings.h>
2425
#include <olp/core/cache/KeyValueCache.h>
2526
#include <olp/core/client/OlpClientFactory.h>
2627
#include <olp/core/client/OlpClientSettings.h>

0 commit comments

Comments
 (0)