#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) | |
NodeImpl & | operator= (NodeImpl &n) |
Protected Attributes | |
ImageFileImplWeakPtr | destImageFile_ |
ustring | elementName_ |
bool | isAttached_ |
NodeImplWeakPtr | parent_ |
Friends | |
class | CompressedVectorWriterImpl |
class | Decoder |
class | Encoder |
class | StructureNodeImpl |
|
virtualdefault |
|
protected |
References checkImageFileOpen().
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().
void NodeImpl::checkImageFileOpen | ( | const char * | srcFileName, |
int | srcLineNumber, | ||
const char * | srcFunctionName | ||
) | const |
Throw an exception if destImageFile (destImageFile_) isn't open
References destImageFile(), destImageFile_, and e57::E57_ERROR_IMAGEFILE_NOT_OPEN.
Referenced by e57::VectorNodeImpl::allowHeteroChildren(), e57::BlobNodeImpl::byteCount(), e57::CompressedVectorNodeImpl::childCount(), e57::StructureNodeImpl::childCount(), elementName(), e57::StructureNodeImpl::get(), e57::CompressedVectorNodeImpl::getCodecs(), e57::CompressedVectorNodeImpl::getPrototype(), isAttached(), e57::StructureNodeImpl::isDefined(), isRoot(), e57::IntegerNodeImpl::maximum(), e57::ScaledIntegerNodeImpl::maximum(), e57::FloatNodeImpl::maximum(), e57::IntegerNodeImpl::minimum(), e57::ScaledIntegerNodeImpl::minimum(), e57::FloatNodeImpl::minimum(), NodeImpl(), e57::ScaledIntegerNodeImpl::offset(), parent(), pathName(), e57::FloatNodeImpl::precision(), e57::ScaledIntegerNodeImpl::rawValue(), e57::BlobNodeImpl::read(), e57::CompressedVectorNodeImpl::reader(), relativePathName(), e57::ScaledIntegerNodeImpl::scale(), e57::ScaledIntegerNodeImpl::scaledMaximum(), e57::ScaledIntegerNodeImpl::scaledMinimum(), e57::ScaledIntegerNodeImpl::scaledValue(), e57::StructureNodeImpl::set(), e57::VectorNodeImpl::set(), e57::StructureNodeImpl::StructureNodeImpl(), e57::IntegerNodeImpl::value(), e57::StringNodeImpl::value(), e57::FloatNodeImpl::value(), e57::BlobNodeImpl::write(), and e57::CompressedVectorNodeImpl::writer().
|
pure virtual |
Implemented in e57::BlobNodeImpl, e57::CompressedVectorNodeImpl, e57::FloatNodeImpl, e57::IntegerNodeImpl, e57::ScaledIntegerNodeImpl, e57::StringNodeImpl, and e57::StructureNodeImpl.
Referenced by checkBuffers().
ImageFileImplSharedPtr NodeImpl::destImageFile | ( | ) |
don't checkImageFileOpen
References destImageFile_.
Referenced by e57::BlobNodeImpl::BlobNodeImpl(), checkImageFileOpen(), e57::CompressedVectorNodeImpl::reader(), e57::StructureNodeImpl::set(), e57::CompressedVectorNodeImpl::setCodecs(), e57::CompressedVectorNodeImpl::setPrototype(), e57::BlobNodeImpl::write(), and e57::CompressedVectorNodeImpl::writer().
ustring NodeImpl::elementName | ( | ) | const |
References checkImageFileOpen(), and elementName_.
Referenced by relativePathName(), e57::StructureNodeImpl::set(), and setParent().
bool NodeImpl::findTerminalPosition | ( | const NodeImplSharedPtr & | target, |
uint64_t & | countFromLeft | ||
) |
don't checkImageFileOpen
Recursively visit child nodes
Recursively visit child nodes
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().
|
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().
|
protected |
don't checkImageFileOpen
Referenced by e57::StructureNodeImpl::lookup(), and e57::StructureNodeImpl::set().
ustring NodeImpl::imageFileName | ( | ) | const |
don't checkImageFileOpen
References destImageFile_.
bool NodeImpl::isAttached | ( | ) | const |
References checkImageFileOpen(), and isAttached_.
Referenced by e57::CompressedVectorNodeImpl::reader(), e57::BlobNodeImpl::write(), and e57::CompressedVectorNodeImpl::writer().
Implemented in e57::BlobNodeImpl, e57::CompressedVectorNodeImpl, e57::FloatNodeImpl, e57::IntegerNodeImpl, e57::ScaledIntegerNodeImpl, e57::StringNodeImpl, and e57::StructureNodeImpl.
Referenced by checkBuffers().
bool NodeImpl::isRoot | ( | ) | const |
References checkImageFileOpen(), and parent_.
Referenced by e57::StructureNodeImpl::lookup(), parent(), pathName(), relativePathName(), and e57::StructureNodeImpl::writeXml().
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().
|
pure virtual |
|
protectedvirtual |
Reimplemented in e57::StructureNodeImpl.
NodeImplSharedPtr NodeImpl::parent | ( | ) |
If is root, then has self as parent (by convention)
References checkImageFileOpen(), isRoot(), and parent_.
Referenced by PathScripts.PathSimulatorGui.CAMSimTaskUi::accept(), Mod.PartDesign.WizardShaft.Shaft.Shaft::equilibrium(), PathScripts.PathSimulatorGui.CAMSimTaskUi::reject(), e57::StructureNodeImpl::set(), setParent(), and PathScripts.PathOpGui.TaskPanelPage::setParent().
ustring NodeImpl::pathName | ( | ) | const |
References checkImageFileOpen(), elementName_, isRoot(), and parent_.
Referenced by checkBuffers(), e57::BlobNodeImpl::checkLeavesInSet(), e57::CompressedVectorNodeImpl::checkLeavesInSet(), e57::FloatNodeImpl::checkLeavesInSet(), e57::IntegerNodeImpl::checkLeavesInSet(), e57::ScaledIntegerNodeImpl::checkLeavesInSet(), e57::StringNodeImpl::checkLeavesInSet(), e57::FloatNodeImpl::FloatNodeImpl(), get(), e57::StructureNodeImpl::get(), e57::IntegerNodeImpl::IntegerNodeImpl(), e57::BlobNodeImpl::isDefined(), e57::CompressedVectorNodeImpl::isDefined(), e57::FloatNodeImpl::isDefined(), e57::IntegerNodeImpl::isDefined(), e57::ScaledIntegerNodeImpl::isDefined(), e57::StringNodeImpl::isDefined(), e57::StructureNodeImpl::isDefined(), e57::StructureNodeImpl::lookup(), e57::BlobNodeImpl::read(), e57::ScaledIntegerNodeImpl::ScaledIntegerNodeImpl(), set(), e57::StructureNodeImpl::set(), e57::VectorNodeImpl::set(), e57::CompressedVectorNodeImpl::setCodecs(), setParent(), e57::CompressedVectorNodeImpl::setPrototype(), and e57::BlobNodeImpl::write().
ustring NodeImpl::relativePathName | ( | const NodeImplSharedPtr & | origin, |
ustring | childPathName = ustring() |
||
) | const |
Got to top and didn't find origin, must be error
Assemble relativePathName from right to left, recursively
References checkImageFileOpen(), e57::E57_ERROR_INTERNAL, elementName(), elementName_, isRoot(), and parent_.
Referenced by e57::BlobNodeImpl::checkLeavesInSet(), e57::FloatNodeImpl::checkLeavesInSet(), e57::IntegerNodeImpl::checkLeavesInSet(), e57::ScaledIntegerNodeImpl::checkLeavesInSet(), and e57::StringNodeImpl::checkLeavesInSet().
|
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().
|
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().
|
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().
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().
|
pure virtual |
Implemented in e57::BlobNodeImpl, e57::CompressedVectorNodeImpl, e57::FloatNodeImpl, e57::IntegerNodeImpl, e57::ScaledIntegerNodeImpl, e57::StringNodeImpl, e57::StructureNodeImpl, and e57::VectorNodeImpl.
Referenced by ArchProfile.ProfileTaskPanel::accept(), findTerminalPosition(), and ArchProfile.ProfileTaskPanel::retranslateUi().
|
pure virtual |
|
friend |
Referenced by e57::CompressedVectorNodeImpl::writer().
|
friend |
Referenced by e57::StructureNodeImpl::set().
|
protected |
|
protected |
Referenced by elementName(), pathName(), relativePathName(), setParent(), e57::BlobNodeImpl::writeXml(), e57::CompressedVectorNodeImpl::writeXml(), e57::FloatNodeImpl::writeXml(), e57::IntegerNodeImpl::writeXml(), e57::ScaledIntegerNodeImpl::writeXml(), e57::StringNodeImpl::writeXml(), e57::StructureNodeImpl::writeXml(), and e57::VectorNodeImpl::writeXml().
|
protected |
|
protected |
Referenced by isRoot(), parent(), pathName(), relativePathName(), and setParent().