E57 Foundation API v1.1.312  Aug. 10, 2011
Public Member Functions
FloatNode Class Reference

An E57 element encoding a single or double precision IEEE floating point number. More...

List of all members.

Public Member Functions

 FloatNode (ImageFile destImageFile, double value=0.0, FloatPrecision precision=E57_DOUBLE, double minimum=E57_DOUBLE_MIN, double maximum=E57_DOUBLE_MAX)
 Create an E57 element for storing an double precision IEEE floating point number.
double value () const
 Get IEEE floating point value stored.
FloatPrecision precision () const
 Get declared precision of the floating point number.
double minimum () const
 Get the declared minimum that the value may take.
double maximum () const
 Get the declared maximum that the value may take.
 operator Node () const
 Upcast a FloatNode handle to a generic Node handle.
 FloatNode (const Node &n)
 Downcast a generic Node handle to a FloatNode handle.
bool isRoot () const
 Is this a root node.
Node parent () const
 Return parent of node, or self if a root node.
ustring pathName () const
 Get absolute pathname of node.
ustring elementName () const
 Get elementName string, that identifies the node in its parent..
ImageFile destImageFile () const
 Get the ImageFile that was declared as the destination for the node when it was created.
bool isAttached () const
 Has node been attached into the tree of an ImageFile.
void dump (int indent=0, std::ostream &os=std::cout) const
 Diagnostic function to print internal state of object to output stream in an indented format.
void checkInvariant (bool doRecurse=true, bool doUpcast=true)
 Check whether FloatNode class invariant is true.

Detailed Description

An E57 element encoding a single or double precision IEEE floating point number.

An FloatNode is a terminal node (i.e. having no children) that holds an IEEE floating point value, and minimum/maximum bounds. The precision of the floating point value and attributes may be either single or double precision. Once the FloatNode value and attributes are set at creation, they may not be modified.

If the precision option of the FloatNode is E57_SINGLE: The minimum attribute may be a number in the interval [-3.402823466e+38, 3.402823466e+38]. The maximum attribute may be a number in the interval [maximum, 3.402823466e+38]. The value may be a number in the interval [minimum, maximum].

If the precision option of the FloatNode is E57_DOUBLE: The minimum attribute may be a number in the interval [-1.7976931348623158e+308, 1.7976931348623158e+308]. The maximum attribute may be a number in the interval [maximum, 1.7976931348623158e+308]. The value may be a number in the interval [minimum, maximum].

See Node class discussion for discussion of the common functions that StructureNode supports.

Class Invariant

A class invariant is a list of statements about an object that are always true before and after any operation on the object. An invariant is useful for testing correct operation of an implementation. Statements in an invariant can involve only externally visible state, or can refer to internal implementation-specific state that is not visible to the API user. The following C++ code checks externally visible state for consistency and throws an exception if the invariant is violated:

void FloatNode::checkInvariant(bool /*doRecurse*/, bool doUpcast) {
    // If destImageFile not open, can't test invariant (almost every call would throw)
    if (!destImageFile().isOpen())
        return;

    // If requested, call Node::checkInvariant
    if (doUpcast)
        static_cast<Node>(*this).checkInvariant(false, false);

    if (precision() == E57_SINGLE) {
        if (minimum() < E57_FLOAT_MIN || maximum() > E57_FLOAT_MAX)
           throw E57_EXCEPTION1(E57_ERROR_INVARIANCE_VIOLATION);
    }

    // If value is out of bounds
    if (value() < minimum() || value() > maximum())
       throw E57_EXCEPTION1(E57_ERROR_INVARIANCE_VIOLATION);
} // end FloatNode::checkInvariant

See also:
Node
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines