olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
ConsumerProperties.h
1/*
2 * Copyright (C) 2020 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 <initializer_list>
23#include <string>
24#include <utility>
25#include <vector>
26
27#include <olp/dataservice/read/DataServiceReadApi.h>
28
29namespace olp {
30namespace dataservice {
31namespace read {
32
38class DATASERVICE_READ_API ConsumerOption final {
39 public:
46 ConsumerOption(std::string key, std::string value)
47 : key_{std::move(key)}, value_{std::move(value)} {}
48
55 ConsumerOption(std::string key, const char* value)
56 : key_{std::move(key)}, value_{value} {}
57
64 ConsumerOption(std::string key, int32_t value)
65 : key_{std::move(key)}, value_{std::to_string(value)} {}
66
73 ConsumerOption(std::string key, bool value)
74 : key_{std::move(key)}, value_{std::to_string(value)} {}
75
81 const std::string& GetKey() const { return key_; }
87 const std::string& GetValue() const { return value_; }
88
89 private:
90 std::string key_;
91 std::string value_;
92};
93
94using ConsumerOptions = std::vector<ConsumerOption>;
95
100class DATASERVICE_READ_API ConsumerProperties final {
101 public:
107 explicit ConsumerProperties(ConsumerOptions properties)
108 : properties_{std::move(properties)} {}
109
115 ConsumerProperties(std::initializer_list<ConsumerOption> properties)
116 : properties_{std::move(properties)} {}
117
123 const ConsumerOptions& GetProperties() const { return properties_; }
124
125 private:
126 ConsumerOptions properties_;
127};
128
129} // namespace read
130} // namespace dataservice
131} // namespace olp
Represents a consumer configuration entry of one stream layer.
Definition ConsumerProperties.h:38
ConsumerOption(std::string key, int32_t value)
Creates the ConsumerOption instance.
Definition ConsumerProperties.h:64
ConsumerOption(std::string key, std::string value)
Creates the ConsumerOption instance.
Definition ConsumerProperties.h:46
ConsumerOption(std::string key, const char *value)
Creates the ConsumerOption instance.
Definition ConsumerProperties.h:55
const std::string & GetValue() const
Gets the value of the consumer configuration entry.
Definition ConsumerProperties.h:87
ConsumerOption(std::string key, bool value)
Creates the ConsumerOption instance.
Definition ConsumerProperties.h:73
const std::string & GetKey() const
Gets the key of the consumer configuration entry.
Definition ConsumerProperties.h:81
Holds all Kafka consumer properties that should be passed to the Stream API.
Definition ConsumerProperties.h:100
ConsumerProperties(ConsumerOptions properties)
Creates the ConsumerProperties instance.
Definition ConsumerProperties.h:107
ConsumerProperties(std::initializer_list< ConsumerOption > properties)
Creates the ConsumerProperties instance.
Definition ConsumerProperties.h:115
const ConsumerOptions & GetProperties() const
Gets the ConsumerProperties instance.
Definition ConsumerProperties.h:123
Rules all the other namespaces.
Definition AppleSignInProperties.h:24