YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/build/debugcov-clang-dynamic-arm64-ninja/src/yb/rpc/any.messages.cc
Line
Count
Source (jump to first uncovered line)
1
// THIS FILE IS AUTOGENERATED FROM yb/rpc/any.proto
2
3
#include "yb/rpc/any.messages.h"
4
5
#include "yb/gutil/strings/numbers.h"
6
7
namespace yb {
8
namespace rpc {
9
10
LWAny::LWAny(::yb::Arena* arena)
11
2
    : arena_(*arena) {
12
2
}
13
14
LWAny::LWAny(::yb::Arena* arena, const LWAny& rhs)
15
    : arena_(*arena),
16
      has_fields_(rhs.has_fields_),
17
      type_url_(arena->DupSlice(rhs.type_url_)),
18
0
      value_(arena->DupSlice(rhs.value_)) {
19
0
}
20
21
0
void LWAny::AppendToDebugString(std::string* out) const {
22
0
  bool first = true;if (has_type_url()) {
23
0
    ::yb::rpc::AppendFieldTitle("type_url", ": \"", &first, out);
24
0
    *out += type_url().ToBuffer();
25
0
    *out += '"';
26
0
  }
27
0
  if (has_value()) {
28
0
    ::yb::rpc::AppendFieldTitle("value", ": \"", &first, out);
29
0
    *out += value().ToBuffer();
30
0
    *out += '"';
31
0
  }
32
0
}
33
34
1
void LWAny::Clear() {
35
1
  clear_type_url();
36
1
  clear_value();
37
1
}
38
39
0
void LWAny::CopyFrom(const LWAny& rhs) {
40
0
  if (rhs.has_type_url()) {
41
0
    type_url_ = arena_.DupSlice(rhs.type_url_);
42
0
  } else {
43
0
    clear_type_url();
44
0
  }
45
0
  if (rhs.has_value()) {
46
0
    value_ = arena_.DupSlice(rhs.value_);
47
0
  } else {
48
0
    clear_value();
49
0
  }
50
0
  has_fields_ = rhs.has_fields_;
51
0
}
52
53
0
void LWAny::CopyFrom(const ::google::protobuf::Any& rhs) {
54
0
  {
55
0
    type_url_ = arena_.DupSlice(rhs.type_url());
56
0
    has_fields_.Set(AnyFields::kTypeUrl);
57
0
  }
58
0
  {
59
0
    value_ = arena_.DupSlice(rhs.value());
60
0
    has_fields_.Set(AnyFields::kValue);
61
0
  }
62
0
}
63
64
0
Status LWAny::ParseFromCodedStream(google::protobuf::io::CodedInputStream* input) {
65
0
  for (;;) {
66
0
    auto p = input->ReadTagWithCutoffNoLastTag(31);
67
0
    if (!p.second && !p.first) {
68
0
      return Status::OK();
69
0
    }
70
0
    switch(::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(p.first)) {
71
0
      case 1: { // type_url
72
0
        if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>::Read(input, mutable_type_url())) {
73
0
          return ::yb::rpc::ParseFailed("type_url");
74
0
        }
75
0
        break;
76
0
      }
77
0
      case 2: { // value
78
0
        if (!::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_BYTES, ::yb::Slice>::Read(input, mutable_value())) {
79
0
          return ::yb::rpc::ParseFailed("value");
80
0
        }
81
0
        break;
82
0
      }
83
0
    }
84
0
  }
85
0
}
86
87
0
uint8_t* LWAny::SerializeToArray(uint8_t* out) const {
88
0
  if (has_type_url()) {
89
0
    out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 10>(type_url_, out);
90
0
  }
91
0
  if (has_value()) {
92
0
    out = ::yb::rpc::SingleWrite<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_BYTES, ::yb::Slice>, 18>(value_, out);
93
0
  }
94
0
  return out;
95
0
}
96
97
0
size_t LWAny::SerializedSize() const {
98
0
  size_t result = 0;
99
0
  if (has_type_url()) {
100
0
    result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_STRING, ::yb::Slice>, 1>(type_url_);
101
0
  }
102
0
  if (has_value()) {
103
0
    result += ::yb::rpc::SingleSize<::yb::rpc::LightweightSerialization<::google::protobuf::internal::WireFormatLite::TYPE_BYTES, ::yb::Slice>, 1>(value_);
104
0
  }
105
0
  cached_size_ = result;
106
0
  return result;
107
0
}
108
109
0
void LWAny::ToGoogleProtobuf(::google::protobuf::Any* out) const {
110
0
  if (has_type_url()) {
111
0
    out->set_type_url(type_url_.cdata(), type_url_.size());
112
0
  } else {
113
0
    out->clear_type_url();
114
0
  }
115
0
  if (has_value()) {
116
0
    out->set_value(value_.cdata(), value_.size());
117
0
  } else {
118
0
    out->clear_value();
119
0
  }
120
0
}
121
122
} // namespace rpc
123
} // namespace yb