muParserX 2.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mup::Value Class Reference

Value class of muParserX. More...

#include <mpValue.h>

Inheritance diagram for mup::Value:
Inheritance graph
[legend]
Collaboration diagram for mup::Value:
Collaboration graph
[legend]

Public Member Functions

 Value (char_type cType='v')
 Construct an empty value object of a given type.
 
 Value (int_type m, int_type n, float_type v)
 Create a m x n matrix.
 
virtual IValueAt (const IValue &row, const IValue &col) override
 Return the matrix element at row col.
 
virtual IValueoperator*= (const IValue &val) override
 Assign a value with multiplication.
 
virtual char_type GetType () const override
 Returns a character representing the type of this value instance.
 
virtual int_type GetInteger () const override
 Return the value as an integer.
 
virtual float_type GetImag () const override
 Get the imaginary part of the value.
 
virtual const cmplx_typeGetComplex () const override
 Returns this value as a complex number.
 
- Public Member Functions inherited from mup::IValue
int GetDim () const
 Returns the dimension of the value represented by a value object.
 
bool IsNonComplexScalar () const
 Returns true if the type is either floating point or interger.
 
bool IsScalar () const
 Returns true if the type is not a vector and not a string.
 
bool IsScalarOrBool () const
 Returns true if this value represents a scalar value or a boolean value.
 
bool IsInteger () const
 Returns true if this value is a noncomplex integer.
 
bool IsMatrix () const
 Returns true if this value is an array.
 
bool IsComplex () const
 Returns true if this value is a complex value.
 
bool IsString () const
 Returns true if this value is a string value.
 
- Public Member Functions inherited from mup::IToken
ECmdCode GetCode () const
 return the token code.
 
const string_typeGetIdent () const
 Return the token identifier string.
 

Additional Inherited Members

- Protected Member Functions inherited from mup::IToken
virtual ~IToken ()
 Destructor (trivial).
 
 IToken (const IToken &ref)
 Copy constructor.
 

Detailed Description

Value class of muParserX.

This class represents a value to be used with muParserX. It's a Variant like class able to store a variety of types.

Constructor & Destructor Documentation

◆ Value()

mup::Value::Value ( char_type cType = 'v')
explicit

Construct an empty value object of a given type.

Parameters
cTypeThe type of the value to construct (default='v').
Here is the call graph for this function:

Member Function Documentation

◆ At()

IValue & mup::Value::At ( const IValue & row,
const IValue & col )
overridevirtual

Return the matrix element at row col.

Row and col are the indices of the matrix. If this element does not represent a matrix row and col must be 0 otherwise an index out of bound error is thrown.

Implements mup::IValue.

◆ GetComplex()

const cmplx_type & mup::Value::GetComplex ( ) const
overridevirtual

Returns this value as a complex number.

Exceptions
nothrow

If the value instance does not represent a complex value the returned value is undefined. No exception is triggered. If you are unsure about the type use IsComplex() or GetType() to verify the type.

Implements mup::IValue.

◆ GetImag()

float_type mup::Value::GetImag ( ) const
overridevirtual

Get the imaginary part of the value.

Exceptions
ParserErrorin case this value represents a string or a matrix

Implements mup::IValue.

Here is the call graph for this function:

◆ GetInteger()

int_type mup::Value::GetInteger ( ) const
overridevirtual

Return the value as an integer.

This function should only be called if you really need an integer value and want to make sure your either get one or throw an exception if the value can not be implicitely converted into an integer.

Implements mup::IValue.

Here is the call graph for this function:

◆ GetType()

char_type mup::Value::GetType ( ) const
overridevirtual

Returns a character representing the type of this value instance.

Returns
m_cType Either one of 'c' for comlex, 'i' for integer, 'f' for floating point, 'b' for boolean, 's' for string or 'm' for matrix values.

Implements mup::IValue.

◆ operator*=()

IValue & mup::Value::operator*= ( const IValue & val)
overridevirtual

Assign a value with multiplication.

Parameters
valThe value to multiply to this

When multiplying to values with each value representing a matrix type the result is checked whether it is a 1 x 1 matrix. If so the value is "unboxed" and stored directly in this value object. It is no longer treated as a matrix internally.

Implements mup::IValue.

Here is the call graph for this function:


muParserX documentation - (C) 2010 Ingo Berg