ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
e57::NodeImpl Class Referenceabstract

#include <NodeImpl.h>

Inheritance diagram for e57::NodeImpl:
Collaboration diagram for e57::NodeImpl:

Public Member Functions

virtual NodeType type () const =0
 
void checkImageFileOpen (const char *srcFileName, int srcLineNumber, const char *srcFunctionName) const
 
virtual bool isTypeEquivalent (NodeImplSharedPtr ni)=0
 
bool isRoot () const
 
NodeImplSharedPtr parent ()
 
ustring pathName () const
 
ustring relativePathName (const NodeImplSharedPtr &origin, ustring childPathName=ustring()) const
 
ustring elementName () const
 
ImageFileImplSharedPtr destImageFile ()
 
ustring imageFileName () const
 
virtual bool isDefined (const ustring &pathName)=0
 
bool isAttached () const
 
virtual void setAttachedRecursive ()
 
void setParent (NodeImplSharedPtr parent, const ustring &elementName)
 
bool isTypeConstrained ()
 
virtual NodeImplSharedPtr get (const ustring &pathName)
 
virtual void set (const ustring &pathName, NodeImplSharedPtr ni, bool autoPathCreate=false)
 
virtual void set (const StringList &fields, unsigned level, NodeImplSharedPtr ni, bool autoPathCreate=false)
 
virtual void checkLeavesInSet (const StringSet &pathNames, NodeImplSharedPtr origin)=0
 
void checkBuffers (const std::vector< SourceDestBuffer > &sdbufs, bool allowMissing)
 
bool findTerminalPosition (const NodeImplSharedPtr &target, uint64_t &countFromLeft)
 
virtual void writeXml (ImageFileImplSharedPtr imf, CheckedFile &cf, int indent, const char *forcedFieldName=nullptr)=0
 
virtual ~NodeImpl ()=default
 
virtual void dump (int indent=0, std::ostream &os=std::cout) const
 

Protected Member Functions

 NodeImpl (ImageFileImplWeakPtr destImageFile)
 
NodeImploperator= (NodeImpl &n)
 
virtual NodeImplSharedPtr lookup (const ustring &)
 
NodeImplSharedPtr getRoot ()
 

Protected Attributes

ImageFileImplWeakPtr destImageFile_
 
NodeImplWeakPtr parent_
 
ustring elementName_
 
bool isAttached_
 

Detailed Description

Definition at line 37 of file NodeImpl.h.

Constructor & Destructor Documentation

◆ ~NodeImpl()

virtual e57::NodeImpl::~NodeImpl ( )
virtualdefault

◆ NodeImpl()

NodeImpl::NodeImpl ( ImageFileImplWeakPtr  destImageFile)
protected

Definition at line 35 of file NodeImpl.cpp.

References checkImageFileOpen().

Member Function Documentation

◆ checkBuffers()

void NodeImpl::checkBuffers ( const std::vector< SourceDestBuffer > &  sdbufs,
bool  allowMissing 
)

this node is prototype of CompressedVector

don't checkImageFileOpen

Check that all buffers are same size

Add each pathName to set, error if already in set (a duplicate pathName in sdbufs)

Check no bad fields in sdbufs

Traverse tree recursively, checking that all nodes are listed in sdbufs

Definition at line 271 of file NodeImpl.cpp.

References checkLeavesInSet(), e57::E57_ERROR_BUFFER_DUPLICATE_PATHNAME, e57::E57_ERROR_BUFFER_SIZE_MISMATCH, e57::E57_ERROR_PATH_UNDEFINED, E57_EXCEPTION2, isDefined(), pathName(), and e57::toString().

◆ checkImageFileOpen()

void NodeImpl::checkImageFileOpen ( const char *  srcFileName,
int  srcLineNumber,
const char *  srcFunctionName 
) const

◆ checkLeavesInSet()

virtual void e57::NodeImpl::checkLeavesInSet ( const StringSet pathNames,
NodeImplSharedPtr  origin 
)
pure virtual

◆ destImageFile()

◆ dump()

◆ elementName()

ustring NodeImpl::elementName ( ) const

Definition at line 119 of file NodeImpl.cpp.

References checkImageFileOpen(), and elementName_.

Referenced by relativePathName(), e57::StructureNodeImpl::set(), and setParent().

◆ findTerminalPosition()

bool NodeImpl::findTerminalPosition ( const NodeImplSharedPtr target,
uint64_t &  countFromLeft 
)

don't checkImageFileOpen

Recursively visit child nodes

Recursively visit child nodes

Definition at line 313 of file NodeImpl.cpp.

References e57::StructureNodeImpl::childCount(), e57::E57_BLOB, e57::E57_COMPRESSED_VECTOR, e57::E57_FLOAT, e57::E57_INTEGER, e57::E57_SCALED_INTEGER, e57::E57_STRING, e57::E57_STRUCTURE, e57::E57_VECTOR, and type().

◆ get()

NodeImplSharedPtr NodeImpl::get ( const ustring pathName)
virtual

This is common virtual function for terminal E57 element types: Integer, ScaledInteger, Float, Blob. The non-terminal types override this virtual function. Only absolute pathNames make any sense here, because the terminal types can't have children, so relative pathNames are illegal.

Forward call to the non-terminal root node

Reimplemented in e57::StructureNodeImpl.

Definition at line 233 of file NodeImpl.cpp.

References pathName().

◆ getRoot()

NodeImplSharedPtr NodeImpl::getRoot ( )
protected

don't checkImageFileOpen

Definition at line 182 of file NodeImpl.cpp.

Referenced by e57::StructureNodeImpl::lookup(), and e57::StructureNodeImpl::set().

◆ imageFileName()

ustring NodeImpl::imageFileName ( ) const

don't checkImageFileOpen

Definition at line 147 of file NodeImpl.cpp.

References destImageFile_.

◆ isAttached()

bool NodeImpl::isAttached ( ) const

◆ isDefined()

virtual bool e57::NodeImpl::isDefined ( const ustring pathName)
pure virtual

◆ isRoot()

bool NodeImpl::isRoot ( ) const

◆ isTypeConstrained()

bool NodeImpl::isTypeConstrained ( )

don't checkImageFileOpen A node is type constrained if any of its parents is an homo VECTOR or COMPRESSED_VECTOR with more than one child

We have a parent since we are not root

Downcast to shared_ptr<VectorNodeImpl>

If homogenous vector and have more than one child, then can't change them

Can't make any type changes to CompressedVector prototype. ??? what if hasn't been written to yet

Didn't find any constraining VECTORs or COMPRESSED_VECTORs in path above us, so our type is not constrained.

Definition at line 195 of file NodeImpl.cpp.

References e57::E57_COMPRESSED_VECTOR, and e57::E57_VECTOR.

Referenced by e57::StructureNodeImpl::set().

◆ isTypeEquivalent()

◆ lookup()

virtual NodeImplSharedPtr e57::NodeImpl::lookup ( const ustring )
inlineprotectedvirtual

Reimplemented in e57::StructureNodeImpl.

Definition at line 88 of file NodeImpl.h.

◆ operator=()

NodeImpl& e57::NodeImpl::operator= ( NodeImpl n)
protected

◆ parent()

NodeImplSharedPtr NodeImpl::parent ( )

If is root, then has self as parent (by convention)

Definition at line 59 of file NodeImpl.cpp.

References checkImageFileOpen(), isRoot(), and parent_.

Referenced by setParent().

◆ pathName()

◆ relativePathName()

ustring NodeImpl::relativePathName ( const NodeImplSharedPtr origin,
ustring  childPathName = ustring() 
) const

◆ set() [1/2]

void NodeImpl::set ( const StringList fields,
unsigned  level,
NodeImplSharedPtr  ni,
bool  autoPathCreate = false 
)
virtual

If get here, then tried to call set(fields...) on NodeImpl that wasn't a StructureNodeImpl, so that's an error

Reimplemented in e57::StructureNodeImpl.

Definition at line 263 of file NodeImpl.cpp.

References e57::E57_ERROR_BAD_PATH_NAME, and E57_EXCEPTION1.

◆ set() [2/2]

void NodeImpl::set ( const ustring pathName,
NodeImplSharedPtr  ni,
bool  autoPathCreate = false 
)
virtual

This is common virtual function for terminal E57 element types: Integer, ScaledInteger, Float, Blob. The non-terminal types override this virtual function. Only absolute pathNames make any sense here, because the terminal types can't have children, so relative pathNames are illegal.

Forward call to the non-terminal root node

Reimplemented in e57::StructureNodeImpl.

Definition at line 248 of file NodeImpl.cpp.

References pathName().

◆ setAttachedRecursive()

void NodeImpl::setAttachedRecursive ( )
virtual

Non-terminal node types (Structure, Vector, CompressedVector) will override this virtual function, to mark their children, codecs, prototypes

Reimplemented in e57::StructureNodeImpl, and e57::CompressedVectorNodeImpl.

Definition at line 139 of file NodeImpl.cpp.

References isAttached_.

Referenced by setParent().

◆ setParent()

void NodeImpl::setParent ( NodeImplSharedPtr  parent,
const ustring elementName 
)

don't checkImageFileOpen

First check if our parent_ is already set, throw E57_ERROR_ALREADY_HAS_PARENT The isAttached_ condition is to catch two errors: 1) if user attempts to use the ImageFile root as a child (e.g. root.set("x", root)) 2) if user attempts to reuse codecs or prototype trees of a CompressedVectorNode ??? what if CV not attached yet?

??? does caller do setParent first, so state is not messed up when throw?

If parent is attached then we are attached (and all of our children)

Definition at line 155 of file NodeImpl.cpp.

References e57::E57_ERROR_ALREADY_HAS_PARENT, E57_EXCEPTION2, elementName(), elementName_, isAttached_, parent(), parent_, pathName(), and setAttachedRecursive().

◆ type()

◆ writeXml()

virtual void e57::NodeImpl::writeXml ( ImageFileImplSharedPtr  imf,
CheckedFile cf,
int  indent,
const char *  forcedFieldName = nullptr 
)
pure virtual

Member Data Documentation

◆ destImageFile_

◆ elementName_

◆ isAttached_

◆ parent_

NodeImplWeakPtr e57::NodeImpl::parent_
protected

Definition at line 95 of file NodeImpl.h.

Referenced by isRoot(), parent(), pathName(), relativePathName(), and setParent().


The documentation for this class was generated from the following files: