![]() |
PVL: Parameter Value Language
|
A Real implements a Value with a floating point datum. More...
#include <Value.hh>
Public Member Functions | |
Real & | base (const int) |
Prevents the base from being changed. | |
Real * | clone () 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. | |
Real & | format_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. | |
Real & | operator+= (const Value &value) |
Adds another Value to this Value. | |
Real & | operator= (const int value) |
Assigns an int type value to this Real. | |
Real & | operator= (const unsigned int value) |
Assigns an unsigned int type value to this Real. | |
Real & | operator= (const Integer_type value) |
Assigns an Integer_type value to this Real. | |
Real & | operator= (const String_type &value) |
Assigns a string representation of a value to this Real. | |
Real & | operator= (const Real_type value) |
Assigns a Real_type value to this Real. | |
Real & | operator= (const char *value) |
Assigns a string representation of a value to this Integer. | |
Real & | operator= (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. |
A Real implements a Value with a floating point datum.
A Real may always be cast to either an Integer or String Value.
Real | ( | const String_type & | datum, |
const int | digits = 0 |
||
) | [explicit] |
Constructs a Real from a String_type value representation.
datum | The String_type representation of the initial value to be assigned to the Real. |
digits | The number of digits of precision to use for a string representation of the Real. |
Real* clone | ( | ) | const [inline, virtual] |
operator Integer_type | ( | ) | const [inline, virtual] |
operator int | ( | ) | const [inline, virtual] |
operator Real_type | ( | ) | const [inline, virtual] |
operator String_type | ( | ) | const [virtual] |
Real& base | ( | const int | ) | [inline, virtual] |
bool is_Numeric | ( | ) | const [inline, virtual] |
bool is_Real | ( | ) | const [inline, virtual] |
Type type | ( | ) | const [inline, virtual] |
Gets the REAL Type code.
Implements Value.
References Value::REAL.
std::string type_name | ( | ) | const [inline, virtual] |
Gets the name string for the REAL Type.
Implements Value.
References Value::REAL, and Value::type_name().
Real& operator= | ( | const int | value | ) | [inline, virtual] |
Real& operator= | ( | const unsigned int | value | ) | [inline, virtual] |
Real& operator= | ( | const Integer_type | value | ) | [inline, virtual] |
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.
value | The String_type value to be assigned. |
Invalid_Argument | If the string representation can not be parsed as a floating point value. |
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.
value | A pointer to a character string (C-string). |
Implements Value.
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.
value | The Value to be used in the addition operation. |
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.
value | The Value to be compared against. |
Implements Value.
std::ios::fmtflags format_flags | ( | ) | const [inline] |
Gets the string representation format flags.
Real& format_flags | ( | std::ios::fmtflags | flags | ) | [inline] |
Sets the string representation format flags.
Typical format flags are fixed or scientific.
flags | The std::ios::fmtflags to be used when producing a string representation of this Real. |
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.
static std::ios::fmtflags default_format_flags | ( | std::ios::fmtflags | flags | ) | [inline, static] |