e57::StructureNodeImpl Class Reference

#include <StructureNodeImpl.h>

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Friends

class CompressedVectorReaderImpl
 

Constructor & Destructor Documentation

◆ StructureNodeImpl()

StructureNodeImpl::StructureNodeImpl ( ImageFileImplWeakPtr  destImageFile)

◆ ~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

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.

References children_.

◆ childCount()

int64_t StructureNodeImpl::childCount ( ) const
virtual

◆ 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.

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.

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

Referenced by get(), and isDefined().

◆ set() [1/3]

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

Check if trying to set the root node "/", which is illegal

Serial search for matching field name, if find match, have error since can't set twice

Enforce "set once" policy, don't allow reset

Recurse on child

Didn't find matching field name, so have a new child.

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

Check if we are at bottom level

At bottom, so append node at end of children

Not at bottom level, if not autoPathCreate have an error

Do autoPathCreate: Create nested Struct objects for extra field names in path

Reimplemented from e57::NodeImpl.

References e57::NodeImpl::checkImageFileOpen(), children_, e57::NodeImpl::destImageFile_, e57::E57_ERROR_HOMOGENEOUS_VIOLATION, e57::E57_ERROR_PATH_UNDEFINED, e57::E57_ERROR_SET_TWICE, e57::NodeImpl::isTypeConstrained(), e57::NodeImpl::parent(), e57::NodeImpl::pathName(), and e57::NodeImpl::StructureNodeImpl.

Referenced by draftguitools.gui_trackers.editTracker::move().

◆ 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.

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

Referenced by draftguitools.gui_trackers.editTracker::move().

◆ 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.

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::NodeImpl::elementName(), e57::NodeImpl::isTypeConstrained(), e57::NodeImpl::pathName(), and e57::toString().

Referenced by append(), draftguitools.gui_trackers.editTracker::move(), 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.

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

◆ type()

NodeType StructureNodeImpl::type ( ) const
overridevirtual

don't checkImageFileOpen

Implements e57::NodeImpl.

Reimplemented in e57::VectorNodeImpl.

References e57::E57_STRUCTURE.

Referenced by ArchProfile.ProfileTaskPanel::accept(), and ArchProfile.ProfileTaskPanel::retranslateUi().

◆ 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.

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

Friends And Related Function Documentation

◆ CompressedVectorReaderImpl

Member Data Documentation

◆ children_


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