Agrarsense
Public Member Functions | Public Attributes | List of all members
USensorMapDataAsset Class Reference

#include <SensorMapDataAsset.h>

Inheritance diagram for USensorMapDataAsset:
Inheritance graph
[legend]
Collaboration diagram for USensorMapDataAsset:
Collaboration graph
[legend]

Public Member Functions

USensorDataAssetGetAssetDataBySensorType (ESensorTypes SensorType, bool &MatchFound)
 
USensorDataAssetGetAssetDataByUniqueIdentifier (const FString &UniqueIdentifier, bool &MatchFound)
 

Public Attributes

TMap< ESensorTypes, USensorDataAsset * > Sensors
 

Detailed Description

Definition at line 20 of file SensorMapDataAsset.h.

Member Function Documentation

◆ GetAssetDataBySensorType()

USensorDataAsset * USensorMapDataAsset::GetAssetDataBySensorType ( ESensorTypes  SensorType,
bool &  MatchFound 
)
inline

Get the sensor data asset by sensor type

Parameters
SensorType
MatchFoundWas the match found
Returns
Sensor data asset

Definition at line 35 of file SensorMapDataAsset.h.

36 {
37 USensorDataAsset* sensorAsset = Sensors.FindRef(SensorType);
38
39 MatchFound = sensorAsset != nullptr;
40
41 return sensorAsset;
42
43 }
TMap< ESensorTypes, USensorDataAsset * > Sensors

References Sensors.

Referenced by USensorFactory::SpawnModelClassForSensor().

◆ GetAssetDataByUniqueIdentifier()

USensorDataAsset * USensorMapDataAsset::GetAssetDataByUniqueIdentifier ( const FString &  UniqueIdentifier,
bool &  MatchFound 
)
inline

Get the sensor data asset by unique identifier

Parameters
UniqueIdentifier
MatchFound
Returns
Sensor data asset

Definition at line 52 of file SensorMapDataAsset.h.

52 {
53 MatchFound = false;
54
55 // Iterate through the Sensors map
56 for (const TPair<ESensorTypes, USensorDataAsset*>& SensorPair : Sensors)
57 {
58 // Get the sensor's UniqueIdentifier
59 FString SensorUniqueIdentifier = SensorPair.Value->UniqueIdentifier;
60
61 // Check if the UniqueIdentifier of the current sensor matches the parameter
62 if (SensorUniqueIdentifier == UniqueIdentifier)
63 {
64 // Match found, set MatchFound to true and return the sensor
65 MatchFound = true;
66 return SensorPair.Value;
67 }
68 }
69
70 // No matching sensor found, return nullptr
71 return nullptr;
72 }

References Sensors, and USensorDataAsset::UniqueIdentifier.

Member Data Documentation

◆ Sensors

TMap<ESensorTypes, USensorDataAsset*> USensorMapDataAsset::Sensors

Definition at line 26 of file SensorMapDataAsset.h.


The documentation for this class was generated from the following file: