Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
UOperatingSystemDeviceMessenger Class Reference

#include "OperatingSystemDeviceMessenger.h"

Inheritance diagram for UOperatingSystemDeviceMessenger:
[legend]
Collaboration diagram for UOperatingSystemDeviceMessenger:
[legend]

Public Member Functions

 UOperatingSystemDeviceMessenger ()
 
void BeginDestroyMessenger ()
 
OPERATINGSYSTEMSIMULATOR_API void Broadcast (const FName EventName, UObject *Payload)
 
OPERATINGSYSTEMSIMULATOR_API void BeginListening (const FName ListenToEventName, const FOperatingSystemDeviceMessageDelegate &Callback)
 
OPERATINGSYSTEMSIMULATOR_API void StopListening (const FName EventName)
 

Static Public Member Functions

static UOperatingSystemDeviceMessengerCreateMessenger (AOperatingSystemDeviceActor *NewDevice)
 

Protected Member Functions

virtual OPERATINGSYSTEMSIMULATOR_API void OnConstructed ()
 This method is called when the operating system device messenger is constructed.
 
OPERATINGSYSTEMSIMULATOR_API TWeakObjectPtr< UOperatingSystemBaseDeviceGetParentDevice () const
 Retrieves the parent device associated with this operating system device.
 
void K2_OnConstructed ()
 
void K2_OnMessengerBeginDestroy ()
 K2_OnMessengerBeginDestroy function.
 

Detailed Description

A class that provides messaging functionality for an operating system device.

This class is responsible for broadcasting and listening to events in the operating system device. It allows communication between different components of the device.

A class that creates a messenger for an operating system device.

This method creates a messenger for the specified operating system device. The messenger is responsible for broadcasting and listening to events in the device, allowing communication between different components of the device.

Parameters
NewDeviceThe operating system device for which to create the messenger.
Returns
A pointer to the created messenger, or nullptr if the creation failed or the messenger class is null.
Note
The NewDevice parameter must be a valid pointer to an AOperatingSystemDeviceActor subclass object.
See also
AOperatingSystemDeviceActor, UOperatingSystemDeviceMessenger::BroadcastEvent, UOperatingSystemDeviceMessenger::BeginListening, UOperatingSystemDeviceMessenger::StopListening

Constructor & Destructor Documentation

◆ UOperatingSystemDeviceMessenger()

UOperatingSystemDeviceMessenger::UOperatingSystemDeviceMessenger ( )
Here is the call graph for this function:

Member Function Documentation

◆ BeginDestroyMessenger()

void UOperatingSystemDeviceMessenger::BeginDestroyMessenger ( )

Begins the process of destroying the operating system device messenger.

This method is called when the operating system device is being destroyed. It performs the necessary clean-up tasks to ensure a proper destruction of the messenger.

Note
This method should only be called from within the operating system device class.

Example usage:

UOperatingSystemDeviceMessenger* DeviceMessenger; // Assume this variable is already initialized.
DeviceMessenger->BeginDestroyMessenger();
Definition OperatingSystemDeviceMessenger.h:99
void BeginDestroyMessenger()
Definition OperatingSystemDeviceMessenger.cpp:109
See also
UOperatingSystemDeviceMessenger
Here is the call graph for this function:

◆ BeginListening()

void UOperatingSystemDeviceMessenger::BeginListening ( const FName ListenToEventName,
const FOperatingSystemDeviceMessageDelegate & Callback )

Starts listening for a specific event and registers the specified callback to be executed when the event occurs. The event can be triggered by an operating system device, and the registered callback will be notified with the event details.

Note
The provided event name must be valid and should match the actual name of the event to listen to.
The callback should be a valid delegate that can handle the event details passed as an argument.
Parameters
ListenToEventNameThe name of the event to listen to.
CallbackThe delegate that will be called when the event occurs.

Example usage:

UOperatingSystemDeviceMessenger* DeviceMessenger; // Assume this variable is already initialized.
FName EventName = "MyEvent";
DeviceMessenger->BeginListening(EventName, [&](const FOperatingSystemDeviceMessage& Message) {
// Process the event details...
});
OPERATINGSYSTEMSIMULATOR_API void BeginListening(const FName ListenToEventName, const FOperatingSystemDeviceMessageDelegate &Callback)
Definition OperatingSystemDeviceMessenger.cpp:125
See also
FOperatingSystemDeviceMessage, FOperatingSystemDeviceMessageDelegate

◆ Broadcast()

void UOperatingSystemDeviceMessenger::Broadcast ( const FName EventName,
UObject * Payload )

Broadcasts an event with a payload. The event name is specified by the EventName parameter, and the payload object is specified by the Payload parameter.

Parameters
EventNameThe name of the event to be broadcasted.
PayloadThe payload object associated with the event.

◆ CreateMessenger()

UOperatingSystemDeviceMessenger * UOperatingSystemDeviceMessenger::CreateMessenger ( AOperatingSystemDeviceActor * NewDevice)
static

◆ GetParentDevice()

TWeakObjectPtr< UOperatingSystemBaseDevice > UOperatingSystemDeviceMessenger::GetParentDevice ( ) const
protected

Retrieves the parent device associated with this operating system device.

This method returns the parent device actor that is associated with the current operating system device. If no parent device actor is set, it returns nullptr.

Returns
The parent device actor, or nullptr if no parent device actor is set.
See also
DeviceActor

◆ K2_OnConstructed()

void UOperatingSystemDeviceMessenger::K2_OnConstructed ( )
protected

A method that is called when an object of the OperatingSystemDeviceMessenger class is constructed.

This method is blueprint implementable, allowing it to be overridden in blueprint subclasses. It is intended to be used for any necessary initialization logic when an object is created.

Note
This method is displayed as "On Constructed".

◆ K2_OnMessengerBeginDestroy()

void UOperatingSystemDeviceMessenger::K2_OnMessengerBeginDestroy ( )
protected

K2_OnMessengerBeginDestroy function.

This function is a BlueprintImplementableEvent that is part of the OperatingSystemDeviceMessenger class. It is used to handle the logic when the messenger begins destruction.

Here is the caller graph for this function:

◆ OnConstructed()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystemDeviceMessenger::OnConstructed ( )
inlineprotectedvirtual

This method is called when the operating system device messenger is constructed.

This method is virtual and can be overridden by subclasses to perform custom initialization tasks when the messenger is constructed. Subclasses should override this method to provide any necessary initialization logic specific to the subclass.

Here is the caller graph for this function:

◆ StopListening()

void UOperatingSystemDeviceMessenger::StopListening ( const FName EventName)

Stops listening to a specific event identified by its name. Once this method is called, the device messenger will no longer receive events with the specified name.

Parameters
EventNameThe name of the event to stop listening to.

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