Agrarsense
SensorManager.h
Go to the documentation of this file.
1// Copyright (c) 2024 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "CoreMinimal.h"
9#include "UObject/Object.h"
10
11#include "SensorManager.generated.h"
12
13class ASensor;
14
15DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FSensorSpawnedDelegate, ASensor*, SensorPtr);
16DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FSensorDestroyedDelegate, ASensor*, SensorPtr);
17
21UCLASS()
22class AGRARSENSE_API USensorManager : public UObject
23{
24 GENERATED_BODY()
25
26public:
27
29
31
36 UFUNCTION(BlueprintCallable)
37 TArray<ASensor*> GetAllSensors();
38
44 UFUNCTION(BlueprintCallable)
45 TArray<ASensor*> GetAllSensorsOfType(ESensorTypes SensorType);
46
50 UPROPERTY(BlueprintAssignable)
51 FSensorSpawnedDelegate OnSensorSpawned;
52
57 UPROPERTY(BlueprintAssignable)
58 FSensorDestroyedDelegate OnSensorDestroyed;
59
63 static USensorManager* Get();
64
65private:
66
67 friend class ASensor;
68
69 static void AddSensor(ASensor* SensorPtr);
70
71 static void RemoveSensor(ASensor* SensorPtr);
72
73 static USensorManager* Instance;
74
75 UPROPERTY()
76 TArray<ASensor*> Sensors;
77
78};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FSensorSpawnedDelegate, ASensor *, SensorPtr)
ESensorTypes
Definition: SensorTypes.h:15
Definition: Sensor.h:44