Apollo  6.0
Open source self driving car software
play_task_buffer.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 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 #ifndef CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_
18 #define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_
19 
20 #include <cstdint>
21 #include <map>
22 #include <memory>
23 #include <mutex>
24 
26 
27 namespace apollo {
28 namespace cyber {
29 namespace record {
30 
32  public:
33  using TaskPtr = std::shared_ptr<PlayTask>;
34  // if all tasks are in order, we can use other container to replace this
35  using TaskMap = std::multimap<uint64_t, TaskPtr>;
36 
38  virtual ~PlayTaskBuffer();
39 
40  size_t Size() const;
41  bool Empty() const;
42 
43  void Push(const TaskPtr& task);
44  TaskPtr Front();
45  void PopFront();
46 
47  private:
48  TaskMap tasks_;
49  mutable std::mutex mutex_;
50 };
51 
52 } // namespace record
53 } // namespace cyber
54 } // namespace apollo
55 
56 #endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::multimap< uint64_t, TaskPtr > TaskMap
Definition: play_task_buffer.h:35
void Push(const TaskPtr &task)
std::shared_ptr< PlayTask > TaskPtr
Definition: play_task_buffer.h:33
Definition: play_task_buffer.h:31