#include <it_bus/integer.h>
Inheritance diagram for IT_Bus::Integer:
This class stores the value as a Decimal value.
Definition at line 30 of file integer.h.
Public Types | |
typedef IT_Reflect::ValueRef< IT_Bus::Integer > | IT_ReflectionType |
Public Member Functions | |
Integer () throw (()) | |
No argument constructor. | |
Integer (short value) throw (()) | |
Constructor. | |
Integer (unsigned short value) throw (()) | |
Constructor. | |
Integer (int value) throw (()) | |
Constructor. | |
Integer (unsigned int value) throw (()) | |
Constructor. | |
Integer (long value) throw (()) | |
Constructor. | |
Integer (unsigned long value) throw (()) | |
Constructor. | |
Integer (IT_LongLong value) throw (()) | |
Constructor. | |
Integer (IT_ULongLong value) throw (()) | |
Constructor. | |
Integer (const char *value, bool truncate=false) throw ((IT_Bus::Exception)) | |
Constructor. | |
Integer (const String &value, bool truncate=false) throw ((IT_Bus::Exception)) | |
Constructor. | |
Integer (const Decimal &value, bool truncate=false) throw ((IT_Bus::Exception)) | |
Constructor. | |
Integer (const Integer ©) throw (()) | |
Copy constructor. | |
Integer & | operator= (const Integer &rhs) throw (()) |
Assignment operator. | |
Integer & | operator+= (const Integer &rhs) throw ((IT_Bus::Exception)) |
Addition with a sign operator. | |
Integer & | operator-= (const Integer &rhs) throw ((IT_Bus::Exception)) |
Subtraction with a sign operator. | |
Integer & | operator *= (const Integer &rhs) throw ((IT_Bus::Exception)) |
Multiplication with a sign operator. | |
Integer & | operator/= (const Integer &rhs) throw ((IT_Bus::Exception)) |
Division with a sign operator. | |
Integer & | operator%= (const Integer &rhs) throw ((IT_Bus::Exception)) |
Modulo with a sign operator. | |
Integer & | operator++ () throw ((IT_Bus::Exception)) |
Incrementing operator. | |
const Integer | operator++ (int) throw ((IT_Bus::Exception)) |
Incrementing operator. | |
Integer & | operator-- () throw ((IT_Bus::Exception)) |
Decrementing operator. | |
const Integer | operator-- (int) throw ((IT_Bus::Exception)) |
Decrementing operator. | |
bool | is_negative () const throw (()) |
Determine whether instance value is < 0. | |
bool | is_positive () const throw (()) |
Determine whether instance value is > 0. | |
bool | is_non_negative () const throw (()) |
Determine whether instance value is >= to 0. | |
bool | is_non_positive () const throw (()) |
Determine whether instance value is <= to 0. | |
int | compare (const Integer &other) const throw (()) |
Compares the value of this instance to the value of the parameter. | |
const Decimal & | get_value () const throw (()) |
Return the value of this instance as a Decimal. | |
void | set_value (const Decimal &value, bool truncate=false) throw ((IT_Bus::Exception)) |
Set the value of this instance from a Decimal. | |
String | to_string () const throw (()) |
Returns a String representation of the value of this instance. | |
virtual AnyType & | copy (const AnyType ©) |
Returns a reference to an AnyType that is a copy of the AnyType parameter. | |
virtual AnyType::Kind | get_kind () const |
Returns the IT_Bus::AnyType::Kind for the type. | |
virtual const QName & | get_type () const |
Returns the IT_Bus::QName for the type. | |
virtual IT_Reflect::Reflection * | get_reflection () throw ((IT_Reflect::ReflectException)) |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance. | |
virtual const IT_Reflect::Reflection * | get_reflection () const throw ((IT_Reflect::ReflectException)) |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance. | |
virtual void | write_value (AnySimpleTypeWriter &writer) const throw ((IT_Bus::SerializationException)) |
Write the instance value. | |
virtual void | read_value (AnySimpleTypeReader &reader) throw ((IT_Bus::DeserializationException)) |
Read the value into the instance. | |
Static Public Member Functions | |
static bool | is_valid_integer (const Decimal &value) throw (()) |
Determines whether the test value is a valid integer. | |
Protected Member Functions | |
virtual void | validate (const Decimal &value) const throw ((IT_Bus::Exception)) |
Checks whether the test value is a valid integer. | |
Static Protected Member Functions | |
static Decimal | from_string (const char *value, bool truncate=false) throw ((IT_Bus::Exception)) |
Returns a Decimal initialized with the value provided as a string. | |
static Decimal | from_signed (IT_LongLong value) throw (()) |
Returns a Decimal initialized with the value provided as a longlong. | |
static Decimal | from_unsigned (IT_ULongLong value) throw (()) |
Returns a Decimal initialized with the value provided as a longlong. | |
static void | validate_integer (const Decimal &value) throw ((IT_Bus::Exception)) |
Checks whether the test value is a valid integer. | |
Protected Attributes | |
Decimal | m_value |
Instance variable that holds the value for the instance. |
IT_Bus::Integer::Integer | ( | short | value | ) | throw (()) |
Constructor.
short | value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | unsigned short | value | ) | throw (()) |
Constructor.
unsigned | short value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | int | value | ) | throw (()) |
Constructor.
int | value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | unsigned int | value | ) | throw (()) |
Constructor.
unsigned | int value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | long | value | ) | throw (()) |
Constructor.
long | value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | unsigned long | value | ) | throw (()) |
Constructor.
unsigned | long value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | IT_LongLong | value | ) | throw (()) |
Constructor.
longlong | value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | IT_ULongLong | value | ) | throw (()) |
Constructor.
unsigned | longlong value to use in initializing instance. |
IT_Bus::Integer::Integer | ( | const char * | value, | |
bool | truncate = false | |||
) | throw ((IT_Bus::Exception)) |
Constructor.
Pointer | to character array value to use in initializing instance. | |
bool | indicator of whether to trucate the value at a possible decimal point |
IT_Bus::Integer::Integer | ( | const String & | value, | |
bool | truncate = false | |||
) | throw ((IT_Bus::Exception)) |
Constructor.
String | value to use in initializing instance. | |
bool | indicator of whether to trucate the value at a possible decimal point |
IT_Bus::Integer::Integer | ( | const Decimal & | value, | |
bool | truncate = false | |||
) | throw ((IT_Bus::Exception)) |
Constructor.
Decimal | value to use in initializing instance. | |
bool | indicator of whether to trucate the value at the decimal point |
IT_Bus::Integer::Integer | ( | const Integer & | copy | ) | throw (()) |
int IT_Bus::Integer::compare | ( | const Integer & | other | ) | const throw (()) |
Compares the value of this instance to the value of the parameter.
Integer | instance to compare to this instance. |
const Decimal& IT_Bus::Integer::get_value | ( | ) | const throw (()) |
Return the value of this instance as a Decimal.
void IT_Bus::Integer::set_value | ( | const Decimal & | value, | |
bool | truncate = false | |||
) | throw ((IT_Bus::Exception)) |
Set the value of this instance from a Decimal.
Decimal | value to use | |
bool | indicator of whether to trucate the value at the decimal point The default is to not truncate the value. |
The code confirms that the the first parameter is a valid integer before setting the value of this instance.
String IT_Bus::Integer::to_string | ( | ) | const throw (()) |
static bool IT_Bus::Integer::is_valid_integer | ( | const Decimal & | value | ) | throw (()) [static] |
Determines whether the test value is a valid integer.
Decimal | value to be tested. |
Returns a reference to an AnyType that is a copy of the AnyType parameter.
Derived classes override this method, providing an appropriate implementation. In this base class, this method is not supported; an exception is always thrown.
AnyType | to be copied. |
IT_Bus::Exception | with message "Copy not supported" |
Reimplemented from IT_Bus::AnyType.
Reimplemented in IT_Bus::NonPositiveInteger, IT_Bus::NegativeInteger, IT_Bus::NonNegativeInteger, and IT_Bus::PositiveInteger.
virtual AnyType::Kind IT_Bus::Integer::get_kind | ( | ) | const [virtual] |
Returns the IT_Bus::AnyType::Kind for the type.
Derived subclasses override this method and return the appropriate Kind.
Reimplemented from IT_Bus::AnySimpleType.
virtual const QName& IT_Bus::Integer::get_type | ( | ) | const [virtual] |
Returns the IT_Bus::QName for the type.
Derived subclasses implement this method and return their QName.
Implements IT_Bus::AnyType.
Reimplemented in IT_Bus::NonPositiveInteger, IT_Bus::NegativeInteger, IT_Bus::NonNegativeInteger, and IT_Bus::PositiveInteger.
virtual IT_Reflect::Reflection* IT_Bus::Integer::get_reflection | ( | ) | throw ((IT_Reflect::ReflectException)) [virtual] |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance.
IT_Reflect::ReflectException |
Reimplemented from IT_Bus::AnyType.
Reimplemented in IT_Bus::NonPositiveInteger, IT_Bus::NegativeInteger, IT_Bus::NonNegativeInteger, and IT_Bus::PositiveInteger.
virtual const IT_Reflect::Reflection* IT_Bus::Integer::get_reflection | ( | ) | const throw ((IT_Reflect::ReflectException)) [virtual] |
Return an instance of the IT_Reflect::Reflection type that encapsulates this instance.
IT_Reflect::ReflectException |
Reimplemented from IT_Bus::AnyType.
Reimplemented in IT_Bus::NonPositiveInteger, IT_Bus::NegativeInteger, IT_Bus::NonNegativeInteger, and IT_Bus::PositiveInteger.
virtual void IT_Bus::Integer::write_value | ( | AnySimpleTypeWriter & | writer | ) | const throw ((IT_Bus::SerializationException)) [virtual] |
virtual void IT_Bus::Integer::read_value | ( | AnySimpleTypeReader & | reader | ) | throw ((IT_Bus::DeserializationException)) [virtual] |
Read the value into the instance.
Derived classes implement this method.
Implements IT_Bus::AnySimpleType.
virtual void IT_Bus::Integer::validate | ( | const Decimal & | value | ) | const throw ((IT_Bus::Exception)) [protected, virtual] |
Checks whether the test value is a valid integer.
This method invokes the validate_integer() method.
IT_Bus::Exception |
Reimplemented in IT_Bus::NonPositiveInteger, IT_Bus::NegativeInteger, IT_Bus::NonNegativeInteger, and IT_Bus::PositiveInteger.
static Decimal IT_Bus::Integer::from_string | ( | const char * | value, | |
bool | truncate = false | |||
) | throw ((IT_Bus::Exception)) [static, protected] |
Returns a Decimal initialized with the value provided as a string.
Pointer | to the character array to use in initializing the Decimal. | |
bool | indicator of whether to trucate the value at the decimal point |
static Decimal IT_Bus::Integer::from_signed | ( | IT_LongLong | value | ) | throw (()) [static, protected] |
Returns a Decimal initialized with the value provided as a longlong.
LongLong | value to use in initializing the Decimal. |
static Decimal IT_Bus::Integer::from_unsigned | ( | IT_ULongLong | value | ) | throw (()) [static, protected] |
Returns a Decimal initialized with the value provided as a longlong.
ULongLong | value to use in initializing the Decimal. |
static void IT_Bus::Integer::validate_integer | ( | const Decimal & | value | ) | throw ((IT_Bus::Exception)) [static, protected] |
Checks whether the test value is a valid integer.
IT_Bus::Exception | with the message "Non-zero fractional part" |