Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
key_value_metadata.h
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
18 #ifndef ARROW_UTIL_KEY_VALUE_METADATA_H
19 #define ARROW_UTIL_KEY_VALUE_METADATA_H
20 
21 #include <cstdint>
22 #include <memory>
23 #include <string>
24 #include <unordered_map>
25 #include <vector>
26 
27 #include "arrow/util/macros.h"
28 #include "arrow/util/visibility.h"
29 
30 namespace arrow {
31 
32 class ARROW_EXPORT KeyValueMetadata {
33  public:
35  KeyValueMetadata(const std::vector<std::string>& keys,
36  const std::vector<std::string>& values);
37  explicit KeyValueMetadata(const std::unordered_map<std::string, std::string>& map);
38  virtual ~KeyValueMetadata() = default;
39 
40  void ToUnorderedMap(std::unordered_map<std::string, std::string>* out) const;
41 
42  void Append(const std::string& key, const std::string& value);
43 
44  void reserve(int64_t n);
45  int64_t size() const;
46 
47  std::string key(int64_t i) const;
48  std::string value(int64_t i) const;
49 
50  std::shared_ptr<KeyValueMetadata> Copy() const;
51 
52  bool Equals(const KeyValueMetadata& other) const;
53 
54  private:
55  std::vector<std::string> keys_;
56  std::vector<std::string> values_;
57 
59 };
60 
61 } // namespace arrow
62 
63 #endif // ARROW_UTIL_KEY_VALUE_METADATA_H
Top-level namespace for Apache Arrow C++ API.
Definition: allocator.h:29
Definition: key_value_metadata.h:32
#define ARROW_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:23