Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

UpdateSeq Class Reference

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

#include <updateSeq.h>

List of all members.

Public Member Functions

 UpdateSeq ()
 Creates an UpdateSeq in the 'initial' state.

 UpdateSeq (const UpdateSeq &copy)
UpdateSeq & operator= (const UpdateSeq &copy)
void clear ()
 Resets the UpdateSeq to the 'initial' 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_fresh () const
 Returns true if the UpdateSeq is in the 'fresh' state.

bool is_special () const
 Returns true if the UpdateSeq is in any special states, i.e.

bool operator== (const UpdateSeq &other) const
bool operator!= (const UpdateSeq &other) const
bool operator< (const UpdateSeq &other) const
bool operator<= (const UpdateSeq &other) const
UpdateSeq operator++ ()
UpdateSeq operator++ (int)
void output (ostream &out) const

Static Public Member Functions

UpdateSeq initial ()
 Returns an UpdateSeq in the 'initial' state.

UpdateSeq old ()
 Returns an UpdateSeq in the 'old' state.

UpdateSeq fresh ()
 Returns an UpdateSeq in the 'fresh' state.


Private Types

enum  SpecialCases { SC_initial = 0, SC_old = 1, SC_fresh = ~0 }

Private Attributes

unsigned int _seq


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 64 of file updateSeq.h.


Member Enumeration Documentation

enum UpdateSeq::SpecialCases [private]
 

Enumeration values:
SC_initial 
SC_old 
SC_fresh 

Definition at line 92 of file updateSeq.h.


Constructor & Destructor Documentation

UpdateSeq::UpdateSeq  )  [inline]
 

Creates an UpdateSeq in the 'initial' state.

Definition at line 32 of file updateSeq.I.

References INLINE.

UpdateSeq::UpdateSeq const UpdateSeq &  copy  )  [inline]
 

Definition at line 87 of file updateSeq.I.

References _seq, INLINE, and SC_initial.


Member Function Documentation

void UpdateSeq::clear void   )  [inline]
 

Resets the UpdateSeq to the 'initial' state.

Definition at line 113 of file updateSeq.I.

References _seq, and SC_old.

UpdateSeq UpdateSeq::fresh  )  [inline, static]
 

Returns an UpdateSeq in the 'fresh' state.

Definition at line 73 of file updateSeq.I.

References _seq, and INLINE.

UpdateSeq UpdateSeq::initial  )  [inline, static]
 

Returns an UpdateSeq in the 'initial' state.

Definition at line 45 of file updateSeq.I.

References _seq, INLINE, and SC_old.

bool UpdateSeq::is_fresh  )  const [inline]
 

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

Definition at line 156 of file updateSeq.I.

References _seq, and INLINE.

bool UpdateSeq::is_initial  )  const [inline]
 

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

Definition at line 128 of file updateSeq.I.

References INLINE, SC_fresh, SC_initial, and SC_old.

bool UpdateSeq::is_old  )  const [inline]
 

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

Definition at line 141 of file updateSeq.I.

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 171 of file updateSeq.I.

References _seq, and INLINE.

UpdateSeq UpdateSeq::old  )  [inline, static]
 

Returns an UpdateSeq in the 'old' state.

Definition at line 58 of file updateSeq.I.

References _seq, and SC_fresh.

bool UpdateSeq::operator!= const UpdateSeq &  other  )  const [inline]
 

Definition at line 203 of file updateSeq.I.

References _seq, and SC_old.

UpdateSeq UpdateSeq::operator++ int   )  [inline]
 

Definition at line 265 of file updateSeq.I.

UpdateSeq UpdateSeq::operator++  )  [inline]
 

Definition at line 246 of file updateSeq.I.

References INLINE, and output().

Referenced by operator<().

bool UpdateSeq::operator< const UpdateSeq &  other  )  const [inline]
 

Definition at line 215 of file updateSeq.I.

References INLINE, and operator++().

bool UpdateSeq::operator<= const UpdateSeq &  other  )  const [inline]
 

Definition at line 234 of file updateSeq.I.

References _seq, SC_fresh, and SC_old.

UpdateSeq & UpdateSeq::operator= const UpdateSeq &  copy  )  [inline]
 

Definition at line 99 of file updateSeq.I.

References _seq, INLINE, and SC_initial.

bool UpdateSeq::operator== const UpdateSeq &  other  )  const [inline]
 

Definition at line 191 of file updateSeq.I.

void UpdateSeq::output ostream &  out  )  const [inline]
 

Definition at line 279 of file updateSeq.I.

Referenced by operator++().


Member Data Documentation

unsigned int UpdateSeq::_seq [private]
 

Definition at line 98 of file updateSeq.h.

Referenced by clear(), fresh(), initial(), is_fresh(), is_special(), old(), operator!=(), operator<=(), operator=(), and UpdateSeq().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:56:02 2003 for Panda by doxygen1.3