Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
UpdateSeq Class Reference

This is a sequence number that increments monotonically. More...

#include "updateSeq.h"

Public Member Functions

constexpr UpdateSeq ()
 Creates an UpdateSeq in the 'initial' state.
 
constexpr UpdateSeq (const UpdateSeq &&from) noexcept
 
 UpdateSeq (const UpdateSeq &copy)
 
void clear ()
 Resets the UpdateSeq to the 'initial' state.
 
AtomicAdjust::Integer get_seq () const
 
bool is_fresh () const
 Returns true if the UpdateSeq is in the 'fresh' state.
 
bool is_initial () const
 Returns true if the UpdateSeq is in the 'initial' state.
 
bool is_old () const
 Returns true if the UpdateSeq is in the 'old' state.
 
bool is_special () const
 Returns true if the UpdateSeq is in any special states, i.e.
 
bool operator!= (const UpdateSeq &other) const
 
UpdateSeq operator++ ()
 
UpdateSeq operator++ (int)
 
bool operator< (const UpdateSeq &other) const
 
bool operator<= (const UpdateSeq &other) const
 
UpdateSeqoperator= (const UpdateSeq &copy)
 
bool operator== (const UpdateSeq &other) const
 
bool operator> (const UpdateSeq &other) const
 
bool operator>= (const UpdateSeq &other) const
 
void output (std::ostream &out) const
 

Static Public Member Functions

static constexpr UpdateSeq fresh ()
 
static constexpr UpdateSeq initial ()
 
static constexpr UpdateSeq old ()
 

Public Attributes

 get_seq
 Returns the internal integer value associated with the UpdateSeq.
 

Detailed Description

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.

Definition at line 37 of file updateSeq.h.

Constructor & Destructor Documentation

◆ UpdateSeq() [1/3]

constexpr UpdateSeq::UpdateSeq ( )
constexpr

Creates an UpdateSeq in the 'initial' state.

Definition at line 24 of file updateSeq.I.

◆ UpdateSeq() [2/3]

UpdateSeq::UpdateSeq ( const UpdateSeq & copy)
inline

Definition at line 31 of file updateSeq.I.

◆ UpdateSeq() [3/3]

constexpr UpdateSeq::UpdateSeq ( const UpdateSeq && from)
constexprnoexcept

Definition at line 38 of file updateSeq.I.

Member Function Documentation

◆ clear()

void UpdateSeq::clear ( )
inline

Resets the UpdateSeq to the 'initial' state.

Definition at line 54 of file updateSeq.I.

References AtomicAdjustDummyImpl::set().

◆ fresh()

static constexpr UpdateSeq UpdateSeq::fresh ( )
inlinestaticconstexpr

Definition at line 45 of file updateSeq.h.

◆ initial()

static constexpr UpdateSeq UpdateSeq::initial ( )
inlinestaticconstexpr

Definition at line 43 of file updateSeq.h.

◆ is_fresh()

bool UpdateSeq::is_fresh ( ) const
inline

Returns true if the UpdateSeq is in the 'fresh' state.

Definition at line 78 of file updateSeq.I.

References AtomicAdjustDummyImpl::get().

◆ is_initial()

bool UpdateSeq::is_initial ( ) const
inline

Returns true if the UpdateSeq is in the 'initial' state.

Definition at line 62 of file updateSeq.I.

References AtomicAdjustDummyImpl::get().

◆ is_old()

bool UpdateSeq::is_old ( ) const
inline

Returns true if the UpdateSeq is in the 'old' state.

Definition at line 70 of file updateSeq.I.

References AtomicAdjustDummyImpl::get().

◆ is_special()

bool UpdateSeq::is_special ( ) const
inline

Returns true if the UpdateSeq is in any special states, i.e.

'initial', 'old', or 'fresh'.

Definition at line 87 of file updateSeq.I.

References AtomicAdjustDummyImpl::get().

◆ old()

static constexpr UpdateSeq UpdateSeq::old ( )
inlinestaticconstexpr

Definition at line 44 of file updateSeq.h.

◆ operator!=()

bool UpdateSeq::operator!= ( const UpdateSeq & other) const
inline

Definition at line 104 of file updateSeq.I.

◆ operator++() [1/2]

UpdateSeq UpdateSeq::operator++ ( )
inline

Definition at line 144 of file updateSeq.I.

◆ operator++() [2/2]

UpdateSeq UpdateSeq::operator++ ( int )
inline

Definition at line 177 of file updateSeq.I.

◆ operator<()

bool UpdateSeq::operator< ( const UpdateSeq & other) const
inline

Definition at line 112 of file updateSeq.I.

◆ operator<=()

bool UpdateSeq::operator<= ( const UpdateSeq & other) const
inline

Definition at line 120 of file updateSeq.I.

◆ operator=()

UpdateSeq & UpdateSeq::operator= ( const UpdateSeq & copy)
inline

Definition at line 45 of file updateSeq.I.

◆ operator==()

bool UpdateSeq::operator== ( const UpdateSeq & other) const
inline

Definition at line 96 of file updateSeq.I.

◆ operator>()

bool UpdateSeq::operator> ( const UpdateSeq & other) const
inline

Definition at line 128 of file updateSeq.I.

◆ operator>=()

bool UpdateSeq::operator>= ( const UpdateSeq & other) const
inline

Definition at line 136 of file updateSeq.I.

◆ output()

void UpdateSeq::output ( std::ostream & out) const
inline

Definition at line 221 of file updateSeq.I.

Member Data Documentation

◆ get_seq

AtomicAdjust::Integer UpdateSeq::get_seq
inline

Returns the internal integer value associated with the UpdateSeq.

Useful for debugging only.

Definition at line 69 of file updateSeq.h.


The documentation for this class was generated from the following files: