idaeim studio
 PVL: Parameter Value Language

Public Member Functions
Integer Class Reference

An Integer implements a Value with an integer datum. More...

#include <Value.hh>

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

List of all members.

Public Member Functions

Integerclone () const
 Constructs a clone of this Integer.
int compare (const Value &value) const
 This Integer is compared to another Value.
 Integer (const Integer_type datum, const int base, const int digits=0)
 Constructs an Integer from an Integer_type datum.
 Integer (const Unsigned_Integer_type datum, const int base, const int digits=0)
 Constructs an Integer from an Unsigned_Integer_type datum.
 Integer (const unsigned int datum, const int base, const int digits=0)
 Constructs an Integer from an unsigned int datum.
 Integer (const Real_type datum, const bool is_signed=SIGNED, const int base=10, const int digits=0)
 Constructs an Integer from a Real_type datum.
 Integer (const int datum, const bool is_signed=SIGNED, const int base=10, const int digits=0)
 Constructs an Integer from an int datum.
 Integer (const Real_type datum, const int base, const int digits=0)
 Constructs an Integer from a Real_type datum.
 Integer (const String_type &datum, const bool is_signed=SIGNED, const int base=0, const int digits=0)
 Constructs an Integer from a String_type value representation.
 Integer (const Integer_type datum=0, const bool is_signed=SIGNED, const int base=10, const int digits=0)
 Constructs an Integer from an Integer_type datum.
 Integer (const int datum, const int base, const int digits=0)
 Constructs an Integer from an int datum.
 Integer (const String_type &datum, const int base, const int digits=0)
 Constructs an Integer from a String_type value representation.
 Integer (const Integer &value)
 Constructs an Integer as a copy of another Integer.
 Integer (const Unsigned_Integer_type datum, const bool is_signed=UNSIGNED, const int base=10, const int digits=0)
 Constructs an Integer from an Unsigned_Integer_type datum.
 Integer (const Value &value)
 Constructs an Integer from another Value.
 Integer (const unsigned int datum, const bool is_signed=UNSIGNED, const int base=10, const int digits=0)
 Constructs an Integer from an unsigned int datum.
bool is_Integer () const
 Asserts that the Integer is an INTEGER Type.
bool is_Numeric () const
 Asserts that the Integer is a NUMERIC Type.
bool is_signed () const
 Tests if the Integer is to be treated as a signed value.
Integeris_signed (const bool sign)
 Sets the signed-ness of the Value.
 operator int () const
 Casts the Integer to an int type.
 operator Integer_type () const
 Casts the Integer to an Integer_type.
 operator Real_type () const
 Casts the Integer to a Real_type.
 operator String_type () const
 Casts the Integer to a String_type.
Integer operator+ (const Value &value) const
 Adds this Integer and another Value.
Integeroperator+= (const Value &value)
 Adds another Value to this Value.
Integeroperator= (const unsigned int value)
 Assigns an unsigned int type value to this Integer.
Integeroperator= (const Real_type value)
 Assigns a Real_type value to this Integer.
Integeroperator= (const Value &value)
 Assigns a Value to this Integer.
Integeroperator= (const Integer_type value)
 Assigns an Integer_type value to this Integer.
Integeroperator= (const int value)
 Assigns an int type value to this Integer.
Integeroperator= (const String_type &value)
 Assigns a string representation of a value to this Integer.
Integeroperator= (const char *value)
 Assigns a string representation of a value to this Integer.
Type type () const
 Gets the INTEGER Type code.
std::string type_name () const
 Gets the name string for the INTEGER Type.

Detailed Description

An Integer implements a Value with an integer datum.

An Integer may be treated as signed or unsigned.

An Integer may always be cast to either a Real or String Value.


Constructor & Destructor Documentation

Integer ( const Integer_type  datum = 0,
const bool  is_signed = SIGNED,
const int  base = 10,
const int  digits = 0 
)

Constructs an Integer from an Integer_type datum.

Parameters:
datumThe Integer_type datum to be assigned the initial value of the Integer.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const Integer_type  datum,
const int  base,
const int  digits = 0 
)

Constructs an Integer from an Integer_type datum.

The Integer is marked as SIGNED.

Parameters:
datumThe Integer_type datum to be assigned the initial value of the Integer.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const Unsigned_Integer_type  datum,
const bool  is_signed = UNSIGNED,
const int  base = 10,
const int  digits = 0 
)

Constructs an Integer from an Unsigned_Integer_type datum.

Parameters:
datumThe Unsigned_Integer_type datum to be assigned the initial value of the Integer.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const Unsigned_Integer_type  datum,
const int  base,
const int  digits = 0 
)

Constructs an Integer from an Unsigned_Integer_type datum.

The Integer is marked as UNSIGNED.

Parameters:
datumThe Unsigned_Integer_type datum to be assigned the initial value of the Integer.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const int  datum,
const bool  is_signed = SIGNED,
const int  base = 10,
const int  digits = 0 
)

Constructs an Integer from an int datum.

Parameters:
datumThe int datum to be assigned the initial value of the Integer.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const int  datum,
const int  base,
const int  digits = 0 
)

Constructs an Integer from an int datum.

The Integer is marked as SIGNED.

Parameters:
datumThe int datum to be assigned the initial value of the Integer.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const unsigned int  datum,
const bool  is_signed = UNSIGNED,
const int  base = 10,
const int  digits = 0 
)

Constructs an Integer from an unsigned int datum.

Parameters:
datumThe unsigned int datum to be assigned the initial value of the Integer.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const unsigned int  datum,
const int  base,
const int  digits = 0 
)

Constructs an Integer from an unsigned int datum.

The Integer is marked as UNSIGNED.

Parameters:
datumThe unsigned int datum to be assigned the initial value of the Integer.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const Real_type  datum,
const bool  is_signed = SIGNED,
const int  base = 10,
const int  digits = 0 
) [explicit]

Constructs an Integer from a Real_type datum.

Parameters:
datumThe Real_type datum, cast to an Integer_type, to be assigned the initial value of the Integer.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const Real_type  datum,
const int  base,
const int  digits = 0 
) [explicit]

Constructs an Integer from a Real_type datum.

The Integer is marked as SIGNED.

Parameters:
datumThe Real_type datum, cast to an Integer_type, to be assigned the initial value of the Integer.
baseThe numeric base to be used for a string representation of the Integer.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
Integer ( const String_type datum,
const bool  is_signed = SIGNED,
const int  base = 0,
const int  digits = 0 
) [explicit]

Constructs an Integer from a String_type value representation.

The intial value of the Integer will be taken from the conversion of the string representation to an integer.

Parameters:
datumThe String_type representation of the initial value to be assigned to the Integer.
is_signedtrue (SIGNED) if the datum is to be treated as a signed value; false (UNSIGNED) otherwise.
baseThe numeric base to be used for a string representation of the Integer. If this is 0 it will be intuited from the string representation.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
See also:
string_to_integer
string_numeric_base
Integer ( const String_type datum,
const int  base,
const int  digits = 0 
) [explicit]

Constructs an Integer from a String_type value representation.

The intial value of the Integer will be taken from the conversion of the string representation to an integer.

The Integer is marked as SIGNED.

Parameters:
datumThe String_type value representation.
baseThe numeric base to be used for a string representation of the Integer. If this is 0 it will be intuited from the string representation.
digitsThe minimum number of digits to be used for a string representation; 0 padding is used.
See also:
string_to_integer
string_numeric_base
Integer ( const Integer value)

Constructs an Integer as a copy of another Integer.

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

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

Constructs an Integer from another Value.

All characteristics of the Value, except its parent, are copied. The initial value of the Integer is the Value cast to an Integer_type.

Parameters:
valueThe Value to be used to derive this Integer.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to an Integer_type.

Member Function Documentation

Integer* clone ( ) const [inline, virtual]

Constructs a clone of this Integer.

A clone is a copy constructed on the heap.

Returns:
A pointer to the new Integer clone.

Implements Value.

operator int ( ) const [inline, virtual]

Casts the Integer to an int type.

Returns:
The datum int value.

Implements Value.

operator Integer_type ( ) const [inline, virtual]

Casts the Integer to an Integer_type.

Returns:
The datum Integer_type value.

Implements Value.

operator Real_type ( ) const [virtual]

Casts the Integer to a Real_type.

If the Integer is unsigned the Real_type value will be cast from the Integer cast to an unsigned Integer_type.

Returns:
The datum cast to a Real_type value.
See also:
is_signed()

Implements Value.

operator String_type ( ) const [virtual]

Casts the Integer to a String_type.

The String_type representation of the datum is produced. Whether the value is_signed, its radix base and the number of digits for the representation are used.

Returns:
A String_type representation of the datum.
See also:
integer_to_string

Implements Value.

bool is_signed ( ) const [inline, virtual]

Tests if the Integer is to be treated as a signed value.

Returns:
true if the Integer is signed; false otherwise.

Reimplemented from Value.

Integer& is_signed ( const bool  sign) [inline, virtual]

Sets the signed-ness of the Value.

Parameters:
signtrue (SIGNED) if the Value is signed; false (UNSIGNED) if unsigned.
Returns:
This Integer.

Reimplemented from Value.

bool is_Numeric ( ) const [inline, virtual]

Asserts that the Integer is a NUMERIC Type.

Returns:
Always returns true.

Reimplemented from Value.

bool is_Integer ( ) const [inline, virtual]

Asserts that the Integer is an INTEGER Type.

Returns:
Always returns true.

Reimplemented from Value.

Type type ( ) const [inline, virtual]

Gets the INTEGER Type code.

Returns:
Always returns the INTEGER Type code.

Implements Value.

References Value::INTEGER.

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

Gets the name string for the INTEGER Type.

Returns:
The type_name of an INTEGER Type.

Implements Value.

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

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

Assigns a Value to this Integer.

The datum for this Integer is the Value cast to an Integer_type.

If the base of the Value is 0 and the Value is a String, then the base is intuited from the String characters.

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

Parameters:
valueThe Value to be assigned.
Returns:
This Integer.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to an Integer_Type.
See also:
string_numeric_base

Implements Value.

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

Assigns an int type value to this Integer.

The datum for this Integer is assigned the int value.

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

Implements Value.

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

Assigns an unsigned int type value to this Integer.

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

This Integer is marked as UNSIGNED.

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

Implements Value.

References Value::UNSIGNED.

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

Assigns an Integer_type value to this Integer.

The datum for this Integer is assigned the Integer_type value.

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

Implements Value.

Integer& operator= ( const Real_type  value) [inline, virtual]

Assigns a Real_type value to this Integer.

The datum for this Integer is assigned the Real_type value cast to an Integer_type.

Parameters:
valueThe Real_type value to be assigned.
Returns:
This Integer.

Implements Value.

Integer& operator= ( const String_type value) [virtual]

Assigns a string representation of a value to this Integer.

If the base of the string representation can be intuited, it is assigned as the Base of this Integer.

The datum for this Integer is assigned the value of the string representation parsed as an integer value.

Parameters:
valueThe String_type value to be assigned.
Returns:
This Integer.
Exceptions:
Invalid_ArgumentIf the string representation can not be parsed as an integer value.
See also:
string_numeric_base
string_to_integer

Implements Value.

Integer& 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 Integer.
See also:
operator=(const String_type&)

Implements Value.

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

Adds another Value to this Value.

The Value cast to an Integer_type is added to the datum of this Integer.

Parameters:
valueThe Value to be added to this Integer.
Returns:
This Integer.
Exceptions:
Invalid_ArgumentIf the Value can not be cast to an Integer_type.

Implements Value.

Integer operator+ ( const Value value) const

Adds this Integer and another Value.

This Integer 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 Integer.
See also:
operator+=(const Value&)
int compare ( const Value value) const [virtual]

This Integer 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 Integer is logically less than, equal to, or greater than, respectively, the other Value.

Implements Value.


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