# DynamicVariable Class Reference

Abstract base class for variables with a value which is recalculated when the precision has changed. More...

`#include <Variable.h>`

Inheritance diagram for DynamicVariable:

List of all members.

## Public Member Functions

| DynamicVariable (string cat_, string name_, string title_="", bool is_local=false, bool is_builtin=true, bool is_active=true)
| DynamicVariable (const DynamicVariable *variable)
ExpressionItem * | copy () const =0
void | set (const ExpressionItem *item)
const MathStructure & | get ()
void | set (const MathStructure &o)
void | set (string expression_)
int | calculatedPrecision () const
virtual bool | representsPositive (bool=false)
virtual bool | representsNegative (bool=false)
virtual bool | representsNonNegative (bool=false)
virtual bool | representsNonPositive (bool=false)
virtual bool | representsInteger (bool=false)
virtual bool | representsNumber (bool=false)
virtual bool | representsRational (bool=false)
virtual bool | representsReal (bool=false)
virtual bool | representsComplex (bool=false)
virtual bool | representsNonZero (bool=false)
virtual bool | representsEven (bool=false)
virtual bool | representsOdd (bool=false)
virtual bool | representsUndefined (bool=false, bool=false, bool=false)
virtual bool | representsBoolean ()
virtual bool | representsNonMatrix ()

## Protected Member Functions

virtual void | calculate () const =0

## Detailed Description

Abstract base class for variables with a value which is recalculated when the precision has changed.

## Member Function Documentation

const MathStructure& DynamicVariable::get | ( |  | ) | `[virtual]`

Returns the value of the variable. If no value is set or parsed and an expression is set, the expression is parsed and resulting value returned.

Returns:
  The value of the variable..

Reimplemented from KnownVariable.

void DynamicVariable::set | ( | const MathStructure & | o | ) | `[virtual]`

Sets the value of the variable. If expression is set, it is cleared.

Parameters:

  | o | Value.

Reimplemented from KnownVariable.

void DynamicVariable::set | ( | string | expression_ | ) | `[virtual]`

Sets the text string expression of the variable. The value is cleared.

Parameters:

  | expression_ | Expression.

Reimplemented from KnownVariable.

int DynamicVariable::calculatedPrecision | ( |  | ) | const

Returns the precision of the calculated value.

Returns:
  Precision of the calculated value or zero if the value has not yet been calculated.

virtual bool DynamicVariable::representsPositive | ( | bool | = `false` | ) | `[inline, virtual]`

Returns if the variable represents a positive value.

Reimplemented from KnownVariable.

The documentation for this class was generated from the following file:

- libqalculate/Variable.h