TimeRange.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
43 #ifndef TIMERANGE_HPP
44 #define TIMERANGE_HPP
45 
46 #include <map>
47 #include <string>
48 
49 #include "CommonTime.hpp"
50 #include "Exception.hpp"
51 #include "StringUtils.hpp"
52 
53 
54 namespace gnsstk
55 {
57 
58 
59  class TimeRange
60  {
61  public:
62 
63  NEW_EXCEPTION_CLASS(TimeRangeException, Exception);
64 
65  typedef std::pair<CommonTime, CommonTime> DTPair;
66 
67  TimeRange();
68 
72  TimeRange(const CommonTime& startDT,
73  const CommonTime& endDT,
74  const bool startInclusive=true,
75  const bool endInclusive=true);
76 
80  TimeRange(DTPair dtPair,
81  const bool startInclusive=true,
82  const bool endInclusive=true);
83 
85  TimeRange(const TimeRange& tr);
86 
87  ~TimeRange( ) {};
88 
89  // Accessors
90  CommonTime getStart() const { return start; }
91  CommonTime getEnd() const { return end; }
92 
96  void set( const CommonTime& startDT,
97  const CommonTime& endDT,
98  const bool startInclusive=true,
99  const bool endInclusive=true );
100 
105  bool inRange( const CommonTime& testDT ) const;
106 
108  bool operator==(const TimeRange& right) const;
109 
116  bool operator<(const TimeRange& right) const;
117 
120  bool isPriorTo( const TimeRange& right ) const;
121 
124  bool overlaps( const TimeRange& right ) const;
125 
128  bool isSubsetOf( const TimeRange& right ) const;
129 
132  bool isAfter( const TimeRange& right ) const;
133 
144  TimeRange& setToString( const std::string& str,
145  const std::string& fmt);
146 
150  std::string printf(const std::string formatArg="%02m/%02d/%02y %02H:%02M:%02S" ) const;
151 
153  std::string dump(const std::string formatArg="%02m/%02d/%02y %02H:%02M:%02S" ) const;
154 
155  protected:
160 
164  void init(const CommonTime& startDT,
165  const CommonTime& endDT,
166  const bool startInclusive=true,
167  const bool endInclusive=true);
168 
169  };
170 
172 
173 } // end namespace
174 
175 #endif
176 
gnsstk::TimeRange::operator==
bool operator==(const TimeRange &right) const
Equivalence means all members are identical.
Definition: TimeRange.cpp:166
gnsstk::TimeRange::NEW_EXCEPTION_CLASS
NEW_EXCEPTION_CLASS(TimeRangeException, Exception)
StringUtils.hpp
gnsstk::TimeRange::start
CommonTime start
Definition: TimeRange.hpp:156
gnsstk::TimeRange::init
void init(const CommonTime &startDT, const CommonTime &endDT, const bool startInclusive=true, const bool endInclusive=true)
Definition: TimeRange.cpp:93
gnsstk::TimeRange::operator<
bool operator<(const TimeRange &right) const
Definition: TimeRange.cpp:175
gnsstk::TimeRange::overlaps
bool overlaps(const TimeRange &right) const
Definition: TimeRange.cpp:221
gnsstk::TimeRange::printf
std::string printf(const std::string formatArg="%02m/%02d/%02y %02H:%02M:%02S") const
Definition: TimeRange.cpp:376
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::TimeRange::~TimeRange
~TimeRange()
Definition: TimeRange.hpp:87
gnsstk::TimeRange::inRange
bool inRange(const CommonTime &testDT) const
Definition: TimeRange.cpp:146
gnsstk::TimeRange
Definition: TimeRange.hpp:59
gnsstk::Exception
Definition: Exception.hpp:151
gnsstk::TimeRange::isSubsetOf
bool isSubsetOf(const TimeRange &right) const
Definition: TimeRange.cpp:249
gnsstk::TimeRange::includeStartTime
bool includeStartTime
Definition: TimeRange.hpp:158
gnsstk::TimeRange::isAfter
bool isAfter(const TimeRange &right) const
Definition: TimeRange.cpp:258
gnsstk::TimeRange::isPriorTo
bool isPriorTo(const TimeRange &right) const
Definition: TimeRange.cpp:204
gnsstk::TimeRange::includeEndTime
bool includeEndTime
Definition: TimeRange.hpp:159
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::TimeRange::set
void set(const CommonTime &startDT, const CommonTime &endDT, const bool startInclusive=true, const bool endInclusive=true)
Definition: TimeRange.cpp:120
gnsstk::TimeRange::dump
std::string dump(const std::string formatArg="%02m/%02d/%02y %02H:%02M:%02S") const
Dump method.
Definition: TimeRange.cpp:394
gnsstk::TimeRange::TimeRange
TimeRange()
Definition: TimeRange.cpp:50
gnsstk::TimeRange::end
CommonTime end
Definition: TimeRange.hpp:157
Exception.hpp
CommonTime.hpp
gnsstk::TimeRange::DTPair
std::pair< CommonTime, CommonTime > DTPair
Definition: TimeRange.hpp:65
gnsstk::TimeRange::getEnd
CommonTime getEnd() const
Definition: TimeRange.hpp:91
gnsstk::TimeRange::setToString
TimeRange & setToString(const std::string &str, const std::string &fmt)
Definition: TimeRange.cpp:274
gnsstk::TimeRange::getStart
CommonTime getStart() const
Definition: TimeRange.hpp:90


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:42