PGE API 0.4
PR00F's Game Engine full documentation
|
PR00F's Game Engine old-new variable class. More...
PR00F's Game Engine old-new variable class.
This class can remember its old (previous) value. Its current value is always its new value. Useful if you want to implement a mechanism that depends on comparison of old and new value, such as:
Definition at line 30 of file PgeOldNewValue.h.
#include <PgeOldNewValue.h>
Public Member Functions | |
PgeOldNewValue () | |
Constructs an object with both old and new values initialized to their default values based on their type. | |
PgeOldNewValue (const T &value) | |
Constructs an object with both old and new values as the given value. | |
const T & | getOld () const |
const T & | getNew () const |
bool | set (const T &value) |
Sets the given value as new value. | |
const std::chrono::time_point< std::chrono::steady_clock > & | getLastTimeNewValueChanged () const |
Returns the timestamp recorded when new (current) value was last updated, i.e. | |
bool | isDirty () const |
Dirty flag. | |
void | revert () |
Resets new value to be same as old value and clears dirty flag. | |
void | commit () |
Saves new value to old value and clears dirty flag. | |
bool | operator== (const T &other) const |
Equals to value-type. | |
bool | operator== (const PgeOldNewValue< T > &other) const |
Equals to. | |
bool | operator!= (const T &other) const |
Not equals to value-type. | |
bool | operator!= (const PgeOldNewValue< T > &other) const |
Not equals to. | |
PgeOldNewValue< T > & | PgeOldNewValue (const T &other) |
Assignment to value-type. | |
operator T () const | |
Conversion to value-type. | |
PgeOldNewValue< T > | operator+ (const T &other) const |
Addition. | |
PgeOldNewValue< T > | operator+ (const PgeOldNewValue< T > &other) const |
Addition. | |
PgeOldNewValue< T > & | operator+= (const T &other) |
Addition assignment. | |
PgeOldNewValue< T > & | operator+= (const PgeOldNewValue< T > &other) |
Addition assignment. | |
PgeOldNewValue< T > | operator- (const T &other) const |
Subtraction. | |
PgeOldNewValue< T > | operator- (const PgeOldNewValue< T > &other) const |
Subtraction. | |
PgeOldNewValue< T > & | operator-= (const T &other) |
Subtraction assignment. | |
PgeOldNewValue< T > & | operator-= (const PgeOldNewValue< T > &other) |
Subtraction assignment. | |
PgeOldNewValue< T > | operator* (const T &other) const |
Multiplication by scalar. | |
PgeOldNewValue< T > | operator* (const PgeOldNewValue< T > &other) const |
Multiplication by scalar. | |
PgeOldNewValue< T > & | operator*= (const T &other) |
Multiplication assignment. | |
PgeOldNewValue< T > & | operator*= (const PgeOldNewValue< T > &other) |
Multiplication assignment. | |
PgeOldNewValue< T > | operator/ (const T &other) const |
Division by scalar. | |
PgeOldNewValue< T > | operator/ (const PgeOldNewValue< T > &other) const |
Division by scalar. | |
PgeOldNewValue< T > & | operator/= (const T &other) |
Division assignment. | |
PgeOldNewValue< T > & | operator/= (const PgeOldNewValue< T > &other) |
Division assignment. | |
PgeOldNewValue< T > | operator% (const T &other) const |
Modulo division by scalar. | |
PgeOldNewValue< T > | operator% (const PgeOldNewValue< T > &other) const |
Modulo division by scalar. | |
PgeOldNewValue< T > & | operator%= (const T &other) |
Modulo division assignment. | |
PgeOldNewValue< T > & | operator%= (const PgeOldNewValue< T > &other) |
Modulo division assignment. | |
PgeOldNewValue< T > & | operator++ () |
Prefix increment. | |
PgeOldNewValue< T > | operator++ (int) |
Postfix increment. | |
PgeOldNewValue< T > & | operator-- () |
Prefix decrement. | |
PgeOldNewValue< T > | operator-- (int) |
Postfix decrement. | |
bool | set (const float &value) |
bool | set (const PureVector &value) |
Private Attributes | |
T | m_newValue |
T | m_oldValue |
std::chrono::time_point< std::chrono::steady_clock > | m_timeLastChange |
PgeOldNewValue< T >::PgeOldNewValue | ( | ) |
Constructs an object with both old and new values initialized to their default values based on their type.
By default dirty flag is cleared.
Definition at line 158 of file PgeOldNewValue.h.
|
explicit |
Constructs an object with both old and new values as the given value.
By default dirty flag is cleared.
Definition at line 164 of file PgeOldNewValue.h.
PgeOldNewValue< T > & PgeOldNewValue< T >::PgeOldNewValue | ( | const T & | other | ) |
Assignment to value-type.
void PgeOldNewValue< T >::commit | ( | ) |
Saves new value to old value and clears dirty flag.
Does not alter getLastTimeNewValueChanged().
Definition at line 238 of file PgeOldNewValue.h.
|
inline |
Returns the timestamp recorded when new (current) value was last updated, i.e.
when its value was actually changed. Timestamp is recorded only for changes done by set() functions, assignment-, increment- and decrement operators.
Neither revert() nor commit() counts as an actual change to new (current) value. Construction also does not count as an actual change to new (current) value.
Note that constructing a new PgeOldNewValue instance from an existing also copies this timestamp, so the newly constructed PgeOldNewValue instance will have the same timestamp as the original has.
Definition at line 220 of file PgeOldNewValue.h.
|
inline |
Definition at line 176 of file PgeOldNewValue.h.
|
inline |
Definition at line 170 of file PgeOldNewValue.h.
|
inline |
Dirty flag.
Definition at line 226 of file PgeOldNewValue.h.
|
inline |
Conversion to value-type.
Definition at line 299 of file PgeOldNewValue.h.
|
inline |
Not equals to.
Definition at line 278 of file PgeOldNewValue.h.
|
inline |
Not equals to value-type.
Definition at line 268 of file PgeOldNewValue.h.
|
inline |
Modulo division by scalar.
Modulo division.
Definition at line 487 of file PgeOldNewValue.h.
|
inline |
Modulo division by scalar.
Modulo division.
Definition at line 477 of file PgeOldNewValue.h.
|
inline |
Modulo division assignment.
Definition at line 508 of file PgeOldNewValue.h.
|
inline |
Modulo division assignment.
Definition at line 497 of file PgeOldNewValue.h.
|
inline |
Multiplication by scalar.
Multiplication.
Definition at line 403 of file PgeOldNewValue.h.
|
inline |
Multiplication by scalar.
Multiplication.
Definition at line 393 of file PgeOldNewValue.h.
|
inline |
Multiplication assignment.
Definition at line 424 of file PgeOldNewValue.h.
|
inline |
Multiplication assignment.
Definition at line 413 of file PgeOldNewValue.h.
|
inline |
Addition.
Definition at line 319 of file PgeOldNewValue.h.
|
inline |
Addition.
Definition at line 309 of file PgeOldNewValue.h.
|
inline |
Prefix increment.
Definition at line 519 of file PgeOldNewValue.h.
|
inline |
Postfix increment.
Definition at line 531 of file PgeOldNewValue.h.
|
inline |
Addition assignment.
Definition at line 340 of file PgeOldNewValue.h.
|
inline |
Addition assignment.
Definition at line 329 of file PgeOldNewValue.h.
|
inline |
Subtraction.
Definition at line 361 of file PgeOldNewValue.h.
|
inline |
Subtraction.
Definition at line 351 of file PgeOldNewValue.h.
|
inline |
Prefix decrement.
Definition at line 544 of file PgeOldNewValue.h.
|
inline |
Postfix decrement.
Definition at line 556 of file PgeOldNewValue.h.
|
inline |
Subtraction assignment.
Definition at line 382 of file PgeOldNewValue.h.
|
inline |
Subtraction assignment.
Definition at line 371 of file PgeOldNewValue.h.
|
inline |
Division by scalar.
Division.
Definition at line 445 of file PgeOldNewValue.h.
|
inline |
Division by scalar.
Division.
Definition at line 435 of file PgeOldNewValue.h.
|
inline |
Division assignment.
Definition at line 466 of file PgeOldNewValue.h.
|
inline |
Division assignment.
Definition at line 455 of file PgeOldNewValue.h.
|
inline |
Equals to.
Definition at line 258 of file PgeOldNewValue.h.
|
inline |
Equals to value-type.
Definition at line 248 of file PgeOldNewValue.h.
void PgeOldNewValue< T >::revert | ( | ) |
Resets new value to be same as old value and clears dirty flag.
Does not alter getLastTimeNewValueChanged().
Definition at line 232 of file PgeOldNewValue.h.
|
inline |
Definition at line 194 of file PgeOldNewValue.h.
|
inline |
Definition at line 206 of file PgeOldNewValue.h.
bool PgeOldNewValue< T >::set | ( | const T & | value | ) |
Sets the given value as new value.
Definition at line 182 of file PgeOldNewValue.h.
|
private |
Definition at line 131 of file PgeOldNewValue.h.
|
private |
Definition at line 132 of file PgeOldNewValue.h.
|
private |
Definition at line 134 of file PgeOldNewValue.h.