Apollo  6.0
Open source self driving car software
frame_manager.h
Go to the documentation of this file.
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 
25 namespace apollo {
26 namespace storytelling {
27 
28 class FrameManager {
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
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::shared_ptr< cyber::Writer< T > > CreateWriter(const std::string &channel)
Definition: frame_manager.h:48
std::shared_ptr< cyber::Reader< T > > CreateOrGetReader(const std::string &channel)
Definition: frame_manager.h:41
apollo::common::monitor::MonitorLogBuffer & LogBuffer()
Definition: frame_manager.h:37
The class of MonitorLogBuffer.
Definition: frame_manager.h:28
This class help collect MonitorMessage pb to monitor topic. The messages can be published automatical...
Definition: monitor_log_buffer.h:60