ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
e57::StructureNodeImpl Class Reference

#include <StructureNodeImpl.h>

Inheritance diagram for e57::StructureNodeImpl:
Collaboration diagram for e57::StructureNodeImpl:

Public Member Functions

 StructureNodeImpl (ImageFileImplWeakPtr destImageFile)
 
 ~StructureNodeImpl () override=default
 
NodeType type () const override
 
bool isTypeEquivalent (NodeImplSharedPtr ni) override
 
bool isDefined (const ustring &pathName) override
 
void setAttachedRecursive () override
 
virtual int64_t childCount () const
 
virtual NodeImplSharedPtr get (int64_t index)
 
NodeImplSharedPtr get (const ustring &pathName) override
 
virtual void set (int64_t index, NodeImplSharedPtr ni)
 
void set (const ustring &pathName, NodeImplSharedPtr ni, bool autoPathCreate=false) override
 
void set (const StringList &fields, unsigned level, NodeImplSharedPtr ni, bool autoPathCreate=false) override
 
virtual void append (NodeImplSharedPtr ni)
 
void checkLeavesInSet (const StringSet &pathNames, NodeImplSharedPtr origin) override
 
void writeXml (ImageFileImplSharedPtr imf, CheckedFile &cf, int indent, const char *forcedFieldName=nullptr) override
 
void dump (int indent=0, std::ostream &os=std::cout) const override
 
- Public Member Functions inherited from e57::NodeImpl
void checkImageFileOpen (const char *srcFileName, int srcLineNumber, const char *srcFunctionName) const
 
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
 
bool isAttached () const
 
void setParent (NodeImplSharedPtr parent, const ustring &elementName)
 
bool isTypeConstrained ()
 
void checkBuffers (const std::vector< SourceDestBuffer > &sdbufs, bool allowMissing)
 
bool findTerminalPosition (const NodeImplSharedPtr &target, uint64_t &countFromLeft)
 
virtual ~NodeImpl ()=default
 

Protected Member Functions

NodeImplSharedPtr lookup (const ustring &pathName) override
 
- Protected Member Functions inherited from e57::NodeImpl
 NodeImpl (ImageFileImplWeakPtr destImageFile)
 
NodeImploperator= (NodeImpl &n)
 
NodeImplSharedPtr getRoot ()
 

Protected Attributes

std::vector< NodeImplSharedPtrchildren_
 
- Protected Attributes inherited from e57::NodeImpl
ImageFileImplWeakPtr destImageFile_
 
NodeImplWeakPtr parent_
 
ustring elementName_
 
bool isAttached_
 

Detailed Description

Definition at line 35 of file StructureNodeImpl.h.

Constructor & Destructor Documentation

◆ StructureNodeImpl()

StructureNodeImpl::StructureNodeImpl ( ImageFileImplWeakPtr  destImageFile)

Definition at line 36 of file StructureNodeImpl.cpp.

References e57::NodeImpl::checkImageFileOpen().

◆ ~StructureNodeImpl()

e57::StructureNodeImpl::~StructureNodeImpl ( )
overridedefault

Member Function Documentation

◆ append()

void StructureNodeImpl::append ( NodeImplSharedPtr  ni)
virtual

don't checkImageFileOpen, set() will do it

Create new node at end of list with integer field name

Definition at line 364 of file StructureNodeImpl.cpp.

References childCount(), and set().

◆ checkLeavesInSet()

void StructureNodeImpl::checkLeavesInSet ( const StringSet pathNames,
NodeImplSharedPtr  origin 
)
overridevirtual

don't checkImageFileOpen

Not a leaf node, so check all our children

Implements e57::NodeImpl.

Definition at line 373 of file StructureNodeImpl.cpp.

References children_.

◆ childCount()

int64_t StructureNodeImpl::childCount ( ) const
virtual

◆ dump()

void StructureNodeImpl::dump ( int  indent = 0,
std::ostream &  os = std::cout 
) const
overridevirtual

don't checkImageFileOpen

Reimplemented from e57::NodeImpl.

Reimplemented in e57::VectorNodeImpl.

Definition at line 458 of file StructureNodeImpl.cpp.

References children_, e57::NodeImpl::dump(), QtCompat::endl(), e57::space(), and type().

◆ get() [1/2]

NodeImplSharedPtr StructureNodeImpl::get ( const ustring pathName)
overridevirtual

◆ get() [2/2]

◆ isDefined()

bool StructureNodeImpl::isDefined ( const ustring pathName)
overridevirtual

◆ isTypeEquivalent()

bool StructureNodeImpl::isTypeEquivalent ( NodeImplSharedPtr  ni)
overridevirtual

don't checkImageFileOpen

Same node type?

Downcast to shared_ptr<StructureNodeImpl>

Same number of children?

Check each child is equivalent

Check if matching field name is in same position (to speed things up)

Children in different order, so lookup by name and check if equal to our child

Types match

Implements e57::NodeImpl.

Reimplemented in e57::VectorNodeImpl.

Definition at line 48 of file StructureNodeImpl.cpp.

References childCount(), children_, and e57::E57_STRUCTURE.

◆ lookup()

NodeImplSharedPtr StructureNodeImpl::lookup ( const ustring pathName)
overrideprotectedvirtual

don't checkImageFileOpen

empty pointer

Find child with elementName that matches first field in path

empty pointer

Remove first field in path

Call lookup on child object with remaining fields in path name

Absolute pathname and we aren't at the root

Find root of the tree

Call lookup on root

Reimplemented from e57::NodeImpl.

Definition at line 147 of file StructureNodeImpl.cpp.

References children_, e57::NodeImpl::destImageFile_, fields, e57::NodeImpl::getRoot(), e57::NodeImpl::isRoot(), and e57::NodeImpl::pathName().

Referenced by get(), and isDefined().

◆ set() [1/3]

void e57::StructureNodeImpl::set ( const StringList fields,
unsigned  level,
NodeImplSharedPtr  ni,
bool  autoPathCreate = false 
)
overridevirtual

Reimplemented from e57::NodeImpl.

◆ set() [2/3]

void StructureNodeImpl::set ( const ustring pathName,
NodeImplSharedPtr  ni,
bool  autoPathCreate = false 
)
overridevirtual

Path may be absolute or relative with several levels. Break string into individual levels.

Relative path, starting from current object, e.g. "foo/17/bar"

Absolute path (starting from root), e.g. "/foo/17/bar"

Reimplemented from e57::NodeImpl.

Definition at line 253 of file StructureNodeImpl.cpp.

References e57::NodeImpl::checkImageFileOpen(), e57::NodeImpl::destImageFile_, QtCompat::endl(), fields, e57::NodeImpl::getRoot(), e57::NodeImpl::pathName(), and set().

◆ set() [3/3]

void StructureNodeImpl::set ( int64_t  index,
NodeImplSharedPtr  ni 
)
virtual

Allow index == current number of elements, interpret as append

Enforce "set once" policy, only allow append

Verify that child is destined for same ImageFile as this is

Field name is string version of index value, e.g. "14"

If this struct is type constrained, can't add new child

Reimplemented in e57::VectorNodeImpl.

Definition at line 209 of file StructureNodeImpl.cpp.

References e57::NodeImpl::checkImageFileOpen(), children_, e57::NodeImpl::destImageFile(), e57::E57_ERROR_CHILD_INDEX_OUT_OF_BOUNDS, e57::E57_ERROR_DIFFERENT_DEST_IMAGEFILE, e57::E57_ERROR_HOMOGENEOUS_VIOLATION, e57::E57_ERROR_SET_TWICE, E57_EXCEPTION2, e57::NodeImpl::elementName(), e57::NodeImpl::isTypeConstrained(), e57::NodeImpl::pathName(), and e57::toString().

Referenced by append(), set(), and e57::VectorNodeImpl::set().

◆ setAttachedRecursive()

void StructureNodeImpl::setAttachedRecursive ( )
overridevirtual

Mark this node as attached to an ImageFile

Not a leaf node, so mark all our children

Reimplemented from e57::NodeImpl.

Definition at line 105 of file StructureNodeImpl.cpp.

References children_, and e57::NodeImpl::isAttached_.

◆ type()

NodeType StructureNodeImpl::type ( ) const
overridevirtual

don't checkImageFileOpen

Implements e57::NodeImpl.

Reimplemented in e57::VectorNodeImpl.

Definition at line 41 of file StructureNodeImpl.cpp.

References e57::E57_STRUCTURE.

Referenced by dump().

◆ writeXml()

void StructureNodeImpl::writeXml ( ImageFileImplSharedPtr  imf,
CheckedFile cf,
int  indent,
const char *  forcedFieldName = nullptr 
)
overridevirtual

don't checkImageFileOpen

If this struct is the root for the E57 file, add name space declarations Note the prototype of a CompressedVector is a separate tree, so don't want to write out namespaces if not the ImageFile root

If user didn't explicitly declare a default namespace, use the current E57 standard one.

Write all children nested inside Structure element

Write closing tag

XML element has no child elements

Implements e57::NodeImpl.

Reimplemented in e57::VectorNodeImpl.

Definition at line 385 of file StructureNodeImpl.cpp.

References children_, e57::E57_V1_0_URI, e57::NodeImpl::elementName_, e57::NodeImpl::isRoot(), and e57::space().

Member Data Documentation

◆ children_


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