Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include <assert.h>
#include <string>
#include <tuple>
#include <vector>
 
#include "core/common/common.h"
#include "core/common/status.h"
 
namespace onnxruntime {
namespace common {
template <class... Types>
class Record {
 public:
  typedef std::tuple<Types...> Values;
 
  Record() = default;
 
  Record(const std::vector<std::string>& names, const Values& values) {
    ORT_ENFORCE(std::tuple_size<Values>::value == names.size(),
                "Parameter sizes do not match. %d != %d", std::tuple_size<Values>::value, names.size());
    names_ = names;
    values_ = values;
  }
 
  Record(const Record<Types...>& other) {
    names_ = other.names_;
    values_ = other.values_;
  }
 
  Status GetName(size_t index, const std::string** pp_name) const {
    if (nullptr == pp_name || index >= names_.size()) {
      return Status(ONNXRUNTIME, common::INVALID_ARGUMENT);
    }
 
    *pp_name = &(names_[index]);
    return Status::OK();
  }
 
  const Values& GetValues() const {
    return values_;
  }
 
 private:
  std::vector<std::string> names_;
 
  Values values_;
};
}  // namespace common
}  // namespace onnxruntime