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

#include "OperatingSystemHDD.h"

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

Public Member Functions

 UOperatingSystemHDD ()
 
void ConsumeSpaceInMB (const float &NewSizeInMB, UOperatingSystemPartition *Partition, FGenericError &OutError)
 
void ConsumeSpaceInGB (const float &NewSizeInGB, UOperatingSystemPartition *Partition, FGenericError &OutError)
 
FText GetSizeAsText (const EOperatingSystemSizeMethod SizeMethod, const UOperatingSystemPartition *Partition, FGenericError &OutError) const
 
float GetStoragePercentage (const UOperatingSystemPartition *Partition, FGenericError &OutError) const
 
UOperatingSystemPartitionAllocatePartitionFromLoadGame (const FOperatingSystemPartitionSaveLoad &PartitionSaveLoad)
 
void AllocatePartition (UOperatingSystemPartition &NewPartition, FGenericError &OutError)
 
void RemovePartition (UOperatingSystemPartition &Partition, FGenericError &OutError)
 Removes a partition from the hard disk drive.
 
void RefreshPartitions ()
 
double GetHardDiskSize (const EOperatingSystemSizeMethod &SizeMethod) const
 
UOperatingSystemPartitionFindPartitionByID (const FOperatingSystemUniqueId &TestID) const
 
bool HasPartitionWithID (const FOperatingSystemUniqueId &TestID) const
 
FORCEINLINE const TArray< TObjectPtr< UOperatingSystemPartition > > & GetPartitions () const
 
- Public Member Functions inherited from UOperatingSystemBaseHardware
 UOperatingSystemBaseHardware ()
 
FText GetHardwareName () const
 
FText GetHardwareMadeBy () const
 
FText GetModelNumber () const
 
FString GetHardwareNameAsString () const
 Returns the name of the hardware as a string.
 
FGameplayTag GetHardwareTag () const
 Returns the hardware tag associated with the hardware object.
 

Static Public Member Functions

static UOperatingSystemHDDCreateHDD (UOperatingSystemMBB *OwningMotherboard, FGenericError &OutError)
 

Protected Member Functions

virtual bool OnValidate (FGenericError &OutError) const override
 
- Protected Member Functions inherited from UOperatingSystemBaseHardware
bool Validate (FGenericError &OutError) const
 Validates the current state of the operating system hardware object.
 
bool K2_OnValidate (FGenericError &OutError) const
 

Protected Attributes

float SizeInGB
 
TArray< TObjectPtr< UOperatingSystemPartition > > DiskPartitions
 
double PostDiskAllocatedSpaceInBytes
 
- Protected Attributes inherited from UOperatingSystemBaseHardware
FText Name
 
FText MadeBy
 
FText ModelNumber
 
FGameplayTag HardwareTag
 
bool bHasBlueprintValidateFunction
 

Detailed Description

UOperatingSystemHDD is a class representing a hard disk drive in an operating system.

This class inherits from UOperatingSystemBaseHardware and provides functionality to manage the hard disk drive.

Constructor & Destructor Documentation

◆ UOperatingSystemHDD()

UOperatingSystemHDD::UOperatingSystemHDD ( )

Member Function Documentation

◆ AllocatePartition()

void UOperatingSystemHDD::AllocatePartition ( UOperatingSystemPartition & NewPartition,
FGenericError & OutError )

Allocates a partition on the hard disk drive.

This method is used to allocate a new partition on the hard disk drive. The partition to be allocated is specified by the NewPartition parameter. The allocation process updates the OutError parameter with any error that occurred during the allocation.

Parameters
NewPartitionThe partition to be allocated.
OutErrorThe error that occurred during the allocation process, if any.
Here is the call graph for this function:

◆ AllocatePartitionFromLoadGame()

UOperatingSystemPartition * UOperatingSystemHDD::AllocatePartitionFromLoadGame ( const FOperatingSystemPartitionSaveLoad & PartitionSaveLoad)

UOperatingSystemHDD::AllocatePartitionFromLoadGame is a method that allocates a partition from a loaded game state.

This method takes in a parameter PartitionSaveLoad of type FOperatingSystemPartitionSaveLoad, which contains the necessary data to load the partition. It creates a new UOperatingSystemPartition object and initializes it with the provided data. The newly created partition is then added to the DiskPartitions array of UOperatingSystemHDD.

Parameters
PartitionSaveLoadThe data structure containing the information required to load the partition.
Returns
The newly created UOperatingSystemPartition object that represents the loaded partition.
Note
The returned partition is also added to the DiskPartitions array of UOperatingSystemHDD.
See also
UOperatingSystemPartition, FOperatingSystemPartitionSaveLoad
Here is the call graph for this function:

◆ ConsumeSpaceInGB()

void UOperatingSystemHDD::ConsumeSpaceInGB ( const float & NewSizeInGB,
UOperatingSystemPartition * Partition,
FGenericError & OutError )

ConsumeSpaceInGB is a method in the UOperatingSystemHDD class that consumes space in the specified partition in gigabytes.

Parameters
NewSizeInGB[in] The size of the space to consume in gigabytes.
Partition[in] The UOperatingSystemPartition object representing the partition in which to consume space.
OutError[out] The FGenericError object used to store any error messages.
Here is the call graph for this function:

◆ ConsumeSpaceInMB()

void UOperatingSystemHDD::ConsumeSpaceInMB ( const float & NewSizeInMB,
UOperatingSystemPartition * Partition,
FGenericError & OutError )

ConsumeSpaceInMB is a method in the UOperatingSystemHDD class that consumes space in the specified partition in megabytes.

Parameters
NewSizeInMB[in] The size of the space to consume in megabytes.
Partition[in] The UOperatingSystemPartition object representing the partition in which to consume space.
OutError[out] The FGenericError object used to store any error messages.
Here is the call graph for this function:

◆ CreateHDD()

UOperatingSystemHDD * UOperatingSystemHDD::CreateHDD ( UOperatingSystemMBB * OwningMotherboard,
FGenericError & OutError )
static

CreateHDD is a method in the UOperatingSystemHDD class that creates a new hard disk drive object.

Parameters
OwningMotherboardThe UOperatingSystemMBB object that owns the hard disk drive.
OutErrorThe FGenericError object used to store any error messages.
Returns
A pointer to the newly created UOperatingSystemHDD object, or nullptr if an error occurred.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindPartitionByID()

UOperatingSystemPartition * UOperatingSystemHDD::FindPartitionByID ( const FOperatingSystemUniqueId & TestID) const

Finds a partition in the hard disk drive with the given unique ID.

This method searches for a partition in the hard disk drive with the specified unique ID. If a partition with the ID is found, it is returned. If no partition with the ID is found, nullptr is returned.

Note that the partition must be a part of the operating system's hard disk drive for it to be found by this method.

Parameters
TestIDThe unique ID to search for.
Returns
A pointer to the partition with the unique ID, or nullptr if not found.
Here is the caller graph for this function:

◆ GetHardDiskSize()

double UOperatingSystemHDD::GetHardDiskSize ( const EOperatingSystemSizeMethod & SizeMethod) const

GetHardDiskSize is a method in the UOperatingSystemHDD class that returns the size of the hard disk drive.

Parameters
SizeMethod- The method to use for determining the size of the hard disk drive. It can be one of the following values:
Returns
The size of the hard disk drive based on the specified SizeMethod. The returned size is a double value.
Here is the call graph for this function:

◆ GetPartitions()

FORCEINLINE const TArray< TObjectPtr< UOperatingSystemPartition > > & UOperatingSystemHDD::GetPartitions ( ) const
inline

GetPartitions is a method that returns the array of partitions associated with the hard disk drive.

Returns
A constant reference to an array of TObjectPtr<UOperatingSystemPartition> representing the disk partitions. The caller should not modify this array.
Here is the caller graph for this function:

◆ GetSizeAsText()

FText UOperatingSystemHDD::GetSizeAsText ( const EOperatingSystemSizeMethod SizeMethod,
const UOperatingSystemPartition * Partition,
FGenericError & OutError ) const

GetSizeAsText is a method in the UOperatingSystemHDD class that returns the size of the specified partition as text.

Parameters
SizeMethod[in] The method used to represent the size (bytes, megabytes or gigabytes).
Partition[in] The UOperatingSystemPartition object representing the partition for which to get the size.
OutError[out] The FGenericError object used to store any error messages.
Returns
The size of the partition as text.
Here is the call graph for this function:

◆ GetStoragePercentage()

float UOperatingSystemHDD::GetStoragePercentage ( const UOperatingSystemPartition * Partition,
FGenericError & OutError ) const

GetStoragePercentage is a method in the UOperatingSystemHDD class that retrieves the storage percentage of a partition.

Parameters
Partition[in] The UOperatingSystemPartition object representing the partition for which to retrieve the storage percentage.
OutError[out] The FGenericError object used to store any error messages.
Returns
The storage percentage of the partition.
Here is the call graph for this function:

◆ HasPartitionWithID()

bool UOperatingSystemHDD::HasPartitionWithID ( const FOperatingSystemUniqueId & TestID) const

Checks if a hard disk drive has a partition with the given ID.

Parameters
TestIDThe ID of the partition to check for.
Returns
True if a partition with the given ID exists, false otherwise.
Here is the call graph for this function:

◆ OnValidate()

bool UOperatingSystemHDD::OnValidate ( FGenericError & OutError) const
overrideprotectedvirtual

OnValidate is a method in the UOperatingSystemHDD class that performs validation on the hard disk drive.

Parameters
OutErrorA reference to an FGenericError object used to store an error message if the validation fails.
Returns
Returns a boolean value indicating whether the validation was successful (true) or not (false).

Reimplemented from UOperatingSystemBaseHardware.

◆ RefreshPartitions()

void UOperatingSystemHDD::RefreshPartitions ( )

RefreshPartitions() is a method of the UOperatingSystemHDD class that refreshes the partitions of a hard disk drive.

This method iterates over the DiskPartitions array of the UOperatingSystemHDD instance and sets the disk name for each partition based on the partition index.

Here is the caller graph for this function:

◆ RemovePartition()

void UOperatingSystemHDD::RemovePartition ( UOperatingSystemPartition & Partition,
FGenericError & OutError )

Removes a partition from the hard disk drive.

This method removes the specified partition from the hard disk drive. If the partition is not valid (null or not valid), an error message will be set in the provided OutError object

Parameters
PartitionThe partition to be removed.
OutErrorThe error object used to store error information if necessary.
Note
This method updates the allocated disk space of the hard disk drive by adding the size of the removed partition to the total allocated space.
If the specified partition is found and successfully removed, it will no longer be present in the DiskPartitions collection.
Here is the call graph for this function:

Member Data Documentation

◆ DiskPartitions

TArray<TObjectPtr<UOperatingSystemPartition> > UOperatingSystemHDD::DiskPartitions
protected

Key is the drive letter. Like C, D, E etc. In Unix this can be /dev/sda, /dev/sda1 etc.

◆ PostDiskAllocatedSpaceInBytes

double UOperatingSystemHDD::PostDiskAllocatedSpaceInBytes
protected

Space remaining to allocate new partitions.

◆ SizeInGB

float UOperatingSystemHDD::SizeInGB
protected

Size of this hard disk.


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