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

Method isTypeConstrained

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

??? use visitor?

Source from the content-addressed store, hash-verified

199
200//??? use visitor?
201bool NodeImpl::isTypeConstrained()
202{
203 // don't checkImageFileOpen
204 // A node is type constrained if any of its parents is an homo VECTOR or COMPRESSED_VECTOR with
205 // more than one child
206 NodeImplSharedPtr p( shared_from_this() );
207
208 while ( !p->isRoot() )
209 {
210 // We have a parent since we are not root
211 p = NodeImplSharedPtr( p->parent_ ); //??? check if bad ptr?
212
213 switch ( p->type() )
214 {
215 case TypeVector:
216 {
217 // Downcast to shared_ptr<VectorNodeImpl>
218 std::shared_ptr<VectorNodeImpl> ai( std::static_pointer_cast<VectorNodeImpl>( p ) );
219
220 // If homogeneous vector and have more than one child, then can't change them
221 if ( !ai->allowHeteroChildren() && ai->childCount() > 1 )
222 {
223 return ( true );
224 }
225 }
226 break;
227 case TypeCompressedVector:
228 // Can't make any type changes to CompressedVector prototype. ???
229 // what if hasn't been written to yet
230 return ( true );
231 default:
232 break;
233 }
234 }
235 // Didn't find any constraining VECTORs or COMPRESSED_VECTORs in path above us, so our type is
236 // not constrained.
237 return ( false );
238}
239
240NodeImplSharedPtr NodeImpl::get( const ustring &pathName )
241{

Callers

nothing calls this directly

Calls 4

isRootMethod · 0.45
typeMethod · 0.45
allowHeteroChildrenMethod · 0.45
childCountMethod · 0.45

Tested by

no test coverage detected