Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 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 | |
| 17 | /******************************************************************************* |
| 18 | * AUTOGENERATED - DO NOT EDIT |
| 19 | ******************************************************************************* |
| 20 | * This file has been generated from the protobuf message |
Primiano Tucci | 355b8c8 | 2019-08-29 08:37:51 +0200 | [diff] [blame] | 21 | * protos/perfetto/config/test_config.proto |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 22 | * by |
| 23 | * ../../tools/proto_to_cpp/proto_to_cpp.cc. |
| 24 | * If you need to make changes here, change the .proto file and then run |
Hector Dearman | 7e07977 | 2018-11-15 16:08:12 +0000 | [diff] [blame] | 25 | * ./tools/gen_tracing_cpp_headers_from_protos |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 26 | */ |
| 27 | |
Primiano Tucci | 0f9e022 | 2019-06-05 09:36:41 +0100 | [diff] [blame] | 28 | #include "perfetto/tracing/core/test_config.h" |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 29 | |
Primiano Tucci | 355b8c8 | 2019-08-29 08:37:51 +0200 | [diff] [blame] | 30 | #include "protos/perfetto/config/test_config.pb.h" |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 31 | |
| 32 | namespace perfetto { |
| 33 | |
| 34 | TestConfig::TestConfig() = default; |
| 35 | TestConfig::~TestConfig() = default; |
| 36 | TestConfig::TestConfig(const TestConfig&) = default; |
| 37 | TestConfig& TestConfig::operator=(const TestConfig&) = default; |
| 38 | TestConfig::TestConfig(TestConfig&&) noexcept = default; |
| 39 | TestConfig& TestConfig::operator=(TestConfig&&) = default; |
| 40 | |
Oystein Eftevaag | c9deef2 | 2019-03-01 11:44:22 -0800 | [diff] [blame] | 41 | #pragma GCC diagnostic push |
| 42 | #pragma GCC diagnostic ignored "-Wfloat-equal" |
| 43 | bool TestConfig::operator==(const TestConfig& other) const { |
| 44 | return (message_count_ == other.message_count_) && |
| 45 | (max_messages_per_second_ == other.max_messages_per_second_) && |
| 46 | (seed_ == other.seed_) && (message_size_ == other.message_size_) && |
| 47 | (send_batch_on_register_ == other.send_batch_on_register_) && |
| 48 | (dummy_fields_ == other.dummy_fields_); |
| 49 | } |
| 50 | #pragma GCC diagnostic pop |
| 51 | |
Primiano Tucci | 0f2f3b4 | 2019-05-21 19:37:01 +0100 | [diff] [blame] | 52 | void TestConfig::ParseRawProto(const std::string& raw) { |
| 53 | perfetto::protos::TestConfig proto; |
| 54 | proto.ParseFromString(raw); |
| 55 | FromProto(proto); |
| 56 | } |
| 57 | |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 58 | void TestConfig::FromProto(const perfetto::protos::TestConfig& proto) { |
| 59 | static_assert(sizeof(message_count_) == sizeof(proto.message_count()), |
| 60 | "size mismatch"); |
| 61 | message_count_ = static_cast<decltype(message_count_)>(proto.message_count()); |
| 62 | |
Lalit Maganti | 131b6e5 | 2018-03-29 18:29:31 +0100 | [diff] [blame] | 63 | static_assert(sizeof(max_messages_per_second_) == |
| 64 | sizeof(proto.max_messages_per_second()), |
| 65 | "size mismatch"); |
| 66 | max_messages_per_second_ = static_cast<decltype(max_messages_per_second_)>( |
| 67 | proto.max_messages_per_second()); |
| 68 | |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 69 | static_assert(sizeof(seed_) == sizeof(proto.seed()), "size mismatch"); |
| 70 | seed_ = static_cast<decltype(seed_)>(proto.seed()); |
Lalit Maganti | 8390e5b | 2018-03-23 10:46:05 +0000 | [diff] [blame] | 71 | |
| 72 | static_assert(sizeof(message_size_) == sizeof(proto.message_size()), |
| 73 | "size mismatch"); |
| 74 | message_size_ = static_cast<decltype(message_size_)>(proto.message_size()); |
Lalit Maganti | 36557d8 | 2018-04-11 14:36:17 +0100 | [diff] [blame] | 75 | |
| 76 | static_assert( |
| 77 | sizeof(send_batch_on_register_) == sizeof(proto.send_batch_on_register()), |
| 78 | "size mismatch"); |
| 79 | send_batch_on_register_ = static_cast<decltype(send_batch_on_register_)>( |
| 80 | proto.send_batch_on_register()); |
Florian Mayer | 790d085 | 2018-11-13 16:33:26 +0000 | [diff] [blame] | 81 | |
Primiano Tucci | 3b39fc7 | 2019-06-22 19:05:23 +0100 | [diff] [blame] | 82 | dummy_fields_->FromProto(proto.dummy_fields()); |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 83 | unknown_fields_ = proto.unknown_fields(); |
| 84 | } |
| 85 | |
| 86 | void TestConfig::ToProto(perfetto::protos::TestConfig* proto) const { |
| 87 | proto->Clear(); |
| 88 | |
| 89 | static_assert(sizeof(message_count_) == sizeof(proto->message_count()), |
| 90 | "size mismatch"); |
| 91 | proto->set_message_count( |
| 92 | static_cast<decltype(proto->message_count())>(message_count_)); |
| 93 | |
Lalit Maganti | 131b6e5 | 2018-03-29 18:29:31 +0100 | [diff] [blame] | 94 | static_assert(sizeof(max_messages_per_second_) == |
| 95 | sizeof(proto->max_messages_per_second()), |
| 96 | "size mismatch"); |
| 97 | proto->set_max_messages_per_second( |
| 98 | static_cast<decltype(proto->max_messages_per_second())>( |
| 99 | max_messages_per_second_)); |
| 100 | |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 101 | static_assert(sizeof(seed_) == sizeof(proto->seed()), "size mismatch"); |
| 102 | proto->set_seed(static_cast<decltype(proto->seed())>(seed_)); |
Lalit Maganti | 8390e5b | 2018-03-23 10:46:05 +0000 | [diff] [blame] | 103 | |
| 104 | static_assert(sizeof(message_size_) == sizeof(proto->message_size()), |
| 105 | "size mismatch"); |
| 106 | proto->set_message_size( |
| 107 | static_cast<decltype(proto->message_size())>(message_size_)); |
Lalit Maganti | 36557d8 | 2018-04-11 14:36:17 +0100 | [diff] [blame] | 108 | |
| 109 | static_assert(sizeof(send_batch_on_register_) == |
| 110 | sizeof(proto->send_batch_on_register()), |
| 111 | "size mismatch"); |
| 112 | proto->set_send_batch_on_register( |
| 113 | static_cast<decltype(proto->send_batch_on_register())>( |
| 114 | send_batch_on_register_)); |
Florian Mayer | 790d085 | 2018-11-13 16:33:26 +0000 | [diff] [blame] | 115 | |
Primiano Tucci | 3b39fc7 | 2019-06-22 19:05:23 +0100 | [diff] [blame] | 116 | dummy_fields_->ToProto(proto->mutable_dummy_fields()); |
Florian Mayer | 790d085 | 2018-11-13 16:33:26 +0000 | [diff] [blame] | 117 | *(proto->mutable_unknown_fields()) = unknown_fields_; |
| 118 | } |
| 119 | |
| 120 | TestConfig::DummyFields::DummyFields() = default; |
| 121 | TestConfig::DummyFields::~DummyFields() = default; |
| 122 | TestConfig::DummyFields::DummyFields(const TestConfig::DummyFields&) = default; |
| 123 | TestConfig::DummyFields& TestConfig::DummyFields::operator=( |
| 124 | const TestConfig::DummyFields&) = default; |
| 125 | TestConfig::DummyFields::DummyFields(TestConfig::DummyFields&&) noexcept = |
| 126 | default; |
| 127 | TestConfig::DummyFields& TestConfig::DummyFields::operator=( |
| 128 | TestConfig::DummyFields&&) = default; |
| 129 | |
Oystein Eftevaag | c9deef2 | 2019-03-01 11:44:22 -0800 | [diff] [blame] | 130 | #pragma GCC diagnostic push |
| 131 | #pragma GCC diagnostic ignored "-Wfloat-equal" |
| 132 | bool TestConfig::DummyFields::operator==( |
| 133 | const TestConfig::DummyFields& other) const { |
| 134 | return (field_uint32_ == other.field_uint32_) && |
| 135 | (field_int32_ == other.field_int32_) && |
| 136 | (field_uint64_ == other.field_uint64_) && |
| 137 | (field_int64_ == other.field_int64_) && |
| 138 | (field_fixed64_ == other.field_fixed64_) && |
| 139 | (field_sfixed64_ == other.field_sfixed64_) && |
| 140 | (field_fixed32_ == other.field_fixed32_) && |
| 141 | (field_sfixed32_ == other.field_sfixed32_) && |
| 142 | (field_double_ == other.field_double_) && |
| 143 | (field_float_ == other.field_float_) && |
| 144 | (field_sint64_ == other.field_sint64_) && |
| 145 | (field_sint32_ == other.field_sint32_) && |
| 146 | (field_string_ == other.field_string_) && |
| 147 | (field_bytes_ == other.field_bytes_); |
| 148 | } |
| 149 | #pragma GCC diagnostic pop |
| 150 | |
Primiano Tucci | 0f2f3b4 | 2019-05-21 19:37:01 +0100 | [diff] [blame] | 151 | void TestConfig::DummyFields::ParseRawProto(const std::string& raw) { |
| 152 | perfetto::protos::TestConfig_DummyFields proto; |
| 153 | proto.ParseFromString(raw); |
| 154 | FromProto(proto); |
| 155 | } |
| 156 | |
Florian Mayer | 790d085 | 2018-11-13 16:33:26 +0000 | [diff] [blame] | 157 | void TestConfig::DummyFields::FromProto( |
| 158 | const perfetto::protos::TestConfig_DummyFields& proto) { |
| 159 | static_assert(sizeof(field_uint32_) == sizeof(proto.field_uint32()), |
| 160 | "size mismatch"); |
| 161 | field_uint32_ = static_cast<decltype(field_uint32_)>(proto.field_uint32()); |
| 162 | |
| 163 | static_assert(sizeof(field_int32_) == sizeof(proto.field_int32()), |
| 164 | "size mismatch"); |
| 165 | field_int32_ = static_cast<decltype(field_int32_)>(proto.field_int32()); |
| 166 | |
| 167 | static_assert(sizeof(field_uint64_) == sizeof(proto.field_uint64()), |
| 168 | "size mismatch"); |
| 169 | field_uint64_ = static_cast<decltype(field_uint64_)>(proto.field_uint64()); |
| 170 | |
| 171 | static_assert(sizeof(field_int64_) == sizeof(proto.field_int64()), |
| 172 | "size mismatch"); |
| 173 | field_int64_ = static_cast<decltype(field_int64_)>(proto.field_int64()); |
| 174 | |
| 175 | static_assert(sizeof(field_fixed64_) == sizeof(proto.field_fixed64()), |
| 176 | "size mismatch"); |
| 177 | field_fixed64_ = static_cast<decltype(field_fixed64_)>(proto.field_fixed64()); |
| 178 | |
| 179 | static_assert(sizeof(field_sfixed64_) == sizeof(proto.field_sfixed64()), |
| 180 | "size mismatch"); |
| 181 | field_sfixed64_ = |
| 182 | static_cast<decltype(field_sfixed64_)>(proto.field_sfixed64()); |
| 183 | |
| 184 | static_assert(sizeof(field_fixed32_) == sizeof(proto.field_fixed32()), |
| 185 | "size mismatch"); |
| 186 | field_fixed32_ = static_cast<decltype(field_fixed32_)>(proto.field_fixed32()); |
| 187 | |
| 188 | static_assert(sizeof(field_sfixed32_) == sizeof(proto.field_sfixed32()), |
| 189 | "size mismatch"); |
| 190 | field_sfixed32_ = |
| 191 | static_cast<decltype(field_sfixed32_)>(proto.field_sfixed32()); |
| 192 | |
| 193 | static_assert(sizeof(field_double_) == sizeof(proto.field_double()), |
| 194 | "size mismatch"); |
| 195 | field_double_ = static_cast<decltype(field_double_)>(proto.field_double()); |
| 196 | |
| 197 | static_assert(sizeof(field_float_) == sizeof(proto.field_float()), |
| 198 | "size mismatch"); |
| 199 | field_float_ = static_cast<decltype(field_float_)>(proto.field_float()); |
| 200 | |
| 201 | static_assert(sizeof(field_sint64_) == sizeof(proto.field_sint64()), |
| 202 | "size mismatch"); |
| 203 | field_sint64_ = static_cast<decltype(field_sint64_)>(proto.field_sint64()); |
| 204 | |
| 205 | static_assert(sizeof(field_sint32_) == sizeof(proto.field_sint32()), |
| 206 | "size mismatch"); |
| 207 | field_sint32_ = static_cast<decltype(field_sint32_)>(proto.field_sint32()); |
| 208 | |
| 209 | static_assert(sizeof(field_string_) == sizeof(proto.field_string()), |
| 210 | "size mismatch"); |
| 211 | field_string_ = static_cast<decltype(field_string_)>(proto.field_string()); |
| 212 | |
| 213 | static_assert(sizeof(field_bytes_) == sizeof(proto.field_bytes()), |
| 214 | "size mismatch"); |
| 215 | field_bytes_ = static_cast<decltype(field_bytes_)>(proto.field_bytes()); |
| 216 | unknown_fields_ = proto.unknown_fields(); |
| 217 | } |
| 218 | |
| 219 | void TestConfig::DummyFields::ToProto( |
| 220 | perfetto::protos::TestConfig_DummyFields* proto) const { |
| 221 | proto->Clear(); |
| 222 | |
| 223 | static_assert(sizeof(field_uint32_) == sizeof(proto->field_uint32()), |
| 224 | "size mismatch"); |
| 225 | proto->set_field_uint32( |
| 226 | static_cast<decltype(proto->field_uint32())>(field_uint32_)); |
| 227 | |
| 228 | static_assert(sizeof(field_int32_) == sizeof(proto->field_int32()), |
| 229 | "size mismatch"); |
| 230 | proto->set_field_int32( |
| 231 | static_cast<decltype(proto->field_int32())>(field_int32_)); |
| 232 | |
| 233 | static_assert(sizeof(field_uint64_) == sizeof(proto->field_uint64()), |
| 234 | "size mismatch"); |
| 235 | proto->set_field_uint64( |
| 236 | static_cast<decltype(proto->field_uint64())>(field_uint64_)); |
| 237 | |
| 238 | static_assert(sizeof(field_int64_) == sizeof(proto->field_int64()), |
| 239 | "size mismatch"); |
| 240 | proto->set_field_int64( |
| 241 | static_cast<decltype(proto->field_int64())>(field_int64_)); |
| 242 | |
| 243 | static_assert(sizeof(field_fixed64_) == sizeof(proto->field_fixed64()), |
| 244 | "size mismatch"); |
| 245 | proto->set_field_fixed64( |
| 246 | static_cast<decltype(proto->field_fixed64())>(field_fixed64_)); |
| 247 | |
| 248 | static_assert(sizeof(field_sfixed64_) == sizeof(proto->field_sfixed64()), |
| 249 | "size mismatch"); |
| 250 | proto->set_field_sfixed64( |
| 251 | static_cast<decltype(proto->field_sfixed64())>(field_sfixed64_)); |
| 252 | |
| 253 | static_assert(sizeof(field_fixed32_) == sizeof(proto->field_fixed32()), |
| 254 | "size mismatch"); |
| 255 | proto->set_field_fixed32( |
| 256 | static_cast<decltype(proto->field_fixed32())>(field_fixed32_)); |
| 257 | |
| 258 | static_assert(sizeof(field_sfixed32_) == sizeof(proto->field_sfixed32()), |
| 259 | "size mismatch"); |
| 260 | proto->set_field_sfixed32( |
| 261 | static_cast<decltype(proto->field_sfixed32())>(field_sfixed32_)); |
| 262 | |
| 263 | static_assert(sizeof(field_double_) == sizeof(proto->field_double()), |
| 264 | "size mismatch"); |
| 265 | proto->set_field_double( |
| 266 | static_cast<decltype(proto->field_double())>(field_double_)); |
| 267 | |
| 268 | static_assert(sizeof(field_float_) == sizeof(proto->field_float()), |
| 269 | "size mismatch"); |
| 270 | proto->set_field_float( |
| 271 | static_cast<decltype(proto->field_float())>(field_float_)); |
| 272 | |
| 273 | static_assert(sizeof(field_sint64_) == sizeof(proto->field_sint64()), |
| 274 | "size mismatch"); |
| 275 | proto->set_field_sint64( |
| 276 | static_cast<decltype(proto->field_sint64())>(field_sint64_)); |
| 277 | |
| 278 | static_assert(sizeof(field_sint32_) == sizeof(proto->field_sint32()), |
| 279 | "size mismatch"); |
| 280 | proto->set_field_sint32( |
| 281 | static_cast<decltype(proto->field_sint32())>(field_sint32_)); |
| 282 | |
| 283 | static_assert(sizeof(field_string_) == sizeof(proto->field_string()), |
| 284 | "size mismatch"); |
| 285 | proto->set_field_string( |
| 286 | static_cast<decltype(proto->field_string())>(field_string_)); |
| 287 | |
| 288 | static_assert(sizeof(field_bytes_) == sizeof(proto->field_bytes()), |
| 289 | "size mismatch"); |
| 290 | proto->set_field_bytes( |
| 291 | static_cast<decltype(proto->field_bytes())>(field_bytes_)); |
Lalit Maganti | 3f5705c | 2018-03-09 12:09:44 +0000 | [diff] [blame] | 292 | *(proto->mutable_unknown_fields()) = unknown_fields_; |
| 293 | } |
| 294 | |
| 295 | } // namespace perfetto |