Apollo  6.0
Open source self driving car software
timer_component.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_COMPONENT_TIMER_COMPONENT_H_
18 #define CYBER_COMPONENT_TIMER_COMPONENT_H_
19 
20 #include <memory>
21 
23 
24 namespace apollo {
25 namespace cyber {
26 
27 class Timer;
28 
35 class TimerComponent : public ComponentBase {
36  public:
38  ~TimerComponent() override;
39 
47  bool Initialize(const TimerComponentConfig& config) override;
48  void Clear() override;
49  bool Process();
50  uint64_t GetInterval() const;
51 
52  private:
58  virtual bool Proc() = 0;
59 
60  uint64_t interval_ = 0;
61  std::unique_ptr<Timer> timer_;
62 };
63 
64 } // namespace cyber
65 } // namespace apollo
66 
67 #endif // CYBER_COMPONENT_TIMER_COMPONENT_H_
uint64_t GetInterval() const
TimerComponent is a timer component. Your component can inherit from Component, and implement Init() ...
Definition: timer_component.h:35
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: component_base.h:41
bool Initialize(const TimerComponentConfig &config) override
init the component by protobuf object.