MeshLib Python Docs
Loading...
Searching...
No Matches
mrmeshpy.ConstConstChildren Class Reference
Inheritance diagram for mrmeshpy.ConstConstChildren:

Public Member Functions

ConstObject __getitem__ (self, int i)
 __init__ (self, *args, **kwargs)
typing.Iterator[ConstObject] __iter__ (self)
bool empty (self)
int size (self)

Static Public Attributes

 ConstStorage = Const_std_vector_std_shared_ptr_Object
 Storage = std_vector_std_shared_ptr_Object

Detailed Description

Generated from:  MR::ConstChildren

read-only access to the children of an Object, as returned by Object::constChildren()
Object stores its children as std::shared_ptr<Object>, and a const Object cannot hand
them out directly without either dropping constness or copying the whole vector.
This class solves that: it is a lightweight non-owning view on the object's children,
which produces std::shared_ptr<const Object> on the fly. Typical use:
    for ( const auto & child : obj.constChildren() )
        processRecursively( *child );
It is also indexable, so a plain loop works too:
    for ( size_t i = 0; i < obj.constChildren().size(); ++i )
        process( *obj.constChildren()[i] );
The view refers to the object's own storage, so use it as a temporary and do not store
it: it is invalidated by anything that adds, removes or reorders the object's children,
exactly like an iterator of the underlying vector.

Constructor & Destructor Documentation

◆ __init__()

mrmeshpy.ConstConstChildren.__init__ ( self,
* args,
** kwargs )
__init__(*args, **kwargs)
Overloaded function.

1. __init__(self: meshlib.mrmeshpy.ConstConstChildren, children: meshlib.mrmeshpy.Const_std_vector_std_shared_ptr_Object) -> None

2. __init__(self: meshlib.mrmeshpy.ConstConstChildren, arg0: meshlib.mrmeshpy.ConstConstChildren) -> None

Implicit copy constructor.

3. __init__(self: meshlib.mrmeshpy.ConstConstChildren, : meshlib.mrmeshpy.ConstConstChildren) -> None

Member Function Documentation

◆ __getitem__()

ConstObject mrmeshpy.ConstConstChildren.__getitem__ ( self,
int i )

◆ __iter__()

typing.Iterator[ConstObject] mrmeshpy.ConstConstChildren.__iter__ ( self)

◆ empty()

bool mrmeshpy.ConstConstChildren.empty ( self)

◆ size()

int mrmeshpy.ConstConstChildren.size ( self)

Member Data Documentation

◆ ConstStorage

mrmeshpy.ConstConstChildren.ConstStorage = Const_std_vector_std_shared_ptr_Object
static

◆ Storage

mrmeshpy.ConstConstChildren.Storage = std_vector_std_shared_ptr_Object
static

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