template class MAGES::Utilities::Collections::RegistrationList

Overview

A list for registering objects. More…

template 
class RegistrationList
{
public:
    // properties

    List Snapshot;

    // methods

    bool IsRegistered(T item);
    bool IsPendingRemove(T item);
    bool IsPendingAdd(T item);
    bool Register(T item);
    void Deregister(T item);
    void Flush();
    void GetRegisteredItems(List result);
};

Detailed Documentation

A list for registering objects.

Maintains multiple lists to enable support for removing objects while iterating over a snapshot. Updates to the snapshot will only be made when Flush is called.

Parameters:

T

The type of the list objects.

Properties

List Snapshot

Gets a snapshot of the items that were registered at the previous Flush.

Methods

bool IsRegistered(T item)

Gets if an item is registered.

Parameters:

item

The item to check if it is registered

Returns:

Returns true if item is registered, false otherwise

bool IsPendingRemove(T item)

Gets if the item is to be removed in the next flush.

Parameters:

item

The item to check for.

Returns:

true if the item is going to be removed in the next flush, false otherwise.

bool IsPendingAdd(T item)

Gets if the item is to be added in the next flush.

Parameters:

item

The item to check for.

Returns:

true if the item is going to be added in the next flush, false otherwise.

bool Register(T item)

Registers the item to the list.

Parameters:

item

The item to register.

Returns:

Returns true if a change in the registration was made, false otherwise.

void Deregister(T item)

Deregisters item from the list.

Parameters:

item

The item to deregister.

void Flush()

Flush pending registrations/additions and deregistrations/removals into the snapshot.

void GetRegisteredItems(List result)

Gets all the items that will be registered (be in the snapshot) after the next flush.

result is cleared before adding the registered items.

Parameters:

result

The list to store the registered items.