Ion
|
A Field that holds a vector of up to some number of values. More...
#include "resourceholder.h"
Public Member Functions | |
VectorField (const int change_bit_start, const size_t max_entries, ResourceHolder *holder) | |
~VectorField () override | |
void | Add (const T &value) |
Adds a value to the vector. More... | |
void | Remove (size_t i) |
Removes an element from the VectorField, replacing it with the last entry in the VectorField. More... | |
const T & | Get (const size_t i) const |
Gets a const reference to a value, if the index is valid, otherwise returns an InvalidReference. More... | |
T * | GetMutable (const size_t i) |
Gets a non-const pointer to a value and triggers the change. More... | |
bool | Set (const size_t i, const T &value) |
If the index i is valid, sets the value at index i and tells the resource what has changed. More... | |
size_t | GetCount () const |
int | GetBit () const |
Get the change bit. More... | |
Protected Member Functions | |
void | OnChanged () |
void | OnChanged (const int bit) |
Trigger a change for a specific bit. More... | |
A Field that holds a vector of up to some number of values.
The maximum is necessary for VectorFields that relate to GL state, such as Attributes; different platforms support different numbers of shader attributes, and this allows Ion to gracefully inform users (with an error message) if they try to add too many.
Definition at line 216 of file resourceholder.h.
|
inline |
Definition at line 218 of file resourceholder.h.
References DCHECK.
|
inlineoverride |
Definition at line 227 of file resourceholder.h.
|
inline |
Adds a value to the vector.
If too many Adds have occurred, then an error message is printed instead.
Definition at line 231 of file resourceholder.h.
References ion::port::ERROR, and LOG.
|
inline |
Gets a const reference to a value, if the index is valid, otherwise returns an InvalidReference.
Definition at line 259 of file resourceholder.h.
|
inlineinherited |
Get the change bit.
Definition at line 102 of file resourceholder.h.
|
inline |
Definition at line 295 of file resourceholder.h.
|
inline |
Gets a non-const pointer to a value and triggers the change.
Definition at line 269 of file resourceholder.h.
|
inlineprotectedinherited |
Definition at line 113 of file resourceholder.h.
|
inlineprotectedinherited |
Trigger a change for a specific bit.
Definition at line 121 of file resourceholder.h.
|
inline |
Removes an element from the VectorField, replacing it with the last entry in the VectorField.
If there is only one entry in the VectorField then it is cleared. OnChanged() is called on the moved entry, as it may have changed before the call to Remove().
Definition at line 247 of file resourceholder.h.
|
inline |
If the index i is valid, sets the value at index i and tells the resource what has changed.
If the index is not valid, an error message is logged. Returns whether the set occurred.
Definition at line 282 of file resourceholder.h.
References value.