MeshLib Java Docs
Loading...
Searching...
No Matches
meshlib.ConstChildren Class Reference
Inheritance diagram for meshlib.ConstChildren:

Public Member Functions

 ConstChildren (java.lang.foreign.MemorySegment ptr, boolean owned, java.lang.Object owner)
 ConstChildren (meshlib.ConstChildren _other)
 ConstChildren (meshlib.std_vector_std_shared_ptr_MR_Object children)
meshlib.ConstChildren_Iterator begin ()
meshlib.ConstChildren_Iterator end ()
boolean empty ()
long size ()
meshlib.std_shared_ptr_const_MR_Object index (long i)
Public Member Functions inherited from meshlib.CppObject
final java.lang.foreign.MemorySegment rawPointer ()
final boolean isOwned ()
final void close ()
final java.lang.foreign.MemorySegment release ()

Additional Inherited Members

Protected Member Functions inherited from meshlib.CppObject
 CppObject (java.lang.foreign.MemorySegment ptr, java.util.function.Consumer< java.lang.foreign.MemorySegment > destroy, java.lang.Object owner)

Detailed Description

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. Generated from class MR::ConstChildren.

Instances created here own their C++ objects, see CppObject.

Constructor & Destructor Documentation

◆ ConstChildren() [1/3]

meshlib.ConstChildren.ConstChildren ( java.lang.foreign.MemorySegment ptr,
boolean owned,
java.lang.Object owner )

Wraps a pointer from the C bindings. If owned, the object is destroyed when the wrapper dies. owner is kept alive as long as this wrapper is. Not for normal use.

◆ ConstChildren() [2/3]

meshlib.ConstChildren.ConstChildren ( meshlib.ConstChildren _other)

Generated from constructor MR::ConstChildren::ConstChildren. The reference to things referred to by the parameter _other (if any) might be preserved in the constructed object.

Calls MR_ConstChildren_ConstructFromAnother().

◆ ConstChildren() [3/3]

meshlib.ConstChildren.ConstChildren ( meshlib.std_vector_std_shared_ptr_MR_Object children)

Generated from constructor MR::ConstChildren::ConstChildren. The reference to the parameter children might be preserved in the constructed object.

Calls MR_ConstChildren_Construct().

Member Function Documentation

◆ begin()

meshlib.ConstChildren_Iterator meshlib.ConstChildren.begin ( )

Generated from method MR::ConstChildren::begin. The reference to this object might be preserved in the return value.

Calls MR_ConstChildren_begin().

◆ empty()

boolean meshlib.ConstChildren.empty ( )

Generated from method MR::ConstChildren::empty.

Calls MR_ConstChildren_empty().

◆ end()

meshlib.ConstChildren_Iterator meshlib.ConstChildren.end ( )

Generated from method MR::ConstChildren::end. The reference to this object might be preserved in the return value.

Calls MR_ConstChildren_end().

◆ index()

meshlib.std_shared_ptr_const_MR_Object meshlib.ConstChildren.index ( long i)

Generated from method MR::ConstChildren::operator[].

Calls MR_ConstChildren_index().

◆ size()

long meshlib.ConstChildren.size ( )

Generated from method MR::ConstChildren::size.

Calls MR_ConstChildren_size().


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