ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
ScriptInterface::ObjectList< ManagedType, BaseType > Class Template Referenceabstract

Owning list of object handles. More...

#include <ObjectList.hpp>

+ Inheritance diagram for ScriptInterface::ObjectList< ManagedType, BaseType >:
+ Collaboration diagram for ScriptInterface::ObjectList< ManagedType, BaseType >:

Public Types

using Base = ObjectContainer< ObjectList, ManagedType, BaseType >
 
using value_type = std::shared_ptr< ManagedType >
 

Public Member Functions

 ObjectList ()
 
 ~ObjectList () override
 
void do_construct (VariantMap const &params) override
 
void add (value_type const &element)
 Add an element to the list.
 
void remove (value_type const &element)
 Removes all occurrences of an element from the list.
 
auto constelements () const
 List elements.
 
void clear ()
 Clear the list.
 

Protected Member Functions

void do_destruct ()
 
Variant do_call_method (std::string const &method, VariantMap const &parameters) override
 

Private Member Functions

virtual void add_in_core (value_type const &obj_ptr)=0
 
virtual void remove_in_core (value_type const &obj_ptr)=0
 
virtual bool has_in_core (value_type const &obj_ptr) const =0
 

Detailed Description

template<typename ManagedType, class BaseType = ObjectHandle>
class ScriptInterface::ObjectList< ManagedType, BaseType >

Owning list of object handles.

Stored elements are cleared from the core during destruction. Due to how dynamic dispatch works, derived types must mark remove_in_core as final` and call do_destruct in their virtual destructor. This is to ensure that pure virtual functions called by clear cannot be executed in a type derived from the type currently being destructed, since derived types no longer exist at this point of the destruction sequence.

Template Parameters
ManagedTypeType of the managed objects, needs to be derived from ObjectHandle

Definition at line 53 of file ObjectList.hpp.

Member Typedef Documentation

◆ Base

◆ value_type

template<typename ManagedType , class BaseType = ObjectHandle>
using ScriptInterface::ObjectList< ManagedType, BaseType >::value_type = std::shared_ptr<ManagedType>

Definition at line 58 of file ObjectList.hpp.

Constructor & Destructor Documentation

◆ ObjectList()

◆ ~ObjectList()

template<typename ManagedType , class BaseType = ObjectHandle>
ScriptInterface::ObjectList< ManagedType, BaseType >::~ObjectList ( )
inlineoverride

Definition at line 83 of file ObjectList.hpp.

References ScriptInterface::get_value().

Member Function Documentation

◆ add()

◆ add_in_core()

◆ clear()

◆ do_call_method()

◆ do_construct()

◆ do_destruct()

◆ elements()

template<typename ManagedType , class BaseType = ObjectHandle>
auto const & ScriptInterface::ObjectList< ManagedType, BaseType >::elements ( ) const
inline

List elements.

Definition at line 127 of file ObjectList.hpp.

◆ has_in_core()

◆ remove()

template<typename ManagedType , class BaseType = ObjectHandle>
void ScriptInterface::ObjectList< ManagedType, BaseType >::remove ( value_type const element)
inline

◆ remove_in_core()


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