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

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() [1/5]

ChangeTracker::ChangeTracker ( bool *  c = 0)
inline

◆ ChangeTracker() [2/5]

ChangeTracker::ChangeTracker ( bool &  c)
inline

◆ ChangeTracker() [3/5]

ChangeTracker::ChangeTracker ( unsigned int &  c)
inline

◆ ChangeTracker() [4/5]

ChangeTracker::ChangeTracker ( unsigned int *  c)
inline

◆ ChangeTracker() [5/5]

ChangeTracker::ChangeTracker ( bool &  c,
unsigned int &  ci 
)
inline

Member Function Documentation

◆ boolVar()

const bool& ChangeTracker::boolVar ( ) const
inline

Don't call if !hasBoolVar()

◆ changeId()

unsigned int ChangeTracker::changeId ( ) const
inline

◆ hasBoolVar()

bool ChangeTracker::hasBoolVar ( ) const
inline

◆ hasIntVar()

bool ChangeTracker::hasIntVar ( ) const
inline

◆ intVar()

const unsigned int& ChangeTracker::intVar ( ) const
inline

Don't call if !hasIntVar()

◆ isChanged()

bool ChangeTracker::isChanged ( ) const
inline

◆ set() [1/2]

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

specialization for C-strings

◆ set() [2/2]

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

returns wether this value is changed

◆ setChanged()

void ChangeTracker::setChanged ( bool  yn = true)
inline

◆ setChangeId()

void ChangeTracker::setChangeId ( unsigned int  c)
inline

◆ setVar() [1/4]

void ChangeTracker::setVar ( bool &  m)
inline

◆ setVar() [2/4]

void ChangeTracker::setVar ( bool *  m)
inline

◆ setVar() [3/4]

void ChangeTracker::setVar ( unsigned int &  m)
inline

◆ setVar() [4/4]

void ChangeTracker::setVar ( unsigned int *  m)
inline

◆ update()

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

◆ chgd_

bool* ChangeTracker::chgd_
protected

◆ chgid_

unsigned int* ChangeTracker::chgid_
protected

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