Home | History | Annotate | Download | only in core
      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/data_source_descriptor.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
     25  * ./tools/gen_tracing_cpp_headers_from_protos
     26  */
     27 
     28 #include "perfetto/tracing/core/data_source_descriptor.h"
     29 
     30 #include "perfetto/config/data_source_descriptor.pb.h"
     31 
     32 namespace perfetto {
     33 
     34 DataSourceDescriptor::DataSourceDescriptor() = default;
     35 DataSourceDescriptor::~DataSourceDescriptor() = default;
     36 DataSourceDescriptor::DataSourceDescriptor(const DataSourceDescriptor&) =
     37     default;
     38 DataSourceDescriptor& DataSourceDescriptor::operator=(
     39     const DataSourceDescriptor&) = default;
     40 DataSourceDescriptor::DataSourceDescriptor(DataSourceDescriptor&&) noexcept =
     41     default;
     42 DataSourceDescriptor& DataSourceDescriptor::operator=(DataSourceDescriptor&&) =
     43     default;
     44 
     45 #pragma GCC diagnostic push
     46 #pragma GCC diagnostic ignored "-Wfloat-equal"
     47 bool DataSourceDescriptor::operator==(const DataSourceDescriptor& other) const {
     48   return (name_ == other.name_) &&
     49          (will_notify_on_stop_ == other.will_notify_on_stop_) &&
     50          (will_notify_on_start_ == other.will_notify_on_start_) &&
     51          (handles_incremental_state_clear_ ==
     52           other.handles_incremental_state_clear_);
     53 }
     54 #pragma GCC diagnostic pop
     55 
     56 void DataSourceDescriptor::FromProto(
     57     const perfetto::protos::DataSourceDescriptor& proto) {
     58   static_assert(sizeof(name_) == sizeof(proto.name()), "size mismatch");
     59   name_ = static_cast<decltype(name_)>(proto.name());
     60 
     61   static_assert(
     62       sizeof(will_notify_on_stop_) == sizeof(proto.will_notify_on_stop()),
     63       "size mismatch");
     64   will_notify_on_stop_ =
     65       static_cast<decltype(will_notify_on_stop_)>(proto.will_notify_on_stop());
     66 
     67   static_assert(
     68       sizeof(will_notify_on_start_) == sizeof(proto.will_notify_on_start()),
     69       "size mismatch");
     70   will_notify_on_start_ = static_cast<decltype(will_notify_on_start_)>(
     71       proto.will_notify_on_start());
     72 
     73   static_assert(sizeof(handles_incremental_state_clear_) ==
     74                     sizeof(proto.handles_incremental_state_clear()),
     75                 "size mismatch");
     76   handles_incremental_state_clear_ =
     77       static_cast<decltype(handles_incremental_state_clear_)>(
     78           proto.handles_incremental_state_clear());
     79   unknown_fields_ = proto.unknown_fields();
     80 }
     81 
     82 void DataSourceDescriptor::ToProto(
     83     perfetto::protos::DataSourceDescriptor* proto) const {
     84   proto->Clear();
     85 
     86   static_assert(sizeof(name_) == sizeof(proto->name()), "size mismatch");
     87   proto->set_name(static_cast<decltype(proto->name())>(name_));
     88 
     89   static_assert(
     90       sizeof(will_notify_on_stop_) == sizeof(proto->will_notify_on_stop()),
     91       "size mismatch");
     92   proto->set_will_notify_on_stop(
     93       static_cast<decltype(proto->will_notify_on_stop())>(
     94           will_notify_on_stop_));
     95 
     96   static_assert(
     97       sizeof(will_notify_on_start_) == sizeof(proto->will_notify_on_start()),
     98       "size mismatch");
     99   proto->set_will_notify_on_start(
    100       static_cast<decltype(proto->will_notify_on_start())>(
    101           will_notify_on_start_));
    102 
    103   static_assert(sizeof(handles_incremental_state_clear_) ==
    104                     sizeof(proto->handles_incremental_state_clear()),
    105                 "size mismatch");
    106   proto->set_handles_incremental_state_clear(
    107       static_cast<decltype(proto->handles_incremental_state_clear())>(
    108           handles_incremental_state_clear_));
    109   *(proto->mutable_unknown_fields()) = unknown_fields_;
    110 }
    111 
    112 }  // namespace perfetto
    113