ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
schedulernotification.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2023 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Matthias Nichting - initial API and implementation
13  ********************************************************************************/
14 
15 #pragma once
16 
17 #include <cstdint>
18 #include <utility>
19 
20 namespace adore_scheduling
21 {
26  {
27  unsigned int m_identifier; // identifier that is used by the scheduler to match messages with ros nodes
28  uint32_t m_upperTimeLimitSec; // seconds
29  uint32_t m_upperTimeLimitNsec; // nanosecons
30 
31  public:
33  SchedulerNotification(unsigned int id, uint32_t upperSec, uint32_t upperNsec) : m_identifier(id), m_upperTimeLimitSec(upperSec), m_upperTimeLimitNsec(upperNsec)
34  {
35  }
36  uint32_t getUpperTimeLimitSec() const
37  {
38  return m_upperTimeLimitSec;
39  }
40  uint32_t getUpperTimeLimitNsec() const
41  {
42  return m_upperTimeLimitNsec;
43  }
44  std::pair<uint32_t, uint32_t> getUpperTimeLimitPair() const
45  {
46  return std::make_pair(m_upperTimeLimitSec, m_upperTimeLimitNsec);
47  }
48  void setUpperTimeLimit(uint32_t sec, uint32_t nsec)
49  {
50  while (nsec >= 1e9)
51  {
52  nsec -= 1e9;
53  sec += 1;
54  }
55  m_upperTimeLimitSec = sec;
56  m_upperTimeLimitNsec = nsec;
57  }
58  void setZero(unsigned int id)
59  {
60  m_identifier = id;
63  }
64  unsigned int getID() const
65  {
66  return m_identifier;
67  }
68  void setID(unsigned int id)
69  {
70  m_identifier = id;
71  }
72  };
73 }
Definition: schedulernotification.h:26
SchedulerNotification()
Definition: schedulernotification.h:32
unsigned int m_identifier
Definition: schedulernotification.h:27
uint32_t m_upperTimeLimitNsec
Definition: schedulernotification.h:29
uint32_t getUpperTimeLimitSec() const
Definition: schedulernotification.h:36
void setUpperTimeLimit(uint32_t sec, uint32_t nsec)
Definition: schedulernotification.h:48
void setID(unsigned int id)
Definition: schedulernotification.h:68
uint32_t m_upperTimeLimitSec
Definition: schedulernotification.h:28
SchedulerNotification(unsigned int id, uint32_t upperSec, uint32_t upperNsec)
Definition: schedulernotification.h:33
std::pair< uint32_t, uint32_t > getUpperTimeLimitPair() const
Definition: schedulernotification.h:44
uint32_t getUpperTimeLimitNsec() const
Definition: schedulernotification.h:40
unsigned int getID() const
Definition: schedulernotification.h:64
void setZero(unsigned int id)
Definition: schedulernotification.h:58
Definition: aschedulernotificationmanager.h:19