WSF
WsfCoverageAsset.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 WSFCOVERAGEASSET_HPP
13#define WSFCOVERAGEASSET_HPP
14
15#include <string>
16
18
19namespace wsf
20{
21namespace coverage
22{
23
24constexpr const char* cNULL_COVERAGE_DEVICE_NAME{"none"};
25constexpr const char* cUNIVERSAL_NON_ASSET_CATEGORY{"wsf_coverage_univeral_non_asset_category"};
26constexpr const char* cUNIVERSAL_GRID_ASSET_CATEGORY{"wsf_coverage_universal_grid_asset_categroy"};
27constexpr const char* cUNIVERSAL_FREE_ASSET_CATEGORY{"wsf_coverage_universal_free_asset_category"};
28
37{
38public:
39 GridAsset(const std::string& aPlatformName, PointId aPointId, const std::string& aDeviceName)
40 : mPlatformName{aPlatformName}
41 , mPointId{aPointId}
42 , mDeviceName{aDeviceName}
43 {
44 }
45
47 PointId GetPointId() const { return mPointId; }
48
50 const std::string& GetDeviceName() const { return mDeviceName; }
51
53 std::string GetPlatformName() const { return mPlatformName; }
54
56 bool IsValid() const { return mPointId != cINVALID_POINT_ID; }
57
59 void SetPlatformName(const std::string& aPlatformName) { mPlatformName = aPlatformName; }
60
62 void SetPointId(PointId aPointId) { mPointId = aPointId; }
63
65 void SetDeviceName(const std::string& aDeviceName) { mDeviceName = aDeviceName; }
66
67private:
68 std::string mPlatformName;
69 PointId mPointId;
70 std::string mDeviceName;
71};
72
81{
82public:
83 FreeAsset(const std::string& aPlatformName, const std::string& aDeviceName)
84 : mPlatform{aPlatformName}
85 , mDevice{aDeviceName}
86 {
87 }
88
90 const std::string& GetPlatformName() const { return mPlatform; }
91
93 const std::string& GetDeviceName() const { return mDevice; }
94
96 void SetPlatformName(const std::string& aPlatformName) { mPlatform = aPlatformName; }
97
99 void SetDeviceName(const std::string& aDeviceName) { mDevice = aDeviceName; }
100
101private:
102 std::string mPlatform;
103 std::string mDevice;
104};
105
106} // namespace coverage
107} // namespace wsf
108
109namespace std
110{
111
112// This specialization allows GridAsset to be used as a key in std::map and similar containers.
113template<>
114struct less<wsf::coverage::GridAsset>
115{
117 {
118 return (aLHS.GetPlatformName() < aRHS.GetPlatformName()) ||
119 (aLHS.GetPlatformName() == aRHS.GetPlatformName() && aLHS.GetDeviceName() < aRHS.GetDeviceName()) ||
120 (aLHS.GetPlatformName() == aRHS.GetPlatformName() && aLHS.GetDeviceName() == aRHS.GetDeviceName() &&
121 aLHS.GetPointId() < aRHS.GetPointId());
122 }
123};
124
125// This specialization allows FreeAsset to be used as a key in std::map and similar containers.
126template<>
127struct less<wsf::coverage::FreeAsset>
128{
130 {
131 return (aLHS.GetPlatformName() < aRHS.GetPlatformName() ||
132 (aLHS.GetPlatformName() == aRHS.GetPlatformName() && aLHS.GetDeviceName() < aRHS.GetDeviceName()));
133 }
134};
135
136} // namespace std
137
138#endif // WSFCOVERAGEASSET_HPP
Definition WsfCoverageAsset.hpp:81
const std::string & GetPlatformName() const
Get the name of the platform to which this free asset refers.
Definition WsfCoverageAsset.hpp:90
void SetPlatformName(const std::string &aPlatformName)
Set the name of the platform to which this free asset refers.
Definition WsfCoverageAsset.hpp:96
const std::string & GetDeviceName() const
Get the name of the device to which this free asset refers.
Definition WsfCoverageAsset.hpp:93
FreeAsset(const std::string &aPlatformName, const std::string &aDeviceName)
Definition WsfCoverageAsset.hpp:83
void SetDeviceName(const std::string &aDeviceName)
Set the name of the device to which this free asset refers.
Definition WsfCoverageAsset.hpp:99
Definition WsfCoverageAsset.hpp:37
void SetDeviceName(const std::string &aDeviceName)
Set the name of the device to which this grid asset refers.
Definition WsfCoverageAsset.hpp:65
PointId GetPointId() const
Get the ID of the point in the grid to which this grid asset refers.
Definition WsfCoverageAsset.hpp:47
std::string GetPlatformName() const
Return the platform name corresponding to this grid asset.
Definition WsfCoverageAsset.hpp:53
const std::string & GetDeviceName() const
Get the name of the device to which this grid asset refers.
Definition WsfCoverageAsset.hpp:50
void SetPlatformName(const std::string &aPlatformName)
Set the name of the coverage object to which this grid asset refers.
Definition WsfCoverageAsset.hpp:59
bool IsValid() const
Return if this grid asset refers to a valid grid point.
Definition WsfCoverageAsset.hpp:56
void SetPointId(PointId aPointId)
Set the ID of the point in the grid to which this grid asset refers.
Definition WsfCoverageAsset.hpp:62
GridAsset(const std::string &aPlatformName, PointId aPointId, const std::string &aDeviceName)
Definition WsfCoverageAsset.hpp:39
Template specialization for wsf::comm::Address. Allows usage of Address in std::unordered_map/set.
Definition WsfCommAddress.hpp:185
Definition WsfCoverage.cpp:35
std::uint64_t PointId
Definition WsfCoverageGridPoint.hpp:33
constexpr const char * cUNIVERSAL_NON_ASSET_CATEGORY
Definition WsfCoverageAsset.hpp:25
constexpr const char * cUNIVERSAL_GRID_ASSET_CATEGORY
Definition WsfCoverageAsset.hpp:26
constexpr PointId cINVALID_POINT_ID
Zero is used everywhere to indicate an invalid point Id.
Definition WsfCoverageGridPoint.hpp:36
constexpr const char * cNULL_COVERAGE_DEVICE_NAME
Definition WsfCoverageAsset.hpp:24
constexpr const char * cUNIVERSAL_FREE_ASSET_CATEGORY
Definition WsfCoverageAsset.hpp:27
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
bool operator()(const wsf::coverage::FreeAsset &aLHS, const wsf::coverage::FreeAsset &aRHS) const
Definition WsfCoverageAsset.hpp:129
bool operator()(const wsf::coverage::GridAsset &aLHS, const wsf::coverage::GridAsset &aRHS) const
Definition WsfCoverageAsset.hpp:116
Copyrights Multiple, All Rights Reserved