irafhy
Interval arithmetic based Reachability Analysis Framework for Hybrid Automaton
metaStructure.h
Go to the documentation of this file.
1 #ifndef UTILITY_DEFINITION_META_STRUCTURE_H
2 #define UTILITY_DEFINITION_META_STRUCTURE_H
3 
4 #include <cassert>
5 #include <iostream>
6 //TODO
7 #include <fmt/format.h>
8 
9 namespace irafhy
10 {
14  struct Time
15  {
19  double start_ = 0.0;
23  double end_ = 0.0;
27  Time()
28  : start_(0.0)
29  , end_(0.0){};
34  Time(const Time& time) = default;
39  Time(Time&& time) noexcept = default;
45  Time(const double& start, const double& end)
46  {
47  assert(start <= end);
48  start_ = start;
49  end_ = end;
50  };
55  [[nodiscard]] double start() const { return start_; };
60  [[nodiscard]] double end() const { return end_; };
65  [[nodiscard]] double range() const { return end_ - start_; };
71  inline bool operator<(const Time& rhs) const
72  {
73  if (start_ != rhs.start())
74  return start_ < rhs.start();
75  return end_ < rhs.end();
76  }
82  inline Time& operator=(const Time& time) = default;
88  inline Time& operator=(Time&& time) noexcept = default;
92  ~Time() = default;
99  friend std::ostream& operator<<(std::ostream& out, const Time& time)
100  {
101  out << "[" << time.start_ << ", " << time.end_ << "]";
102  return out;
103  }
104  };
105 } // namespace irafhy
106 #endif //UTILITY_DEFINITION_META_STRUCTURE_H
Time()
constructor
Definition: metaStructure.h:27
struct used to hold the duration information
Definition: metaStructure.h:14
double range() const
get the range of the interval specified by duration
Definition: metaStructure.h:65
Time & operator=(const Time &time)=default
assignment operator
double end_
end of the duration
Definition: metaStructure.h:23
Time(const double &start, const double &end)
constructor with given start and end of the duration
Definition: metaStructure.h:45
Definition: condition.cpp:3
double start() const
get the start of the duration
Definition: metaStructure.h:55
double end() const
get the end of the duration
Definition: metaStructure.h:60
friend std::ostream & operator<<(std::ostream &out, const Time &time)
out the given right hand side duration to standard out stream
Definition: metaStructure.h:99
bool operator<(const Time &rhs) const
relational operator
Definition: metaStructure.h:71
~Time()=default
destructor
double start_
start of the duration
Definition: metaStructure.h:19