Apollo 11.0
自动驾驶开放平台
frame_manager.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 The Apollo Authors. All Rights Reserved.
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#pragma once
18
19#include <memory>
20#include <string>
21
22#include "cyber/common/macros.h"
24
25namespace apollo {
26namespace storytelling {
27
29 public:
30 FrameManager() = delete;
31 explicit FrameManager(const std::shared_ptr<cyber::Node>& node);
32
33 void StartFrame();
34 void EndFrame();
35
36 // Getters.
38
39 // Cyber reader / writer creator.
40 template <class T>
41 std::shared_ptr<cyber::Reader<T>> CreateOrGetReader(
42 const std::string& channel) {
43 auto reader = node_->GetReader<T>(channel);
44 return reader != nullptr ? reader : node_->CreateReader<T>(channel);
45 }
46
47 template <class T>
48 std::shared_ptr<cyber::Writer<T>> CreateWriter(const std::string& channel) {
49 return node_->CreateWriter<T>(channel);
50 }
51
52 private:
54 std::shared_ptr<cyber::Node> node_;
55};
56
57} // namespace storytelling
58} // namespace apollo
apollo::common::monitor::MonitorLogBuffer & LogBuffer()
std::shared_ptr< cyber::Writer< T > > CreateWriter(const std::string &channel)
std::shared_ptr< cyber::Reader< T > > CreateOrGetReader(const std::string &channel)
The class of MonitorLogBuffer
class register implement
Definition arena_queue.h:37