olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
SubscribeRequest.h
1/*
2 * Copyright (C) 2020-2021 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 <string>
23#include <utility>
24
25#include <olp/core/porting/optional.h>
26#include <olp/dataservice/read/ConsumerProperties.h>
27#include <olp/dataservice/read/Types.h>
28
29namespace olp {
30namespace dataservice {
31namespace read {
32
36class DATASERVICE_READ_API SubscribeRequest final {
37 public:
41 enum class SubscriptionMode : char {
48 kSerial,
53 kParallel
54 };
65 subscription_mode_ = mode;
66 return *this;
67 }
68
74 SubscriptionMode GetSubscriptionMode() const { return subscription_mode_; }
75
86 template <class T = porting::optional<std::string>>
87 SubscribeRequest& WithSubscriptionId(T&& subscription_id) {
88 subscription_id_ = std::forward<T>(subscription_id);
89 return *this;
90 }
91
97 const porting::optional<SubscriptionId>& GetSubscriptionId() const {
98 return subscription_id_;
99 }
100
112 template <class T = porting::optional<std::string>>
114 consumer_id_ = std::forward<T>(consumer_id);
115 return *this;
116 }
117
123 const porting::optional<std::string>& GetConsumerId() const {
124 return consumer_id_;
125 }
126
138 template <class T = porting::optional<std::string>>
140 consumer_properties_ = std::forward<T>(properties);
141 return *this;
142 }
143
149 const porting::optional<ConsumerProperties>& GetConsumerProperties() const {
150 return consumer_properties_;
151 }
152
153 private:
154 SubscriptionMode subscription_mode_{SubscriptionMode::kSerial};
155 porting::optional<SubscriptionId> subscription_id_;
156 porting::optional<std::string> consumer_id_;
157 porting::optional<ConsumerProperties> consumer_properties_;
158};
159
160} // namespace read
161} // namespace dataservice
162} // namespace olp
Used to subscribe to a stream layer.
Definition SubscribeRequest.h:36
SubscriptionMode
The subscription mode.
Definition SubscribeRequest.h:41
SubscribeRequest & WithSubscriptionMode(SubscriptionMode mode)
Sets the subscription mode for the request.
Definition SubscribeRequest.h:64
SubscribeRequest & WithSubscriptionId(T &&subscription_id)
(Optional) Sets the subscription ID used for the request.
Definition SubscribeRequest.h:87
const porting::optional< std::string > & GetConsumerId() const
Gets the consumer ID of the request.
Definition SubscribeRequest.h:123
SubscribeRequest & WithConsumerId(T &&consumer_id)
(Optional) Sets the consumer ID used for the request.
Definition SubscribeRequest.h:113
SubscriptionMode GetSubscriptionMode() const
Gets the subscription mode of the request.
Definition SubscribeRequest.h:74
const porting::optional< ConsumerProperties > & GetConsumerProperties() const
Gets the consumer properties of the request.
Definition SubscribeRequest.h:149
SubscribeRequest & WithConsumerProperties(T &&properties)
Sets the consumer properties for the request.
Definition SubscribeRequest.h:139
const porting::optional< SubscriptionId > & GetSubscriptionId() const
Gets the subscription ID of the request.
Definition SubscribeRequest.h:97
Rules all the other namespaces.
Definition AppleSignInProperties.h:24