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