libE57Format 3.1.1
C++ library to read & write the E57 file format for point cloud data
|
An E57 element encoding a single or double precision IEEE floating point number. More...
#include <E57Format.h>
Public Member Functions | |
FloatNode ()=delete | |
FloatNode (const ImageFile &destImageFile, double value=0.0, FloatPrecision precision=PrecisionDouble, double minimum=DOUBLE_MIN, double maximum=DOUBLE_MAX) | |
Create an E57 element for storing an double precision IEEE floating point number. | |
FloatNode (const Node &n) | |
Downcast a generic Node handle to a FloatNode handle. | |
void | checkInvariant (bool doRecurse=true, bool doUpcast=true) const |
Check whether FloatNode class invariant is true. | |
ImageFile | destImageFile () const |
Get the ImageFile that was declared as the destination for the node when it was created. | |
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. | |
ustring | elementName () const |
Get elementName string, that identifies the node in its parent. | |
bool | isAttached () const |
Has node been attached into the tree of an ImageFile. | |
bool | isRoot () const |
Is this a root node. | |
double | maximum () const |
Get the declared maximum that the value may take. | |
double | minimum () const |
Get the declared minimum that the value may take. | |
operator Node () const | |
Upcast a FloatNode handle to a generic Node handle. | |
Node | parent () const |
Return parent of node, or self if a root node. | |
ustring | pathName () const |
Get absolute pathname of node. | |
FloatPrecision | precision () const |
Get declared precision of the floating point number. | |
double | value () const |
Get IEEE floating point value stored. | |
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 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 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.
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:
|
delete |
|
explicit |
Create an E57 element for storing an double precision IEEE floating point number.
[in] | destImageFile | The ImageFile where the new node will eventually be stored. |
[in] | value | The double precision IEEE floating point value of the element. |
[in] | precision | The precision of IEEE floating point to use. May be PrecisionSingle or PrecisionDouble. |
[in] | minimum | The smallest value that the value may take. |
[in] | maximum | The largest value that the value may take. |
An FloatNode stores an IEEE floating point number and a lower and upper bound. The FloatNode class corresponds to the ASTM E57 standard Float element. See the class discussion at bottom of FloatNode page for more details.
The destImageFile indicates which ImageFile the FloatNode will eventually be attached to. A node is attached to an ImageFile by adding it underneath the predefined root of the ImageFile (gotten from ImageFile::root). It is not an error to fail to attach the FloatNode to the destImageFile. It is an error to attempt to attach the FloatNode to a different ImageFile.
There is only one FloatNode constructor that handles both PrecisionSingle and PrecisionDouble precision cases. If precision = PrecisionSingle, then the object will silently round the double precision value to the nearest representable single precision value. In this case, the lower bits will be lost, and if the value is outside the representable range of a single precision number, the exponent may be changed. The same is true for the minimum and maximum arguments.
ErrorBadAPIArgument | |
ErrorImageFileNotOpen | |
ErrorFileReadOnly | |
ErrorValueOutOfBounds | |
ErrorInternal | All objects in undocumented state |
|
explicit |
Downcast a generic Node handle to a FloatNode handle.
[in] | n | The generic handle to downcast. |
The handle n must be for an underlying FloatNode, otherwise an exception is thrown. In designs that need to avoid the exception, use Node::type() to determine the actual type of the n before downcasting. This function must be explicitly called (c++ compiler cannot insert it automatically).
ErrorBadNodeDowncast |
void FloatNode::checkInvariant | ( | bool | doRecurse = true , |
bool | doUpcast = true |
||
) | const |
Check whether FloatNode class invariant is true.
[in] | doRecurse | If true, also check invariants of all children or sub-objects recursively. |
[in] | doUpcast | If true, also check invariants of the generic Node class. |
This function checks at least the assertions in the documented class invariant description (see class reference page for this object). Other internal invariants that are implementation-dependent may also be checked. If any invariant clause is violated, an ErrorInvarianceViolation E57Exception is thrown.
Checking the invariant recursively may be expensive if the tree is large, so should be used judiciously, in debug versions of the application.
ErrorInvarianceViolation | or any other E57 ErrorCode |
ImageFile FloatNode::destImageFile | ( | ) | const |
Get the ImageFile that was declared as the destination for the node when it was created.
The first argument of the constructors of each of the 8 types of nodes is an ImageFile that indicates which ImageFile the node will eventually be attached to. This function returns that constructor argument. It is an error to attempt to attach the node to a different ImageFile. However it is not an error to not attach the node to any ImageFile (it's just wasteful). Use Node::isAttached to check if the node actually did get attached.
void FloatNode::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.
[in] | indent | Number of spaces to indent all the printed lines of this object. |
[in] | os | Output stream to print on. |
All objects in the E57 Foundation API (with exception of E57Exception) support a dump() function. These functions print out to the console a detailed listing of the internal state of objects. The content of these printouts is not documented, and is really of interest only to implementation developers/maintainers or the really adventurous users. In implementations of the API other than the Reference Implementation, the dump() functions may produce no output (although the functions should still be defined). The output format may change from version to version.
No | E57Exceptions |
ustring FloatNode::elementName | ( | ) | const |
Get elementName string, that identifies the node in its parent.
The elementName is a string associated with each parent-child link between nodes. For a given parent, the elementName uniquely identifies each of its children. Thus, any node in a tree can be identified by a sequence of elementNames that form a path from the tree's root node (see Node::pathName for more details).
Three types of nodes (the container node types) can be parents: StructureNode, VectorNode, and CompressedVectorNode. The children of a StructureNode are explicitly given unique elementNames when they are attached to the parent (using StructureNode::set). The children of VectorNode and CompressedVectorNode are implicitly given elementNames based on their position in the list (starting at "0"). In a CompressedVectorNode, the elementName can become quite large: "1000000000" or more. However in a CompressedVectorNode, the elementName string is not stored in the file and is deduced by the position of the child.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
bool FloatNode::isAttached | ( | ) | const |
Has node been attached into the tree of an ImageFile.
Nodes are attached into an ImageFile tree by inserting them as children (directly or indirectly) of the ImageFile's root node. Nodes can also be attached to an ImageFile if they are used in the codecs
or prototype
trees of an CompressedVectorNode that is attached. Attached nodes will be saved to disk when the ImageFile is closed, and restored when the ImageFile is read back in from disk. Unattached nodes will not be saved to disk. It is not recommended to create nodes that are not eventually attached to the ImageFile.
true
if node is child of (or in codecs or prototype of a child CompressedVectorNode of) the root node of an ImageFile.ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
bool FloatNode::isRoot | ( | ) | const |
Is this a root node.
A root node has itself as a parent (it is not a child of any node). Newly constructed nodes (before they are inserted into an ImageFile tree) start out as root nodes. It is possible to temporarily create small trees that are unattached to any ImageFile. In these temporary trees, the top-most node will be a root node. After the tree is attached to the ImageFile tree, the only root node will be the pre-created one of the ImageTree (the one returned by ImageFile::root). The concept of attachment is slightly larger than that of the parent-child relationship (see Node::isAttached and CompressedVectorNode::CompressedVectorNode for more details).
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
double FloatNode::maximum | ( | ) | const |
Get the declared maximum that the value may take.
If precision is PrecisionSingle, the single precision maximum is returned as a double. If precision is PrecisionDouble, the double precision maximum is returned as a double.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
double FloatNode::minimum | ( | ) | const |
Get the declared minimum that the value may take.
If precision is PrecisionSingle, the single precision minimum is returned as a double. If precision is PrecisionDouble, the double precision minimum is returned as a double.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
FloatNode::operator Node | ( | ) | const |
Upcast a FloatNode handle to a generic Node handle.
An upcast is always safe, and the compiler can automatically insert it for initializations of Node variables and Node function arguments.
No | E57Exceptions. |
Node FloatNode::parent | ( | ) | const |
Return parent of node, or self if a root node.
Nodes are organized into trees (acyclic graphs) with a distinguished node (the "top-most" node) called the root node. A parent-child relationship is established between nodes to form a tree. Nodes can have zero or one parent. Nodes with zero parents are called root nodes.
In the API, if a node has zero parents it is represented by having itself as a parent. Due to the set-once design of the API, a parent-child relationship cannot be modified once established. A child node can be any of the 8 node types, but a parent node can only be one of the 3 container node types (TypeStructure, TypeVector, and TypeCompressedVector). Each parent-child link has a string name (the elementName) associated with it (See Node::elementName for more details). More than one tree can be formed at any given time. Typically small trees are temporarily constructed before attachment to an ImageFile so that they will be written to the disk.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
ustring FloatNode::pathName | ( | ) | const |
Get absolute pathname of node.
Nodes are organized into trees (acyclic graphs) by a parent-child relationship between nodes. Each parent-child relationship has an associated elementName string that is unique for a given parent. Any node in a given tree can be identified by a sequence of elementNames of how to get to the node from the root of the tree. An absolute pathname string that is formed by arranging this sequence of elementNames separated by the "/" character with a leading "/" prepended.
Some example absolute pathNames: "/data3D/0/points/153/cartesianX", "/data3D/0/points", "/cameraImages/1/pose/rotation/w", and "/". These examples have probably been attached to an ImageFile. Here is an example absolute pathName of a node in a pose tree that has not yet been attached to an ImageFile: "/pose/rotation/w".
A technical aside: the elementName of a root node does not appear in absolute pathnames, since the "path" is between the staring node (the root) and the ending node. By convention, in this API, a root node has the empty string ("") as its elementName.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
FloatPrecision FloatNode::precision | ( | ) | const |
Get declared precision of the floating point number.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |
double FloatNode::value | ( | ) | const |
Get IEEE floating point value stored.
If precision is PrecisionSingle, the single precision value is returned as a double. If precision is PrecisionDouble, the double precision value is returned as a double.
ErrorImageFileNotOpen | |
ErrorInternal | All objects in undocumented state |