Main Page | Class Hierarchy | Compound List | File List | Compound Members

BxFloat32 Class Reference

Class implementing the BinX data type 32-bit floating point numbers. More...

#include <BxFloat32.h>

Inheritance diagram for BxFloat32:

BxFloat BxDataObject BxObject List of all members.

Public Member Functions

 BxFloat32 ()
 BxFloat32 (const BxFloat32 &copy)
 BxFloat32 (const bx_float32)
virtual bool equals (const BxDataObject &) const
virtual char * toString (bool xml)
virtual bool parseValue (const char *)
BxFloat32operator= (const bx_float32)

Detailed Description

Instances of this class hold and perform operations on the BinX XML Schema type <float-32>. The class provides manipulations such as:
Since: BinX version 1.0.


Constructor & Destructor Documentation

BxFloat32::BxFloat32  ) 
 

Default constructor.

Constructs and initialises an instance of the class BxFloat32. Default attribute values are assigned as follows:

       sizeInBits_ = 32;
       sizeInBytes_ = 4; 
       sizeInAll_ = 4; 
   

BxFloat32::BxFloat32 const BxFloat32 copy  ) 
 

Construct a BxFloat32 instance by copying a specified BxFloat32 instance.

Constructs and initialises an instance of the class BxFloat32.

Parameters:
copy A reference to the BxFloat32 instance to copy.

BxFloat32::BxFloat32 const bx_float32  f32  ) 
 

Construct a BxFloat32 instance and assign it a specified 32-bit floating point number.

Constructs and initialises an instance of the class BxFloat32.

Parameters:
f32 A 32-bit floating point value to initialise the new BxFloat32 object.


Member Function Documentation

bool BxFloat32::equals const BxDataObject dataObj  )  const [virtual]
 

Compares the value of a specified data object with the value of this object.

In this method, two objects are considered to be equal if they are of the same BinX object type and if they store the same data value. Also, only primitive BinX data types implement this method.


Note: Byte order differences are not compensated for in this test. Hence, two 32-bit floating point numbers that are equal in value, but represented in different byte orders would be found to be unequal.

Parameters:
dataObj A reference to another data object to be compared with this object.
Returns:
true If the data type and value of the two objects are equal,
false If the objects differ in type or value.

Reimplemented from BxDataObject.

BxFloat32 & BxFloat32::operator= const bx_float32  f32  ) 
 

Overloaded operator = assigns a 32-bit floating point value from a specified source to a BxFloat32 destination object.

Parameters:
f32 A 32-bit signed integer value to be assigned to a BxFloat32 object.
Returns:
A reference to this BxFloat32 object after the assignment has been performed.

bool BxFloat32::parseValue const char *  strVal  )  [virtual]
 

Extract a 32-bit floating point value from a specified string and assign the value to this object.

The data contained in the input string is assumed to be in ASCII representation, and to contain a floating point number represented in exponential format. Exponential format is defined by the following normal form expression: Note - in normal form expressions, angle-brackets are used to denote variables, whose valid values are defined in subsequent expressions. The angle brackets do not indicate tags or elements as they do in XML notation.

       <float32-in-ascii> = <modulus> | (<modulus><exponent>)
       where
           <modulus> = <signed-modulus> | <unsigned-modulus>
           <exponent> = <signed-exponent> | <unsigned-exponent>
           <signed-modulus> = "+" | "-" &lt;modulus-value>
           <unsigned-modulus> = <modulus-value>
           <signed-exponent> = ("E" | "e") ("+" | "-") <exponent-value>
           <unsigned-exponent> = <exponent-value>
           <modulus-value> = <digits&gt;* ("." | "") <digits>*
           <exponent-value> = <digits&gt; | (<digits> <digits>)
           <digits> = "0" | "1" | "2"| "3" | "4" | "5" | "6" | "7" | "8" | "9"
   
The definition specifies that a well-formed ASCII representation of a floating number consists of a modulus or a modulus followed by an exponent. The modulus value must meet the following constraints:
  • It may be signed or unsigned.
  • The number of digits is limited by the precision (number of bits) that can be stored in a BxFloat32 object.
  • It optionally contains a decimal point.
The exponent value must meet the following constraints:
  • It may be signed or unsigned.
  • Upper or lower case "e" must we used to as a prefix to the value
  • The number of digits is at most two.
The input string must not contain symbols, except those allowed by the normal form expressions above. The input string must be null-terminated. All bytes of the input string are used in the conversion process. The input bytes is converted to a floating point representation, in conformance with the definiton of a BxFloat32 object value. The converted value is stored as the value of this object. Only primitive BinX data types implement this method.
Parameters:
strVal A pointer to an ASCII string containing a floating point value.
Returns:
true If value conversion was successful,
false If the input string is NULL.

Reimplemented from BxDataObject.

char * BxFloat32::toString bool  xml  )  [virtual]
 

Return a string containing the DataBinX XML element (or printable value only ) for the value of this BxFloat32 object.

The DataBinx representation of a BxFloat32 object value consists of:

  • The BinX XML tags, <float-32> and </float-32>
  • The binary data value of this object, converted to a printable representation

Example Return Result:
       <float-32>-0.74982e12</float-32>
   

This method allocates memory to hold the returned string. The caller is responsible for releasing the memory when the string is no longer needed.
If the BinX XML tags are not required, then the input boolean flag can be used to request that only the converted binary data value be included in the result string.
Only BinX primitive data types implement this method.
Parameters:
xml A boolean indicating whether to include BinX XML tags or not.
Returns:
A string buffer containing the DataBinX representation of the value of this object, if the input flag is true,
A string buffer containing the printable representation of the value of this object, if the input flag is false.

Reimplemented from BxDataObject.


The documentation for this class was generated from the following files:
Generated on Fri May 6 13:36:19 2005 for edikt::BinX by doxygen 1.3.3