e57::NodeImpl Class Referenceabstract

#include <NodeImpl.h>

Public Member Functions

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 getRoot ()
 
virtual NodeImplSharedPtr lookup (const ustring &)
 
 NodeImpl (ImageFileImplWeakPtr destImageFile)
 
NodeImploperator= (NodeImpl &n)
 

Protected Attributes

ImageFileImplWeakPtr destImageFile_
 
ustring elementName_
 
bool isAttached_
 
NodeImplWeakPtr parent_
 

Friends

class CompressedVectorWriterImpl
 
class Decoder
 
class Encoder
 
class StructureNodeImpl
 

Constructor & Destructor Documentation

◆ ~NodeImpl()

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

◆ NodeImpl()

NodeImpl::NodeImpl ( ImageFileImplWeakPtr  destImageFile)
protected

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

References checkLeavesInSet(), e57::E57_ERROR_BUFFER_DUPLICATE_PATHNAME, e57::E57_ERROR_BUFFER_SIZE_MISMATCH, e57::E57_ERROR_PATH_UNDEFINED, 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()

◆ elementName()

ustring NodeImpl::elementName ( ) const

◆ findTerminalPosition()

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

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

References pathName().

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

◆ getRoot()

NodeImplSharedPtr NodeImpl::getRoot ( )
protected

don't checkImageFileOpen

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

◆ imageFileName()

ustring NodeImpl::imageFileName ( ) const

don't checkImageFileOpen

References destImageFile_.

◆ isAttached()

◆ isDefined()

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

◆ isRoot()

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

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

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

◆ isTypeEquivalent()

◆ lookup()

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

Reimplemented in e57::StructureNodeImpl.

◆ operator=()

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

◆ parent()

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

References e57::E57_ERROR_BAD_PATH_NAME.

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

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

References pathName().

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

◆ 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::CompressedVectorNodeImpl, and e57::StructureNodeImpl.

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)

References e57::E57_ERROR_ALREADY_HAS_PARENT, 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

Friends And Related Function Documentation

◆ CompressedVectorWriterImpl

◆ Decoder

friend class Decoder
friend

◆ Encoder

friend class Encoder
friend

◆ StructureNodeImpl

Member Data Documentation

◆ destImageFile_

◆ elementName_

◆ isAttached_

◆ parent_

NodeImplWeakPtr e57::NodeImpl::parent_
protected

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