This is a sequence number that increments monotonically. More...
Public Member Functions | |
UpdateSeq () | |
Creates an UpdateSeq in the 'initial' state. | |
UpdateSeq (UpdateSeq const copy) | |
clear () | |
Resets the UpdateSeq to the 'initial' state. | |
bool | isFresh () |
Returns true if the UpdateSeq is in the 'fresh' state. | |
bool | isInitial () |
Returns true if the UpdateSeq is in the 'initial' state. | |
bool | isOld () |
Returns true if the UpdateSeq is in the 'old' state. | |
bool | isSpecial () |
Returns true if the UpdateSeq is in any special states, i.e. | |
bool | operator!= (UpdateSeq const other) |
UpdateSeq | operator++ () |
UpdateSeq | operator++ (int) |
bool | operator< (UpdateSeq const other) |
bool | operator<= (UpdateSeq const other) |
UpdateSeq | operator= (UpdateSeq const copy) |
bool | operator== (UpdateSeq const other) |
bool | operator> (UpdateSeq const other) |
bool | operator>= (UpdateSeq const other) |
output (ostream out) | |
Static Public Member Functions | |
static UpdateSeq | fresh () |
Returns an UpdateSeq in the 'fresh' state. | |
static UpdateSeq | initial () |
Returns an UpdateSeq in the 'initial' state. | |
static UpdateSeq | old () |
Returns an UpdateSeq in the 'old' state. |
This is a sequence number that increments monotonically.
It can be used to track cache updates, or serve as a kind of timestamp for any changing properties.
A special class is used instead of simply an int, so we can elegantly handle such things as wraparound and special cases. There are two special cases. Firstly, a sequence number is 'initial' when it is first created. This sequence is older than any other sequence number. Secondly, a sequence number may be explicitly set to 'old'. This is older than any other sequence number except 'initial'. Finally, we have the explicit number 'fresh', which is newer than any other sequence number. All other sequences are numeric and are monotonically increasing.
bool isSpecial | ( | ) |
Returns true if the UpdateSeq is in any special states, i.e.
'initial', 'old', or 'fresh'.
bool operator!= | ( | UpdateSeq const | other | ) |
UpdateSeq operator++ | ( | ) |
bool operator< | ( | UpdateSeq const | other | ) |
bool operator<= | ( | UpdateSeq const | other | ) |
bool operator== | ( | UpdateSeq const | other | ) |
bool operator> | ( | UpdateSeq const | other | ) |
bool operator>= | ( | UpdateSeq const | other | ) |