MeshLib Python Docs
Loading...
Searching...
No Matches

Public Member Functions

Object __getitem__ (self, int i)
None __init__ (self, std_vector_std_shared_ptr_Object children)
None __init__ (self, ConstChildren arg0)
typing.Iterator[Object__iter__ (self)
bool empty (self)
int size (self)

Static Public Member Functions

None __init__ (*args, **kwargs)

Static Public Attributes

 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__() [1/3]

None mrmeshpy.ConstChildren.__init__ ( * args,
** kwargs )
static

◆ __init__() [2/3]

None mrmeshpy.ConstChildren.__init__ ( self,
std_vector_std_shared_ptr_Object children )

◆ __init__() [3/3]

None mrmeshpy.ConstChildren.__init__ ( self,
ConstChildren arg0 )
Implicit copy constructor.

Member Function Documentation

◆ __getitem__()

Object mrmeshpy.ConstChildren.__getitem__ ( self,
int i )

◆ __iter__()

typing.Iterator[Object] mrmeshpy.ConstChildren.__iter__ ( self)

◆ empty()

bool mrmeshpy.ConstChildren.empty ( self)

◆ size()

int mrmeshpy.ConstChildren.size ( self)

Member Data Documentation

◆ Storage

mrmeshpy.ConstChildren.Storage = std_vector_std_shared_ptr_Object
static

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