MCPcopy Create free account
hub / github.com/PDAL/PDAL / setParent

Method setParent

plugins/e57/libE57Format/src/NodeImpl.cpp:158–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void NodeImpl::setParent( NodeImplSharedPtr parent, const ustring &elementName )
159{
160 // don't checkImageFileOpen
161
162 // First check if our parent_ is already set, throw
163 // ErrorAlreadyHasParent The isAttached_ condition is to catch two
164 // errors:
165 // 1) if user attempts to use the ImageFile root as a child (e.g.
166 // root.set("x", root)) 2) if user attempts to reuse codecs or prototype
167 // trees of a CompressedVectorNode
168 // ??? what if CV not attached yet?
169 if ( !parent_.expired() || isAttached_ )
170 {
171 // ??? does caller do setParent first, so state is not messed up when
172 // throw?
173 throw E57_EXCEPTION2( ErrorAlreadyHasParent,
174 "this->pathName=" + this->pathName() +
175 " newParent->pathName=" + parent->pathName() );
176 }
177
178 parent_ = parent;
179 elementName_ = elementName;
180
181 // If parent is attached then we are attached (and all of our children)
182 if ( parent->isAttached() )
183 {
184 setAttachedRecursive();
185 }
186}
187
188NodeImplSharedPtr NodeImpl::getRoot()
189{

Callers 1

setMethod · 0.45

Calls 2

pathNameMethod · 0.95
isAttachedMethod · 0.45

Tested by

no test coverage detected