Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

vlNameValuePair< DataType > Class Template Reference

This class provides a storage for a variable. More...

#include <vlnamevaluepair.h>

Inheritance diagram for vlNameValuePair< DataType >:

vlNameValuePairBase List of all members.

Public Member Functions

 vlNameValuePair (const DataType &def, const std::string &name, const std::string &desc, const bool valid=true)
 Default constructor.

 vlNameValuePair (const DataType &def, const std::list< DataType > &validValues, const std::string &name, const std::string &desc, const bool valid=true)
 Constructor which allows you to specify a set of valid values.

 vlNameValuePair (const DataType &def, const DataType &lowerBound, const DataType &upperBound, const std::string &name, const std::string &desc, const bool valid=true)
 Constructor which allows you to specify a valid value range for the variable.

 ~vlNameValuePair ()
 Desctructor.

DataType get () const
 Returns the value of the variable.

const DataType * getPtr () const
 Returns a const pointer to the value.

DataType * getPtrRW ()
 Returns a non-const pointer to the value.

const std::list< DataType > * getValidValues () const
 Returns the list of valid values for the variable.

const std::pair< DataType,
DataType > * 
getValidRange () const
 Returns the range of valid values for the variable.

void set (const DataType &value)
 Sets the value for the variable.

void setValidValues (const std::list< DataType > &validList)
 Sets a list of valid values for the the variable.

void setValidRange (const DataType &lowerBound, const DataType &upperBound)
 Sets a range that is valid for the variable.

void resetValidValues () const
 Resets the valid values.

void resetValidRange () const
 Resets the valid value range.

std::string name () const
 Returns the short name of the variable.

std::string desc () const
 Returns the description of the variable.

const char * typeInfo () const
 Returns the typeinfo name of the datatype.

bool isDirty () const
 Returns true if data is dirty.

void resetDirty ()
 Reset the dirty flag.

bool isValid () const
 Returns the state of the valid flag.

void setValid (bool valid=true)
 Sets the state of the valid flag.

vlNameValuePairBasecopySelf () const
 Provide a copy of self.


Private Attributes

DataType m_value
 Value stored.

std::list< DataType > m_validValues
 Optional list of valid values for this variable.

std::pair< DataType, DataType > m_validRange
 Optional range of valid values for this variable.

std::string m_name
 Single word, short name for the variable.

std::string m_desc
 Some description of the variable.

bool m_dirty
 Dirty bit for the data.

bool m_valid
 Set to true if the data is (logically) valid.

bool m_validRangeSet
 Set to true when a valid range is set.


Detailed Description

template<class DataType>
class vlNameValuePair< DataType >

Each variable is stored as a name - value pair. That is, each variable has a name associated with it along with the value.

Author:
Sarang Lakare <sarang@users.sf.net>
See also:
vlNameValuePairContainer

Definition at line 105 of file vlnamevaluepair.h.


Constructor & Destructor Documentation

template<class DataType>
vlNameValuePair< DataType >::vlNameValuePair const DataType &  def,
const std::string &  name,
const std::string &  desc,
const bool  valid = true
 

Definition at line 253 of file vlnamevaluepair.h.

References name.

template<class DataType>
vlNameValuePair< DataType >::vlNameValuePair< DataType > const DataType &  def,
const std::list< DataType > &  validValues,
const std::string &  name,
const std::string &  desc,
const bool  valid = true
 

template<class DataType>
vlNameValuePair< DataType >::vlNameValuePair< DataType > const DataType &  def,
const DataType &  lowerBound,
const DataType &  upperBound,
const std::string &  name,
const std::string &  desc,
const bool  valid = true
 

template<class DataType>
vlNameValuePair< DataType >::~vlNameValuePair  ) 
 

Definition at line 297 of file vlnamevaluepair.h.


Member Function Documentation

template<class DataType>
vlNameValuePairBase * vlNameValuePair< DataType >::copySelf  )  const [virtual]
 

Implements vlNameValuePairBase.

Definition at line 304 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_desc, vlNameValuePair< DataType >::m_name, vlNameValuePair< DataType >::m_value, and vlNameValuePair< DataType >::resetDirty().

template<class DataType>
std::string vlNameValuePair< DataType >::desc  )  const [inline, virtual]
 

Implements vlNameValuePairBase.

Definition at line 190 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_desc.

template<class DataType>
DataType vlNameValuePair< DataType >::get  )  const [inline]
 

Definition at line 126 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_value.

Referenced by vlVarList::get().

template<class DataType>
const DataType* vlNameValuePair< DataType >::getPtr  )  const [inline]
 

Definition at line 129 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_value.

Referenced by vlVarList::getPtr().

template<class DataType>
DataType* vlNameValuePair< DataType >::getPtrRW  )  [inline]
 

Definition at line 132 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_value.

Referenced by vlVarList::getPtrRW().

template<class DataType>
const std::pair<DataType, DataType>* vlNameValuePair< DataType >::getValidRange  )  const [inline]
 

Definition at line 144 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_validRange, and vlNameValuePair< DataType >::m_validRangeSet.

Referenced by vlVarList::getValidRange().

template<class DataType>
const std::list<DataType>* vlNameValuePair< DataType >::getValidValues  )  const [inline]
 

Definition at line 135 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_validValues.

Referenced by vlVarList::getValidValues().

template<class DataType>
bool vlNameValuePair< DataType >::isDirty  )  const [inline, virtual]
 

The dirty bit is set with every call to set() and is reset every time get() is called. This can be used to track modifications to the data.

Returns:
true or false

Implements vlNameValuePairBase.

Definition at line 206 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_dirty.

template<class DataType>
bool vlNameValuePair< DataType >::isValid  )  const [inline, virtual]
 

This valid flag indicates if the data is logically valid. The setting and resetting of this flag is thus in the hands of the user. By default, it is set to true.

Implements vlNameValuePairBase.

Definition at line 216 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_valid.

Referenced by vlVarList::get(), vlVarList::getPtr(), and vlVarList::getPtrRW().

template<class DataType>
std::string vlNameValuePair< DataType >::name  )  const [inline, virtual]
 

Implements vlNameValuePairBase.

Definition at line 187 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_name.

template<class DataType>
void vlNameValuePair< DataType >::resetDirty  )  [inline, virtual]
 

Implements vlNameValuePairBase.

Definition at line 209 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_dirty.

Referenced by vlNameValuePair< DataType >::copySelf().

template<class DataType>
void vlNameValuePair< DataType >::resetValidRange  )  const [inline]
 

Definition at line 184 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_validRangeSet.

Referenced by vlNameValuePair< DataType >::setValidValues().

template<class DataType>
void vlNameValuePair< DataType >::resetValidValues  )  const [inline]
 

Definition at line 181 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_validValues.

Referenced by vlNameValuePair< DataType >::setValidRange().

template<class DataType>
void vlNameValuePair< DataType >::set const DataType &  value  )  [inline]
 

Parameters:
value the value to set to the variable
Returns:
true if set() was successful, false otherwise

Definition at line 158 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_dirty, and vlNameValuePair< DataType >::m_value.

Referenced by vlVarList::set().

template<class DataType>
void vlNameValuePair< DataType >::setValid bool  valid = true  )  [inline, virtual]
 

Implements vlNameValuePairBase.

Definition at line 219 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_valid.

Referenced by vlVarList::set().

template<class DataType>
void vlNameValuePair< DataType >::setValidRange const DataType &  lowerBound,
const DataType &  upperBound
[inline]
 

Definition at line 174 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_validRange, vlNameValuePair< DataType >::m_validRangeSet, and vlNameValuePair< DataType >::resetValidValues().

template<class DataType>
void vlNameValuePair< DataType >::setValidValues const std::list< DataType > &  validList  )  [inline]
 

Definition at line 163 of file vlnamevaluepair.h.

References vlNameValuePair< DataType >::m_validValues, and vlNameValuePair< DataType >::resetValidRange().

template<class DataType>
const char* vlNameValuePair< DataType >::typeInfo  )  const [inline, virtual]
 

This is the best way to compare all datatypes. Note that datatype names are not constant across compilers.

Implements vlNameValuePairBase.

Definition at line 197 of file vlnamevaluepair.h.


Member Data Documentation

template<class DataType>
std::string vlNameValuePair< DataType >::m_desc [private]
 

Definition at line 238 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::copySelf(), and vlNameValuePair< DataType >::desc().

template<class DataType>
bool vlNameValuePair< DataType >::m_dirty [private]
 

Definition at line 241 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::isDirty(), vlNameValuePair< DataType >::resetDirty(), and vlNameValuePair< DataType >::set().

template<class DataType>
std::string vlNameValuePair< DataType >::m_name [private]
 

Definition at line 235 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::copySelf(), and vlNameValuePair< DataType >::name().

template<class DataType>
bool vlNameValuePair< DataType >::m_valid [private]
 

Definition at line 244 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::isValid(), and vlNameValuePair< DataType >::setValid().

template<class DataType>
std::pair<DataType, DataType> vlNameValuePair< DataType >::m_validRange [private]
 

Definition at line 232 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::getValidRange(), and vlNameValuePair< DataType >::setValidRange().

template<class DataType>
bool vlNameValuePair< DataType >::m_validRangeSet [private]
 

Definition at line 247 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::getValidRange(), vlNameValuePair< DataType >::resetValidRange(), and vlNameValuePair< DataType >::setValidRange().

template<class DataType>
std::list<DataType> vlNameValuePair< DataType >::m_validValues [private]
 

Definition at line 229 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::getValidValues(), vlNameValuePair< DataType >::resetValidValues(), and vlNameValuePair< DataType >::setValidValues().

template<class DataType>
DataType vlNameValuePair< DataType >::m_value [private]
 

Definition at line 226 of file vlnamevaluepair.h.

Referenced by vlNameValuePair< DataType >::copySelf(), vlNameValuePair< DataType >::get(), vlNameValuePair< DataType >::getPtr(), vlNameValuePair< DataType >::getPtrRW(), and vlNameValuePair< DataType >::set().


The documentation for this class was generated from the following file:
Generated on Fri Mar 18 11:33:18 2005 for OpenVL by doxygen 1.3.3