idaeim studio
 PVL: Parameter Value Language

Public Member Functions | Static Public Member Functions
Real Class Reference

A Real implements a Value with a floating point datum. More...

#include <Value.hh>

Inheritance diagram for Real:
Inheritance graph
[legend]
Collaboration diagram for Real:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Realbase (const int)
 Prevents the base from being changed.
Realclone () const
 Constructs a clone of this Real.
int compare (const Value &value) const
 This Real is compared to another Value.
std::ios::fmtflags format_flags () const
 Gets the string representation format flags.
Realformat_flags (std::ios::fmtflags flags)
 Sets the string representation format flags.
bool is_Numeric () const
 Asserts that the Real is a NUMERIC Type.
bool is_Real () const
 Asserts that the Real is a REAL Type.
 operator int () const
 Casts the Real to an int type.
 operator Integer_type () const
 Casts the Real to an Integer_type type.
 operator Real_type () const
 Casts the Real to a Real_type.
 operator String_type () const
 Casts the Real to a String_type.
Real operator+ (const Value &value) const
 Adds this Real and another Value.
Realoperator+= (const Value &value)
 Adds another Value to this Value.
Realoperator= (const int value)
 Assigns an int type value to this Real.
Realoperator= (const unsigned int value)
 Assigns an unsigned int type value to this Real.
Realoperator= (const Integer_type value)
 Assigns an Integer_type value to this Real.
Realoperator= (const String_type &value)
 Assigns a string representation of a value to this Real.
Realoperator= (const Real_type value)
 Assigns a Real_type value to this Real.
Realoperator= (const char *value)
 Assigns a string representation of a value to this Integer.
Realoperator= (const Value &value)
 Assigns a Value to this Real.
 Real (const Real_type datum=0, const int digits=0)
 Constructs a Real from a Real_type datum.
 Real (const String_type &datum, const int digits=0)
 Constructs a Real from a String_type value representation.
 Real (const Real &value)
 Constructs a Real as a copy of another Real.
 Real (const Value &value)
 Constructs a Real from another Value.
Type type () const
 Gets the REAL Type code.
std::string type_name () const
 Gets the name string for the REAL Type.

Static Public Member Functions

static std::ios::fmtflags default_format_flags ()
 Gets the default format flags for a new Real.
static std::ios::fmtflags default_format_flags (std::ios::fmtflags flags)
 Sets the default format flags for a new Real.

Detailed Description

A Real implements a Value with a floating point datum.

A Real may always be cast to either an Integer or String Value.


Constructor & Destructor Documentation

Real ( const Real_type  datum = 0,
const int  digits = 0 
)

Constructs a Real from a Real_type datum.

Parameters:
datumThe Real_type datum to be assigned the initial value of the Real.
digitsThe number of digits of precision to use for a string representation of the Real.
Real ( const String_type datum,
const int  digits = 0 
) [explicit]

Constructs a Real from a String_type value representation.

Parameters:
datumThe String_type representation of the initial value to be assigned to the Real.
digitsThe number of digits of precision to use for a string representation of the Real.
See also:
string_to_real
Real ( const Real value)

Constructs a Real as a copy of another Real.

The parent is not copied; the new Real has no parent.

Parameters:
valueThe Real to copy.
Real ( const Value value)

Constructs a Real from another Value.

All characteristics of the Value, except its parent, are copied. The initial value of the Real is the Value cast to a Real_type.

Parameters:
valueThe Value to be used to derive this Real.

Member Function Documentation

Real* clone ( ) const [inline, virtual]

Constructs a clone of this Real.

A clone is a copy constructed on the heap.

Returns:
A pointer to the new Real clone.

Implements Value.

operator Integer_type ( ) const [inline, virtual]

Casts the Real to an Integer_type type.

Returns:
The datum cast to an Integer_type value.

Implements Value.

operator int ( ) const [inline, virtual]

Casts the Real to an int type.

Returns:
The datum cast to an int value.

Implements Value.

operator Real_type ( ) const [inline, virtual]

Casts the Real to a Real_type.

Returns:
The datum Real_type value.

Implements Value.

operator String_type ( ) const [virtual]

Casts the Real to a String_type.

The String_type representation of the datum is produced. The number of precision digits and the format flags for the representation are used.

Returns:
A String_type representation of the datum.
See also:
real_to_string
format_flags(std::ios::fmtflags)

Implements Value.

Real& base ( const int  ) [inline, virtual]

Prevents the base from being changed.

A Real Value can only be base 10.

Returns:
This Real.

Reimplemented from Value.

bool is_Numeric ( ) const [inline, virtual]

Asserts that the Real is a NUMERIC Type.

Returns:
Always returns true.

Reimplemented from Value.

bool is_Real ( ) const [inline, virtual]

Asserts that the Real is a REAL Type.

Returns:
Always returns true.

Reimplemented from Value.

Type type ( ) const [inline, virtual]

Gets the REAL Type code.

Returns:
Always returns the REAL Type code.

Implements Value.

References Value::REAL.

std::string type_name ( ) const [inline, virtual]

Gets the name string for the REAL Type.

Returns:
The type_name of a REAL Type.

Implements Value.

References Value::REAL, and Value::type_name().

Real& operator= ( const Value value) [virtual]

Assigns a Value to this Real.

The datum for this Real is the Value cast to a Real_type.

All other characteristics of the Value, except its parent, are assigned directly.

Parameters:
valueThe Value to be assigned.
Returns:
This Real.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to a Real_Type.

Implements Value.

Real& operator= ( const int  value) [inline, virtual]

Assigns an int type value to this Real.

The datum for this Real is assigned the int value.

Parameters:
valueThe int value to be assigned.
Returns:
This Real.

Implements Value.

Real& operator= ( const unsigned int  value) [inline, virtual]

Assigns an unsigned int type value to this Real.

The datum for this Real is assigned the unsigned int value.

Parameters:
valueThe unsigned int value to be assigned.
Returns:
This Real.

Implements Value.

Real& operator= ( const Integer_type  value) [inline, virtual]

Assigns an Integer_type value to this Real.

The datum for this Real is assigned the Integer_type value.

Parameters:
valueThe Integer_type value to be assigned.
Returns:
This Real.

Implements Value.

Real& operator= ( const Real_type  value) [inline]

Assigns a Real_type value to this Real.

The datum for this Real is assigned the Real_type value.

Parameters:
valueThe Real_type value to be assigned.
Returns:
This Real.
Real& operator= ( const String_type value) [virtual]

Assigns a string representation of a value to this Real.

The datum for this Real is assigned the value of the string representation parsed as a floating point value.

Parameters:
valueThe String_type value to be assigned.
Returns:
This Real.
Exceptions:
Invalid_ArgumentIf the string representation can not be parsed as a floating point value.
See also:
string_to_real

Implements Value.

Real& operator= ( const char *  value) [virtual]

Assigns a string representation of a value to this Integer.

If the character string is non-NULL, an assignment of the character string as a String_type is done. Otherwise an assignment of an emtpy String_type is done.

Parameters:
valueA pointer to a character string (C-string).
Returns:
This Real.
See also:
operator=(const String_type&)

Implements Value.

Real& operator+= ( const Value value) [virtual]

Adds another Value to this Value.

The Value cast to a Real_type is added to the datum of this Real.

Parameters:
valueThe Value to be added to this Real.
Returns:
This Real.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to a Real_type.

Implements Value.

Real operator+ ( const Value value) const

Adds this Real and another Value.

This Real is copied, onto the stack, and the Value is added to it. The temporary copy of the stack value that is returned is expected to be immediately assigned or otherwise used.

Parameters:
valueThe Value to be used in the addition operation.
Returns:
A temporary Real.
See also:
operator+=(const Value&)
int compare ( const Value value) const [virtual]

This Real is compared to another Value.

An attempt is made to compare the Values numerically by casting both to Real_type values. If that fails, because the other Value can not be cast to a Real_type, then the comparison is made lexicographically by casting both Values to a String_type.

Note: An Array always compares greater than other types of Values.

Parameters:
valueThe Value to be compared against.
Returns:
An int that is less than, equal to, or greater than 0 if this Real is logically less than, equal to, or greater than, respectively, the other Value.

Implements Value.

std::ios::fmtflags format_flags ( ) const [inline]

Gets the string representation format flags.

Returns:
The std::ios::fmtflags in effect.
See also:
format_flags(std::ios::fmtflags)
Real& format_flags ( std::ios::fmtflags  flags) [inline]

Sets the string representation format flags.

Typical format flags are fixed or scientific.

Parameters:
flagsThe std::ios::fmtflags to be used when producing a string representation of this Real.
Returns:
This Real.
See also:
real_to_string
static std::ios::fmtflags default_format_flags ( ) [inline, static]

Gets the default format flags for a new Real.

Note: The initial default format flags are std::ios::showpoint; however, this setting may be changed at compile time by the definition of DEFAULT_FORMAT_FLAGS.

Returns:
The current default std::ios::fmtflags value.
static std::ios::fmtflags default_format_flags ( std::ios::fmtflags  flags) [inline, static]

Sets the default format flags for a new Real.

Parameters:
flagsThe std::ios::fmtflags to be used when constructing a new Real.
Returns:
The flags.

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