Agrarsense
ActorInformation.h
Go to the documentation of this file.
1// Copyright (c) 2023 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/Interface.h"
10
11#include "ActorInformation.generated.h"
12
13UINTERFACE(MinimalAPI)
14class UActorInformation : public UInterface
15{
16 GENERATED_BODY()
17};
18
22class AGRARSENSE_API IActorInformation
23{
24 GENERATED_BODY()
25
26public:
27
31 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ActorID")
32 FString GetActorID() const;
33
37 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ActorID")
38 FString GetActorName() const;
39
43 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ActorID")
44 FString GetActorInformation() const;
45
49 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ActorID")
50 void SetActorName(const FString& NewActorName);
51
55 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "ActorID")
56 void SetActorIDAndName(const FString& NewActorName, const FString& NewID);
57
65 static void SetAndValidateActorIDAndName(FString& ActorName, FString& ActorID, TWeakObjectPtr<AActor> Actor);
66
72 static bool DestroyActorByID(const FString& ID);
73
79 static AActor* GetActorByID(const FString& ID);
80
86 template<typename T>
87 static TArray<T*> GetActorsWithInterface();
88
92 static void PrintAllIds();
93
94
95#if WITH_EDITOR
99 static void ClearTMapEditor();
100#endif
101
102private:
103
107 static FString ValidateID(const FString& ActorID, TWeakObjectPtr<AActor> Actor);
108
112 static FString GenerateUniqueID();
113};