Public Member Functions | Protected Attributes

ChangeTracker Class Reference

updates a variable when changes occur. More...

List of all members.

Public Member Functions

 ChangeTracker (bool *c=0)
 ChangeTracker (bool &c)
 ChangeTracker (unsigned int &c)
 ChangeTracker (unsigned int *c)
 ChangeTracker (bool &c, unsigned int &ci)
template<class T , class U >
bool set (const T &oldval, const U &newval)
 returns wether this value is changed
template<class T , class U >
bool update (T &val, const U &newval)
 Changes and returns wether this value is changed.
bool set (const char *&, const char *&)
 specialisation for C-strings
bool update (char *&, const char *&)
 specialisation for C-strings
bool isChanged () const
unsigned int changeId () const
void setChanged (bool yn=true)
void setChangeId (unsigned int c)
bool hasBoolVar () const
bool hasIntVar () const
const bool & boolVar () const
 Don't call if !hasBoolVar().
const unsigned int & intVar () const
 Don't call if !hasIntVar().
void setVar (bool *m)
void setVar (bool &m)
void setVar (unsigned int *m)
void setVar (unsigned int &m)

Protected Attributes

bool * chgd
unsigned int * chgid

Detailed Description

updates a variable when changes occur.

Use if you need to keep track of whether a variable changes when it is assigned to another variable. Example: a 'not saved' flag in a UI. Also facilitates Giving unique change stamps.


Constructor & Destructor Documentation

ChangeTracker::ChangeTracker ( bool *  c = 0  )  [inline]
ChangeTracker::ChangeTracker ( bool &  c  )  [inline]
ChangeTracker::ChangeTracker ( unsigned int &  c  )  [inline]
ChangeTracker::ChangeTracker ( unsigned int *  c  )  [inline]
ChangeTracker::ChangeTracker ( bool &  c,
unsigned int &  ci 
) [inline]

Member Function Documentation

const bool& ChangeTracker::boolVar (  )  const [inline]

Don't call if !hasBoolVar().

unsigned int ChangeTracker::changeId (  )  const [inline]
bool ChangeTracker::hasBoolVar (  )  const [inline]
bool ChangeTracker::hasIntVar (  )  const [inline]
const unsigned int& ChangeTracker::intVar (  )  const [inline]

Don't call if !hasIntVar().

bool ChangeTracker::isChanged (  )  const [inline]
template<class T , class U >
bool ChangeTracker::set ( const T &  oldval,
const U &  newval 
) [inline]

returns wether this value is changed

bool ChangeTracker::set ( const char *&  val,
const char *&  newval 
) [inline]

specialisation for C-strings

void ChangeTracker::setChanged ( bool  yn = true  )  [inline]
void ChangeTracker::setChangeId ( unsigned int  c  )  [inline]
void ChangeTracker::setVar ( unsigned int &  m  )  [inline]
void ChangeTracker::setVar ( bool *  m  )  [inline]
void ChangeTracker::setVar ( unsigned int *  m  )  [inline]
void ChangeTracker::setVar ( bool &  m  )  [inline]
bool ChangeTracker::update ( char *&  val,
const char *&  newval 
) [inline]

specialisation for C-strings

template<class T , class U >
bool ChangeTracker::update ( T &  val,
const U &  newval 
) [inline]

Changes and returns wether this value is changed.


Member Data Documentation

bool* ChangeTracker::chgd [protected]
unsigned int* ChangeTracker::chgid [protected]