OpendTect-6_4  6.4
Public Member Functions | Protected Attributes | List of all members
ChangeTracker Class Reference

Updates a variable when changes occur. More...

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 More...
 
template<class T , class U >
bool update (T &val, const U &newval)
 Changes and returns wether this value is changed. More...
 
bool set (const char *&, const char *&)
 specialisation for C-strings More...
 
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() More...
 
const unsigned int & intVar () const
 Don't call if !hasIntVar() More...
 
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 ( bool *  m)
inline
void ChangeTracker::setVar ( bool &  m)
inline
void ChangeTracker::setVar ( unsigned int *  m)
inline
void ChangeTracker::setVar ( unsigned int &  m)
inline
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

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019