|
| ScaledIntegerNode ()=delete |
|
| ScaledIntegerNode (const ImageFile &destImageFile, double scaledValue, double scaledMinimum, double scaledMaximum, double scale=1.0, double offset=0.0) |
| This second constructor creates an E57 element for storing a fixed point number but does the scaling for you.
|
|
| ScaledIntegerNode (const ImageFile &destImageFile, int rawValue, int minimum, int maximum, double scale=1.0, double offset=0.0) |
|
| ScaledIntegerNode (const ImageFile &destImageFile, int rawValue, int64_t minimum, int64_t maximum, double scale=1.0, double offset=0.0) |
|
| ScaledIntegerNode (const ImageFile &destImageFile, int64_t rawValue, int64_t minimum, int64_t maximum, double scale=1.0, double offset=0.0) |
| Create an E57 element for storing a fixed point number.
|
|
| ScaledIntegerNode (const Node &n) |
| Downcast a generic Node handle to an ScaledIntegerNode handle.
|
|
void | checkInvariant (bool doRecurse=true, bool doUpcast=true) const |
| Check whether ScaledIntegerNode 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.
|
|
int64_t | maximum () const |
| Get the declared maximum that the raw value may take.
|
|
int64_t | minimum () const |
| Get the declared minimum that the raw value may take.
|
|
double | offset () const |
| Get declared offset.
|
|
| operator Node () const |
| Upcast a ScaledIntegerNode 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.
|
|
int64_t | rawValue () const |
| Get raw unscaled integer value of element.
|
|
double | scale () const |
| Get declared scaling factor.
|
|
double | scaledMaximum () const |
| Get the declared scaled maximum that the scaled value may take.
|
|
double | scaledMinimum () const |
| Get the declared scaled minimum that the scaled value may take.
|
|
double | scaledValue () const |
| Get scaled value of element.
|
|
An E57 element encoding a fixed point number.
An ScaledIntegerNode is a terminal node (i.e. having no children) that holds a fixed point number encoded by an integer rawValue
, a double precision floating point scale
, an double precision floating point offset
, and integer minimum/maximum bounds.
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 rawValue
may be a number in the interval [minimum, maximum].
The scaledValue
is a calculated double precision floating point number derived from: scaledValue = rawValue*scale + offset.
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:
{
{
return;
}
if ( doUpcast )
{
}
{
}
{
}
{
}
}
Generic handle to any of the 8 types of E57 element objects.
Definition: E57Format.h:248
void checkInvariant(bool doRecurse=true, bool doDowncast=true)
Check whether Node class invariant is true.
Definition: Node.cpp:62
int64_t rawValue() const
Get raw unscaled integer value of element.
Definition: ScaledIntegerNode.cpp:284
ImageFile destImageFile() const
Get the ImageFile that was declared as the destination for the node when it was created.
Definition: ScaledIntegerNode.cpp:257
double scaledValue() const
Get scaled value of element.
Definition: ScaledIntegerNode.cpp:302
double scale() const
Get declared scaling factor.
Definition: ScaledIntegerNode.cpp:392
int64_t minimum() const
Get the declared minimum that the raw value may take.
Definition: ScaledIntegerNode.cpp:320
int64_t maximum() const
Get the declared maximum that the raw value may take.
Definition: ScaledIntegerNode.cpp:356
double offset() const
Get declared offset.
Definition: ScaledIntegerNode.cpp:410
void checkInvariant(bool doRecurse=true, bool doUpcast=true) const
Check whether ScaledIntegerNode class invariant is true.
Definition: ScaledIntegerNode.cpp:42
@ ErrorInvarianceViolation
class invariance constraint violation in debug mode
Definition: E57Exception.h:133
- See also
- Node
void ScaledIntegerNode::checkInvariant |
( |
bool |
doRecurse = true , |
|
|
bool |
doUpcast = true |
|
) |
| const |
Check whether ScaledIntegerNode class invariant is true.
- Parameters
-
[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.
- Postcondition
- No visible state is modified.
- Exceptions
-
ustring ScaledIntegerNode::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.
- Precondition
- The destination ImageFile must be open (i.e. destImageFile().isOpen()).
- Postcondition
- No visible state is modified.
- Returns
- The element name of the node, or "" if a root node.
- Exceptions
-
- See also
- Node::pathName, Node::parent, Node::isRoot
Node ScaledIntegerNode::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.
- Warning
- User algorithms that use this function to walk the tree must take care to handle the case where a node is its own parent (it is a root node). Use Node::isRoot to avoid infinite loops or infinite recursion.
- Precondition
- The destination ImageFile must be open (i.e. destImageFile().isOpen()).
- Postcondition
- No visible state is modified.
- Returns
- A smart Node handle referencing the parent node or this node if is a root node.
- Exceptions
-
- See also
- Node::isRoot, Node::isAttached, CompressedVectorNode::CompressedVectorNode, Node::elementName
ustring ScaledIntegerNode::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.
- Precondition
- The destination ImageFile must be open (i.e. destImageFile().isOpen()).
- Postcondition
- No visible state is modified.
- Returns
- The absolute path name of the node.
- Exceptions
-
- See also
- Node::elementName, Node::parent, Node::isRoot