Apollo 10.0
自动驾驶开放平台
play_task.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_H_
18#define CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_H_
19
20#include <atomic>
21#include <cstdint>
22#include <memory>
23
25#include "cyber/node/writer.h"
26
27namespace apollo {
28namespace cyber {
29namespace record {
30
31class PlayTask {
32 public:
33 using MessagePtr = std::shared_ptr<message::RawMessage>;
34 using WriterPtr = std::shared_ptr<Writer<message::RawMessage>>;
35
36 PlayTask(const MessagePtr& msg, const WriterPtr& writer,
37 uint64_t msg_real_time_ns, uint64_t msg_play_time_ns);
38 virtual ~PlayTask() {}
39
40 void Play();
41
42 uint64_t msg_real_time_ns() const { return msg_real_time_ns_; }
43 uint64_t msg_play_time_ns() const { return msg_play_time_ns_; }
44 static uint64_t played_msg_num() { return played_msg_num_.load(); }
45
46 private:
47 MessagePtr msg_;
48 WriterPtr writer_;
49 uint64_t msg_real_time_ns_;
50 uint64_t msg_play_time_ns_;
51
52 static std::atomic<uint64_t> played_msg_num_;
53};
54
55} // namespace record
56} // namespace cyber
57} // namespace apollo
58
59#endif // CYBER_TOOLS_CYBER_RECORDER_PLAYER_PLAY_TASK_H_
uint64_t msg_real_time_ns() const
Definition play_task.h:42
std::shared_ptr< Writer< message::RawMessage > > WriterPtr
Definition play_task.h:34
std::shared_ptr< message::RawMessage > MessagePtr
Definition play_task.h:33
uint64_t msg_play_time_ns() const
Definition play_task.h:43
static uint64_t played_msg_num()
Definition play_task.h:44
class register implement
Definition arena_queue.h:37