scenario_simulator_v2 C++ API
job.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef TRAFFIC_SIMULATOR__JOB__JOB_HPP_
16 #define TRAFFIC_SIMULATOR__JOB__JOB_HPP_
17 
18 #include <functional>
19 #include <memory>
20 
21 namespace traffic_simulator
22 {
23 namespace job
24 {
25 enum class Type {
26  UNKOWN = 0,
27  LINEAR_VELOCITY = 1,
31  OUT_OF_RANGE = 5
32 };
33 
34 enum class Status {
35  ACTIVE = 0,
36  INACTIVE = 1,
37 };
38 
39 enum class Event {
40  PRE_UPDATE = 0,
41  POST_UPDATE = 1,
42 };
43 
44 class Job
45 {
46 public:
55  Job(
56  const std::function<bool(double)> & func_on_update,
57  const std::function<void()> & func_on_cleanup, job::Type type, bool exclusive, Event event);
58  void onUpdate(const double step_time);
59  void inactivate();
60  Status getStatus() const;
61 
62 private:
63  std::function<bool(double)> func_on_update_;
64  std::function<void()> func_on_cleanup_;
65  Status status_;
66  double job_duration_;
67 
68 public:
69  const job::Type type;
70  const bool exclusive;
71  const Event event;
72 };
73 } // namespace job
74 } // namespace traffic_simulator
75 
76 #endif // TRAFFIC_SIMULATOR__JOB__JOB_HPP_
Definition: job.hpp:45
const Event event
Definition: job.hpp:71
Job(const std::function< bool(double)> &func_on_update, const std::function< void()> &func_on_cleanup, job::Type type, bool exclusive, Event event)
Construct a new Job object.
Definition: job.cpp:21
Status getStatus() const
Definition: job.cpp:40
void inactivate()
Definition: job.cpp:34
const job::Type type
Definition: job.hpp:69
void onUpdate(const double step_time)
Definition: job.cpp:42
const bool exclusive
Definition: job.hpp:70
Event
Definition: job.hpp:39
Type
Definition: job.hpp:25
Status
Definition: job.hpp:34
Definition: api.hpp:48