Skip to content

NullableEnum<T>

Represents an enumerated type that can be assigned Null

Definition

Unit: Neslib.Iceoryx2.System

type NullableEnum<T> = record ... end;

Type Parameters

T:

Remarks

'T' must be an enumerated type. To make this type more efficient than Nullable, it uses UInt8.MaxValue, UInt16.MaxValue or UInt32.MaxValue to indicate a Null value (depending on the size of T).

Properties

Name Description
HasValue A value indicating whether this nullable has a valid value of its underlying type.
Value The value, if it has been assigned a valid underlying value.

Constructors

Name Description
Create Creates a nullable with a given value.

Operators

Name Description
Equal Compares two nullables for equality.
Explicit Explicitly converts from a nullable to its underlying value.
Implicit(Pointer) Implicitly converts from nil to a nullable. This sets the HasValue of the nullable to False.
Implicit(T) Implicitly converts from a value to a nullable. This sets the HasValue of the nullable to True.
NotEqual Compares two nullables for inequality.

Methods

Name Description
CreateNull Creates a nullable with value null.
SetNull Sets the value to null.

Property Descriptions

HasValue

A value indicating whether this nullable has a valid value of its underlying type.

property HasValue: Boolean read GetHasValue

Type: Boolean


Value

The value, if it has been assigned a valid underlying value.

property Value: T read GetValue

Type: T

Exceptions

EInvalidOperation: If HasValue is False.


Constructor Descriptions

Create

Creates a nullable with a given value.

constructor Create(const AValue: T)

Parameters

AValue: T : The value to set the nullable to.

Remarks

This will also set HasValue to True.


Operator Descriptions

Equal(NullableEnum, NullableEnum)

Compares two nullables for equality.

class operator Equal(const ALeft, ARight: NullableEnum<T>): Boolean

Parameters

ALeft: NullableEnum<T>

ARight: NullableEnum<T>

Returns

Boolean


Explicit(NullableEnum)

Explicitly converts from a nullable to its underlying value.

class operator Explicit(const AValue: NullableEnum<T>): T; inline; static

Parameters

AValue: NullableEnum<T>

Returns

T

Exceptions

EInvalidOperation: If HasValue is False.


Implicit(Pointer)

Implicitly converts from nil to a nullable. This sets the HasValue of the nullable to False.

class operator Implicit(const AValue: Pointer): NullableEnum<T>; inline; static

Parameters

AValue: Pointer

Returns

NullableEnum<T>


Implicit(T)

Implicitly converts from a value to a nullable. This sets the HasValue of the nullable to True.

class operator Implicit(const AValue: T): NullableEnum<T>; inline; static

Parameters

AValue: T

Returns

NullableEnum<T>


NotEqual(NullableEnum, NullableEnum)

Compares two nullables for inequality.

class operator NotEqual(const ALeft, ARight: NullableEnum<T>): Boolean

Parameters

ALeft: NullableEnum<T>

ARight: NullableEnum<T>

Returns

Boolean


Method Descriptions

CreateNull

Creates a nullable with value null.

class function CreateNull: NullableEnum<T>; inline; static

Returns

NullableEnum<T>


SetNull

Sets the value to null.

procedure SetNull; inline