| 324 | } |
| 325 | |
| 326 | bool NodeImpl::findTerminalPosition( const NodeImplSharedPtr &target, uint64_t &countFromLeft ) |
| 327 | { |
| 328 | // don't checkImageFileOpen |
| 329 | |
| 330 | if ( this == &*target ) //??? ok? |
| 331 | { |
| 332 | return true; |
| 333 | } |
| 334 | |
| 335 | switch ( type() ) |
| 336 | { |
| 337 | case TypeStructure: |
| 338 | { |
| 339 | auto sni = static_cast<StructureNodeImpl *>( this ); |
| 340 | |
| 341 | // Recursively visit child nodes |
| 342 | int64_t childCount = sni->childCount(); |
| 343 | for ( int64_t i = 0; i < childCount; ++i ) |
| 344 | { |
| 345 | if ( sni->get( i )->findTerminalPosition( target, countFromLeft ) ) |
| 346 | { |
| 347 | return true; |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | break; |
| 352 | |
| 353 | case TypeVector: |
| 354 | { |
| 355 | auto vni = static_cast<VectorNodeImpl *>( this ); |
| 356 | |
| 357 | // Recursively visit child nodes |
| 358 | int64_t childCount = vni->childCount(); |
| 359 | for ( int64_t i = 0; i < childCount; ++i ) |
| 360 | { |
| 361 | if ( vni->get( i )->findTerminalPosition( target, countFromLeft ) ) |
| 362 | { |
| 363 | return true; |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | break; |
| 368 | |
| 369 | case TypeCompressedVector: |
| 370 | break; //??? for now, don't search into contents of compressed vector |
| 371 | |
| 372 | case TypeInteger: |
| 373 | case TypeScaledInteger: |
| 374 | case TypeFloat: |
| 375 | case TypeString: |
| 376 | case TypeBlob: |
| 377 | countFromLeft++; |
| 378 | break; |
| 379 | } |
| 380 | |
| 381 | return ( false ); |
| 382 | } |
| 383 |
no test coverage detected