WSF
WsfSA_GroupUtils.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2022 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 WSFSA_GROUPUTILS_HPP
13#define WSFSA_GROUPUTILS_HPP
14
15#include "wsf_air_combat_export.h"
16
17#include <functional>
18#include <list>
19
21#include "WsfSA_Group.hpp"
22
23class WsfPlatform;
24
25/*This pure static class provides testable and prtable functions for manipulating groups.*/
26class WSF_AIR_COMBAT_EXPORT WsfSA_GroupUtils
27{
28public:
42
58
63 static int StringToSplitCriteria(const std::string& aEnumString);
64
69 static int StringToGroupSorting(const std::string& aEnumString);
70
74 static int CalculateNumPIs(const std::list<WsfSA_PerceivedItem*>& aItemList);
75
79 static int CalculateNumPIs(const std::list<WsfSA_Group*>& aGroupList);
80
87 static bool RenameGroup(const std::list<WsfSA_Group*>& aGroupList, WsfSA_Group* aGroup, const std::string& aName);
88
106 static WsfSA_Group* CreateGroup(int aPI_Limit,
107 int aPI_Current,
108 std::list<WsfSA_Group*>& aGroupList,
109 const WsfPlatform* aOwningPlatform,
110 const std::list<WsfSA_EntityPerception*>& aElements,
111 const std::string& aName,
112 double aMinGroupRadius_nm,
113 bool aProtect = false);
114
132 static bool DisbandGroup(int aPI_Limit,
133 int aPI_Current,
134 std::list<WsfSA_Group*>& aGroupList,
135 WsfSA_Group* aGroup,
136 std::function<std::string()> aNamingFunc,
137 double aMinGroupRadius_nm,
138 bool aProtect = false);
139
152 static WsfSA_Group* MergeGroups(std::list<WsfSA_Group*>& aGroupList,
153 const std::list<WsfSA_Group*>& aGroups,
154 const WsfPlatform* aOwningPlatform,
155 double aMinGroupRadius_nm,
156 bool aProtect = false);
157
180 static std::pair<WsfSA_Group*, WsfSA_Group*> SplitGroup(int aPI_Limit,
181 int aPI_Current,
182 std::list<WsfSA_Group*>& aGroupList,
183 WsfSA_Group* aGroup,
184 int aNumElements,
185 int aCriterion,
186 WsfPlatform* aPlatform,
187 const std::string& aNewGroupName,
188 double aMinGroupRadius_nm,
189 bool aProtect = false);
190
207 static bool TransferEntity(int aPI_Limit,
208 int aPI_Current,
209 std::list<WsfSA_Group*>& aGroupList,
210 WsfSA_EntityPerception* aEntity,
211 WsfSA_Group* aGroup,
212 double aMinGroupRadius_nm,
213 bool aProtect = false);
214
229 static bool RemoveEntityFromGroup(int aPI_Limit,
230 int aPI_Current,
231 std::list<WsfSA_Group*>& aGroupList,
232 WsfSA_EntityPerception* aEntity,
233 const std::string& aDegenerateGroupName,
234 double aMinGroupRadius_nm,
235 bool aProtect = false);
236
249 static bool SetFocus(int aPI_Limit, int aPI_Current, WsfSA_Group* aGroup, bool aFocus, bool aProtect = false);
250
258 static void Prune(int aPI_Limit, std::list<WsfSA_PerceivedItem*>& aGroupList, std::list<WsfSA_PerceivedItem*>& aToRemove);
259
269 static void PruneRecursive(int aPI_Limit,
271 bool aPreserve,
272 std::list<WsfSA_PerceivedItem*>& aGroupList,
273 std::list<WsfSA_PerceivedItem*>& aToRemove);
274
283 static void SortedGroups(int aSortingEnum,
284 std::vector<WsfSA_Group*>& aOutputGroups,
285 const std::list<WsfSA_Group*>& aGroupList,
286 const WsfPlatform* aPlatform);
287
288 // =======================
289 // From WsfSA_GroupManager
290 // =======================
291
296 static void RecalculateGroupCentroid(WsfSA_Group* aGroup, double aMinGroupRadius_nm);
297
302 static double CalcRadiusForGroup_nm(const WsfSA_Group* aGroup, double aMinGroupRadius_nm);
303
307 static double DistanceFromCentroid(const WsfSA_Group* aGroup, const WsfSA_EntityPerception* aEntity);
308};
309
310#endif // WSFSA_GROUPUTILS_HPP
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfSA_EntityPerception.hpp:37
Definition WsfSA_GroupUtils.hpp:27
SplitCriteria
Definition WsfSA_GroupUtils.hpp:30
@ cMIN_ALTITUDE
Definition WsfSA_GroupUtils.hpp:36
@ cMAX_DISTANCE
Definition WsfSA_GroupUtils.hpp:37
@ cMAX_ALTITUDE
Definition WsfSA_GroupUtils.hpp:35
@ cMAX_TARGET
Definition WsfSA_GroupUtils.hpp:33
@ cMIN_THREAT
Definition WsfSA_GroupUtils.hpp:32
@ cRIGHTMOST_FROM_HEADING
Definition WsfSA_GroupUtils.hpp:39
@ cMIN_DISTANCE
Definition WsfSA_GroupUtils.hpp:38
@ cMAX_THREAT
Definition WsfSA_GroupUtils.hpp:31
@ cMIN_TARGET
Definition WsfSA_GroupUtils.hpp:34
@ cLEFTMOST_FROM_HEADING
Definition WsfSA_GroupUtils.hpp:40
GroupSorting
Definition WsfSA_GroupUtils.hpp:44
@ cASCENDING_ENTITY_COUNT
Definition WsfSA_GroupUtils.hpp:53
@ cASCENDING_ALTITUDE
Definition WsfSA_GroupUtils.hpp:49
@ cASCENDING_DISTANCE
Definition WsfSA_GroupUtils.hpp:51
@ cDESCENDING_TARGET
Definition WsfSA_GroupUtils.hpp:48
@ cASCENDING_RADIUS
Definition WsfSA_GroupUtils.hpp:55
@ cDESCENDING_THREAT
Definition WsfSA_GroupUtils.hpp:46
@ cDESCENDING_RADIUS
Definition WsfSA_GroupUtils.hpp:56
@ cDESCENDING_DISTANCE
Definition WsfSA_GroupUtils.hpp:52
@ cASCENDING_THREAT
Definition WsfSA_GroupUtils.hpp:45
@ cDESCENDING_ENTITY_COUNT
Definition WsfSA_GroupUtils.hpp:54
@ cDESCENDING_ALTITUDE
Definition WsfSA_GroupUtils.hpp:50
@ cASCENDING_TARGET
Definition WsfSA_GroupUtils.hpp:47
Definition WsfSA_Group.hpp:24
Importance
Definition WsfSA_PerceivedItem.hpp:56
Copyrights Multiple, All Rights Reserved