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 #ifndef INCLUDE_PERFETTO_EXT_TRACING_CORE_TRACE_WRITER_H_ 18 #define INCLUDE_PERFETTO_EXT_TRACING_CORE_TRACE_WRITER_H_ 19 20 #include <functional> 21 22 #include "perfetto/base/export.h" 23 #include "perfetto/ext/tracing/core/basic_types.h" 24 #include "perfetto/protozero/message_handle.h" 25 #include "perfetto/tracing/trace_writer_base.h" 26 27 namespace perfetto { 28 29 namespace protos { 30 namespace pbzero { 31 class TracePacket; 32 } // namespace pbzero 33 } // namespace protos 34 35 // See comments in include/perfetto/tracing/trace_writer_base.h 36 class PERFETTO_EXPORT_COMPONENT TraceWriter : public TraceWriterBase { 37 public: 38 using TracePacketHandle = 39 protozero::MessageHandle<protos::pbzero::TracePacket>; 40 41 TraceWriter(); 42 ~TraceWriter() override; 43 44 virtual WriterID writer_id() const = 0; 45 46 private: 47 TraceWriter(const TraceWriter&) = delete; 48 TraceWriter& operator=(const TraceWriter&) = delete; 49 }; 50 51 } // namespace perfetto 52 53 #endif // INCLUDE_PERFETTO_EXT_TRACING_CORE_TRACE_WRITER_H_ 54