Apollo 10.0
自动驾驶开放平台
play_task_buffer.h
浏览该文件的文档.
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
27namespace apollo {
28namespace cyber {
29namespace 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 void Clear();
47
48 private:
49 TaskMap tasks_;
50 mutable std::mutex mutex_;
51};
52
53} // namespace record
54} // namespace cyber
55} // namespace apollo
56
57#endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_BUFFER_H_
std::multimap< uint64_t, TaskPtr > TaskMap
std::shared_ptr< PlayTask > TaskPtr
class register implement
Definition arena_queue.h:37