olp-cpp-sdk  1.22.0
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/dataservice/read/ConsumerProperties.h>
26 #include <olp/dataservice/read/Types.h>
27 #include <boost/optional.hpp>
28 
29 namespace olp {
30 namespace dataservice {
31 namespace read {
32 
36 class 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 
75  return subscription_mode_;
76  }
77 
89  boost::optional<SubscriptionId> subscription_id) {
90  subscription_id_ = std::move(subscription_id);
91  return *this;
92  }
93 
99  inline const boost::optional<SubscriptionId>& GetSubscriptionId() const {
100  return subscription_id_;
101  }
102 
115  boost::optional<std::string> consumer_id) {
116  consumer_id_ = std::move(consumer_id);
117  return *this;
118  }
119 
125  inline const boost::optional<std::string>& GetConsumerId() const {
126  return consumer_id_;
127  }
128 
141  boost::optional<ConsumerProperties> properties) {
142  consumer_properties_ = std::move(properties);
143  return *this;
144  }
145 
151  inline const boost::optional<ConsumerProperties>& GetConsumerProperties()
152  const {
153  return consumer_properties_;
154  }
155 
156  private:
157  SubscriptionMode subscription_mode_{SubscriptionMode::kSerial};
158  boost::optional<SubscriptionId> subscription_id_;
159  boost::optional<std::string> consumer_id_;
160  boost::optional<ConsumerProperties> consumer_properties_;
161 };
162 
163 } // namespace read
164 } // namespace dataservice
165 } // namespace olp
Used to subscribe to a stream layer.
Definition: SubscribeRequest.h:36
SubscriptionMode
The subscription mode.
Definition: SubscribeRequest.h:41
const boost::optional< std::string > & GetConsumerId() const
Gets the consumer ID of the request.
Definition: SubscribeRequest.h:125
SubscribeRequest & WithSubscriptionId(boost::optional< SubscriptionId > subscription_id)
(Optional) Sets the subscription ID used for the request.
Definition: SubscribeRequest.h:88
SubscribeRequest & WithSubscriptionMode(SubscriptionMode mode)
Sets the subscription mode for the request.
Definition: SubscribeRequest.h:64
const boost::optional< SubscriptionId > & GetSubscriptionId() const
Gets the subscription ID of the request.
Definition: SubscribeRequest.h:99
const boost::optional< ConsumerProperties > & GetConsumerProperties() const
Gets the consumer properties of the request.
Definition: SubscribeRequest.h:151
SubscriptionMode GetSubscriptionMode() const
Gets the subscription mode of the request.
Definition: SubscribeRequest.h:74
SubscribeRequest & WithConsumerProperties(boost::optional< ConsumerProperties > properties)
Sets the consumer properties for the request.
Definition: SubscribeRequest.h:140
SubscribeRequest & WithConsumerId(boost::optional< std::string > consumer_id)
(Optional) Sets the consumer ID used for the request.
Definition: SubscribeRequest.h:114
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24