Variable Class Reference

This class is used to define a Variable object. More...

#include <Variable.h>

Collaboration diagram for Variable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Variable ()
 Default constructor.
 Variable (std::string sName, double dLowerVariableBound, double dUpperVariableBound, double dReferenceValue=0.0)
 This constructor requires 3 parameters :
  • the name of the variable
  • the lower variable bound value
  • the upper variable bound value ModelId=43834ABD0280.

virtual ~Variable ()
 Destructor.
virtual void setValue (double dNewValue)
 Change the value of the variable.
virtual void setUncheckValue (double dNewValue)
 Change the value of the variable without checking the boundaries conditions.
virtual double getValue () const
 Return the value of the variable.
virtual void setName (std::string sNewName)
 Set the name of the variable.
virtual std::string getName () const
 Return the name of the variable.
virtual BoundgetBound ()
 Return a reference to the variable bound
Exceptions:
This method throw a NullPointerException exception if the bound is null.

virtual void printInfos ()
 Print infos about Variable object
Used mainly in DEBUG mode.
void changeBound (Bound *mNewBound)
 Change the bound value of the variable with the mNewBound values.
double getReferenceValue () const
virtual void setSimulatedValue (double dSimulatedNewValue)
 Change the Simulated value of the variable.
virtual double getSimulatedValue () const
 Return the Simulated value of the variable.

Private Attributes

std::string _sName
double _dValue
double _dSimulatedValue
Bound_mBound
double _dReferenceValue

Detailed Description

This class is used to define a Variable object.

Definition at line 21 of file Variable.h.


Constructor & Destructor Documentation

Variable::Variable  ) 
 

Default constructor.

Definition at line 16 of file Variable.cpp.

00017 {
00018 
00019 }

Variable::Variable std::string  sName,
double  dLowerVariableBound,
double  dUpperVariableBound,
double  dReferenceValue = 0.0
 

This constructor requires 3 parameters :

  • the name of the variable
  • the lower variable bound value
  • the upper variable bound value ModelId=43834ABD0280.

Definition at line 26 of file Variable.cpp.

References _mBound.

00026                                                                                                                : 
00027 _sName(sName),
00028 _dValue(-1.0),
00029 _dSimulatedValue(-1.0),
00030 _dReferenceValue(dReferenceValue)
00031 {
00032         _mBound = new Bound(sName,dLowerVariableBound,dUpperVariableBound);
00033 }

Variable::~Variable  )  [virtual]
 

Destructor.

Definition at line 37 of file Variable.cpp.

References _mBound.

00038 {
00039         if (_mBound) 
00040         {
00041                 delete _mBound;
00042                 _mBound = 0;
00043         }
00044 }


Member Function Documentation

void Variable::changeBound Bound mNewBound  ) 
 

Change the bound value of the variable with the mNewBound values.

Definition at line 139 of file Variable.cpp.

References _mBound, and Bound::setBound().

00140 {
00141         _mBound->setBound(mNewBound);
00142 }

Here is the call graph for this function:

Bound * Variable::getBound  )  [virtual]
 

Return a reference to the variable bound

Exceptions:
This method throw a NullPointerException exception if the bound is null.

ModelId=43834ABD0297

Definition at line 121 of file Variable.cpp.

References _mBound.

Referenced by setValue().

00122 {
00123         if (_mBound==0) throw NullPointerException("_mBound","Variable::getBound()",__FILE__,__LINE__);
00124         return _mBound;
00125 }

std::string Variable::getName  )  const [virtual]
 

Return the name of the variable.

Definition at line 113 of file Variable.cpp.

References _sName.

Referenced by printInfos(), and setValue().

00114 {
00115         return _sName;
00116 }

double Variable::getReferenceValue  )  const
 

Definition at line 74 of file Variable.cpp.

References _dReferenceValue.

00075 {
00076         return _dReferenceValue;
00077 }

double Variable::getSimulatedValue  )  const [virtual]
 

Return the Simulated value of the variable.

Definition at line 90 of file Variable.cpp.

References _dSimulatedValue.

00091 {
00092         return _dSimulatedValue;
00093 }

double Variable::getValue  )  const [virtual]
 

Return the value of the variable.

Definition at line 68 of file Variable.cpp.

References _dValue.

Referenced by printInfos().

00069 {
00070         return _dValue;
00071 }

void Variable::printInfos  )  [virtual]
 

Print infos about Variable object
Used mainly in DEBUG mode.

ModelId=43834ABD029C

Definition at line 131 of file Variable.cpp.

References _mBound, getName(), getValue(), and Bound::printInfos().

00132 {
00133         std::cout << "\n##### VARIABLE " << endl;
00134         std::cout << "\tVariable --> " << getName() << " : " << getValue() << std::endl;
00135         _mBound->printInfos(); 
00136 }

Here is the call graph for this function:

void Variable::setName std::string  sNewName  )  [virtual]
 

Set the name of the variable.

Definition at line 106 of file Variable.cpp.

References _sName.

00107 {
00108         _sName = sNewName;
00109 }

void Variable::setSimulatedValue double  dSimulatedNewValue  )  [virtual]
 

Change the Simulated value of the variable.

Definition at line 83 of file Variable.cpp.

References _dSimulatedValue.

00084 {
00085         _dSimulatedValue = dSimulatedNewValue;
00086 }

void Variable::setUncheckValue double  dNewValue  )  [virtual]
 

Change the value of the variable without checking the boundaries conditions.

Definition at line 61 of file Variable.cpp.

References _dValue.

00062 {
00063                 _dValue = dNewValue;
00064 }

void Variable::setValue double  dNewValue  )  [virtual]
 

Change the value of the variable.

Exceptions:
This method throw a ValueOutOfBoundException exception if the variable value is not in the allowed bound. ModelId=43834ABD028D

Definition at line 49 of file Variable.cpp.

References _dValue, _mBound, getBound(), Bound::getLowerBound(), getName(), and Bound::getUpperBound().

00050 {
00051 
00052         if ( getBound()->isInBound(dNewValue)) 
00053         {
00054                 _dValue = dNewValue;
00055         }
00056         else throw ValueOutOfBoundException(getName(),dNewValue,_mBound->getLowerBound(),_mBound->getUpperBound(),"Variable::setValue(double dNewValue)",__FILE__,__LINE__);    
00057 
00058 }

Here is the call graph for this function:


Member Data Documentation

double Variable::_dReferenceValue [private]
 

Definition at line 76 of file Variable.h.

Referenced by getReferenceValue().

double Variable::_dSimulatedValue [private]
 

Definition at line 71 of file Variable.h.

Referenced by getSimulatedValue(), and setSimulatedValue().

double Variable::_dValue [private]
 

Definition at line 69 of file Variable.h.

Referenced by getValue(), setUncheckValue(), and setValue().

Bound* Variable::_mBound [private]
 

Definition at line 74 of file Variable.h.

Referenced by changeBound(), getBound(), printInfos(), setValue(), Variable(), and ~Variable().

std::string Variable::_sName [private]
 

Definition at line 67 of file Variable.h.

Referenced by getName(), and setName().


The documentation for this class was generated from the following files:
Generated on Fri Jul 10 10:32:43 2009 for Utils Library by  doxygen 1.4.5