gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
Range.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef RANGE_H
7 #define RANGE_H
8 
9 // represents a range of values of the template type
10 template <class T> class Range {
11 private:
12  T Low;
13  T High;
14 
15 public:
16  Range() {}
17  Range(const T &low, const T &high) : Low(low), High(high) {}
18  T low() const { return Low; }
19  void low(const T &low) { Low = low; }
20  T high() const { return High; }
21  void high(const T &high) { High = high; }
22  int contains(const T &value) const;
23  int contains(const Range<T> &range) const;
24  int operator==(const Range<T> &range) const;
25 };
26 
27 template <class T> int Range<T>::contains(const T &value) const
28 {
29  return ((value >= Low) && (value <= High));
30 }
31 
32 template <class T> int Range<T>::contains(const Range<T> &range) const
33 {
34  return ((range.low() >= Low) && (range.high() <= High));
35 }
36 
37 template <class T> int Range<T>::operator==(const Range<T> &range) const
38 {
39  return ((range.low() == Low) && (range.high() == High));
40 }
41 
42 #endif
Range::Low
T Low
Definition: Range.h:12
Range::high
T high() const
Definition: Range.h:20
Range::low
void low(const T &low)
Definition: Range.h:19
Range
Definition: Range.h:10
Range::operator==
int operator==(const Range< T > &range) const
Definition: Range.h:37
Range::High
T High
Definition: Range.h:13
Range::Range
Range()
Definition: Range.h:16
Range::low
T low() const
Definition: Range.h:18
Range::high
void high(const T &high)
Definition: Range.h:21
Range::contains
int contains(const T &value) const
Definition: Range.h:27
Range::Range
Range(const T &low, const T &high)
Definition: Range.h:17