WSF
WsfCoverageAccessInterval.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2020 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFCOVERAGEACCESSINTERVAL_HPP
13#define WSFCOVERAGEACCESSINTERVAL_HPP
14
15#include "wsf_coverage_export.h"
16
17namespace wsf
18{
19namespace coverage
20{
21
27class WSF_COVERAGE_EXPORT AccessInterval
28{
29public:
30 AccessInterval() = default;
31
32 AccessInterval(double aStart, double aEnd)
33 : mStart{aStart}
34 , mEnd{aEnd}
35 {
36 }
37
38 AccessInterval(const AccessInterval& aOther) = default;
39
40 AccessInterval& operator=(const AccessInterval& aOther) = default;
41
43 double GetStart() const { return mStart; }
44
46 double GetEnd() const { return mEnd; }
47
49 double GetDuration() const { return mEnd - mStart; }
50
52 bool IsValid() const { return mEnd >= mStart; }
53
55 bool HasStart() const { return mStart >= 0.0; }
56
58 bool HasEnd() const { return mEnd >= 0.0; }
59
61 void SetStart(double aSimTime) { mStart = aSimTime; }
62
64 void SetEnd(double aSimTime) { mEnd = aSimTime; }
65
69 bool operator==(const AccessInterval& aOther) const;
70
72 bool operator!=(const AccessInterval& aOther) const { return !(*this == aOther); }
73
75 bool HasOverlapWith(const AccessInterval& aOther) const;
76
81 AccessInterval UnionWith(const AccessInterval& aOther) const;
82
87 AccessInterval IntersectionWith(const AccessInterval& aOther) const;
88
90 bool Contains(double aSimTime) const;
91
92private:
93 double mStart{-1.0};
94 double mEnd{-2.0};
95};
96
97} // namespace coverage
98} // namespace wsf
99
100#endif // WSFCOVERAGEACCESSINTERVAL_HPP
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
bool Contains(std::vector< int > &aQueryTargetIds, const WsfTrack &aShooterTrack)
Definition WsfWeaponThreatProcessor.cpp:1462
Definition WsfCoverageAccessInterval.hpp:28
double GetDuration() const
Get the duration of the interval.
Definition WsfCoverageAccessInterval.hpp:49
AccessInterval & operator=(const AccessInterval &aOther)=default
bool HasStart() const
Returns true if this interval has a non-negative start time.
Definition WsfCoverageAccessInterval.hpp:55
bool operator!=(const AccessInterval &aOther) const
Negated equality operator.
Definition WsfCoverageAccessInterval.hpp:72
double GetEnd() const
Return the end time of the interval.
Definition WsfCoverageAccessInterval.hpp:46
double GetStart() const
Return the start time of the interval.
Definition WsfCoverageAccessInterval.hpp:43
void SetStart(double aSimTime)
Set the start time to the given aSimTime.
Definition WsfCoverageAccessInterval.hpp:61
AccessInterval(const AccessInterval &aOther)=default
void SetEnd(double aSimTime)
Set the end time to the given aSimTime.
Definition WsfCoverageAccessInterval.hpp:64
bool IsValid() const
Returns true if this interval have a non-negative duration.
Definition WsfCoverageAccessInterval.hpp:52
AccessInterval(double aStart, double aEnd)
Definition WsfCoverageAccessInterval.hpp:32
bool HasEnd() const
Returns true if this interval has a non-negative end time.
Definition WsfCoverageAccessInterval.hpp:58
Definition WsfCoverage.cpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved