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

An E57 element encoding an integer value. More...

List of all members.

Public Member Functions

 IntegerNode (ImageFile destImageFile, int64_t value=0, int64_t minimum=E57_INT64_MIN, int64_t maximum=E57_INT64_MAX)
 Create an E57 element for storing a integer value.
int64_t value () const
 Get integer value stored.
int64_t minimum () const
 Get the declared minimum that the value may take.
int64_t maximum () const
 Get the declared maximum that the value may take.
 operator Node () const
 Upcast a IntegerNode handle to a generic Node handle.
 IntegerNode (const Node &n)
 Downcast a generic Node handle to a IntegerNode 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 IntegerNode class invariant is true.

Detailed Description

An E57 element encoding an integer value.

An IntegerNode is a terminal node (i.e. having no children) that holds an integer value, and minimum/maximum bounds. Once the IntegerNode value and attributes are set at creation, they may not be modified.

The minimum attribute may be a number in the interval [-2^63, 2^63). The maximum attribute may be a number in the interval [minimum, 2^63). 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 IntegerNode::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 (value() < minimum() || value() > maximum())
       throw E57_EXCEPTION1(E57_ERROR_INVARIANCE_VIOLATION);
} // end IntegerNode::checkInvariant

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