Photon Fusion 1.1.2

Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
NetworkLinkedList< T > Struct Template Reference

Fusion type for networking LinkedLists. Maximum capacity is fixed, and is set with the CapacityAttribute.

Typical Usage: More...

Inherits IEnumerable< T >.

Public Member Functions

 NetworkLinkedList (byte *data, int capacity, IElementReaderWriter< T > rw)
 
NetworkLinkedList< T > Remap (void *list)
 
void Clear ()
 Removes and clears all list elements. More...
 
bool Contains (T value)
 Returns true if the value already exists in the list. More...
 
bool Contains (T value, IEqualityComparer< T > comparer)
 Returns true if the value already exists in the list. More...
 
Set (int index, T value)
 Sets the value at supplied index. More...
 
Get (int index)
 Returns the value at supplied index. More...
 
int IndexOf (T value)
 Returns the index with this value. Returns -1 if not found. More...
 
int IndexOf (T value, IEqualityComparer< T > equalityComparer)
 Returns the index with this value. Returns -1 if not found. More...
 
bool Remove (T value)
 Removes the first found element with indicated value. More...
 
bool Remove (T value, IEqualityComparer< T > equalityComparer)
 Removes the first found element with indicated value. More...
 
void Add (T value)
 Adds a value to the end of the list. More...
 
int * FindFreeEntry (out int index)
 
void RemoveEntry (int *entry, int entryIndex)
 
int * GetEntryByListIndex (int listIndex)
 
int * Entry (int index)
 
Read (int *entry)
 
void Write (int *entry, T value)
 
Enumerator GetEnumerator ()
 
IEnumerator< T > IEnumerable< T >. GetEnumerator ()
 
IEnumerator IEnumerable. GetEnumerator ()
 

Public Attributes

int * _data
 
int _stride
 
int _capacity
 
IElementReaderWriter< T > _rw
 

Static Public Attributes

const int ELEMENT_WORDS = 2
 
const int META_WORDS = 3
 
const int COUNT = 0
 
const int HEAD = 1
 
const int TAIL = 2
 
const int PREV = 0
 
const int NEXT = 1
 
const int INVALID = 0
 
const int OFFSET = 1
 

Properties

int Head [get, set]
 
int Tail [get, set]
 
int Count [get]
 Returns the current element count. More...
 
int Capacity [get]
 Returns the max element count. More...
 
this[int index] [get, set]
 Element indexer. More...
 

Detailed Description

Fusion type for networking LinkedLists. Maximum capacity is fixed, and is set with the CapacityAttribute.

Typical Usage:

[Networked, Capacity(10)]
NetworkLinkedList<int> syncedLinkedList => default;

Optional usage (for NetworkBehaviours ONLY - this is not legal in INetworkStructs): [Networked, Capacity(4)]
NetworkLinkedList<int> syncedLinkedList { get; } = MakeInitializer(new int[] { 1, 2, 3, 4 });

Usage for modifying data: var list = syncedLinkedList; list.Add(123); list[0] = 456; list.Remove(0);

Template Parameters
TT can be a primitive, or an INetworkStruct.

Member Function Documentation

◆ Add()

void Add ( value)

Adds a value to the end of the list.

Parameters
value

◆ Clear()

void Clear ( )

Removes and clears all list elements.

◆ Contains() [1/2]

bool Contains ( value)

Returns true if the value already exists in the list.

◆ Contains() [2/2]

bool Contains ( value,
IEqualityComparer< T >  comparer 
)

Returns true if the value already exists in the list.

◆ Get()

T Get ( int  index)

Returns the value at supplied index.

◆ IndexOf() [1/2]

int IndexOf ( value)

Returns the index with this value. Returns -1 if not found.

◆ IndexOf() [2/2]

int IndexOf ( value,
IEqualityComparer< T >  equalityComparer 
)

Returns the index with this value. Returns -1 if not found.

Parameters
equalityComparerSpecify custom IEqualityComparer to be used for compare.

◆ Remove() [1/2]

bool Remove ( value)

Removes the first found element with indicated value.

◆ Remove() [2/2]

bool Remove ( value,
IEqualityComparer< T >  equalityComparer 
)

Removes the first found element with indicated value.

◆ Set()

T Set ( int  index,
value 
)

Sets the value at supplied index.

Property Documentation

◆ Capacity

int Capacity
get

Returns the max element count.

◆ Count

int Count
get

Returns the current element count.

◆ this[int index]

T this[int index]
getset

Element indexer.