![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
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 ¶ms) 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 const & | elements () const |
| List elements. | |
| void | clear () |
| Clear the list. | |
Protected Member Functions | |
| void | do_destruct () |
| Variant | do_call_method (std::string const &method, VariantMap const ¶meters) 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 |
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.
| ManagedType | Type of the managed objects, needs to be derived from ObjectHandle |
Definition at line 53 of file ObjectList.hpp.
| using ScriptInterface::ObjectList< ManagedType, BaseType >::Base = ObjectContainer<ObjectList, ManagedType, BaseType> |
Definition at line 55 of file ObjectList.hpp.
| using ScriptInterface::ObjectList< ManagedType, BaseType >::value_type = std::shared_ptr<ManagedType> |
Definition at line 58 of file ObjectList.hpp.
|
inline |
Definition at line 76 of file ObjectList.hpp.
References ScriptInterface::make_vector_of_variants(), and ScriptInterface::AutoParameter::read_only.
|
inlineoverride |
Definition at line 83 of file ObjectList.hpp.
References stream.
|
inline |
Add an element to the list.
| element | The element to add. |
Definition at line 97 of file ObjectList.hpp.
References ScriptInterface::ObjectList< ManagedType, BaseType >::add_in_core(), and ScriptInterface::ObjectList< ManagedType, BaseType >::has_in_core().
Referenced by ScriptInterface::ObjectList< ManagedType, BaseType >::do_call_method().
|
privatepure virtual |
Implemented in ScriptInterface::Accumulators::AutoUpdateAccumulators, ScriptInterface::Constraints::Constraints, ScriptInterface::Shapes::Union, ScriptInterface::walberla::EKContainer, and ScriptInterface::walberla::EKReactions.
Referenced by ScriptInterface::ObjectList< ManagedType, BaseType >::add(), and ScriptInterface::ObjectList< ManagedType, BaseType >::do_construct().
|
inline |
Clear the list.
Definition at line 132 of file ObjectList.hpp.
References ScriptInterface::ObjectList< ManagedType, BaseType >::remove_in_core(), and stream.
Referenced by ScriptInterface::ObjectList< ManagedType, BaseType >::do_call_method(), and ScriptInterface::ObjectList< ManagedType, BaseType >::do_destruct().
|
inlineoverrideprotected |
Definition at line 141 of file ObjectList.hpp.
References ScriptInterface::ObjectList< ManagedType, BaseType >::add(), ScriptInterface::ObjectList< ManagedType, BaseType >::clear(), ScriptInterface::make_vector_of_variants(), ScriptInterface::none, ScriptInterface::ObjectList< ManagedType, BaseType >::remove(), and stream.
|
inlineoverride |
Definition at line 85 of file ObjectList.hpp.
References ScriptInterface::ObjectList< ManagedType, BaseType >::add_in_core(), params, and stream.
Referenced by ScriptInterface::Accumulators::AutoUpdateAccumulators::on_bind_system(), and ScriptInterface::Constraints::Constraints::on_bind_system().
|
inlineprotected |
Definition at line 69 of file ObjectList.hpp.
References ScriptInterface::ObjectList< ManagedType, BaseType >::clear(), and stream.
Referenced by ScriptInterface::Accumulators::AutoUpdateAccumulators::~AutoUpdateAccumulators(), and ScriptInterface::Constraints::Constraints::~Constraints().
|
inline |
List elements.
Definition at line 127 of file ObjectList.hpp.
|
privatepure virtual |
Implemented in ScriptInterface::Accumulators::AutoUpdateAccumulators, ScriptInterface::Constraints::Constraints, ScriptInterface::Shapes::Union, ScriptInterface::walberla::EKContainer, and ScriptInterface::walberla::EKReactions.
Referenced by ScriptInterface::ObjectList< ManagedType, BaseType >::add(), and ScriptInterface::ObjectList< ManagedType, BaseType >::remove().
|
inline |
Removes all occurrences of an element from the list.
| element | The element to remove. |
Definition at line 113 of file ObjectList.hpp.
References ScriptInterface::ObjectList< ManagedType, BaseType >::has_in_core(), ScriptInterface::ObjectList< ManagedType, BaseType >::remove_in_core(), and stream.
Referenced by ScriptInterface::ObjectList< ManagedType, BaseType >::do_call_method().
|
privatepure virtual |
Implemented in ScriptInterface::Accumulators::AutoUpdateAccumulators, ScriptInterface::Constraints::Constraints, ScriptInterface::Shapes::Union, ScriptInterface::walberla::EKContainer, and ScriptInterface::walberla::EKReactions.
Referenced by ScriptInterface::ObjectList< ManagedType, BaseType >::clear(), and ScriptInterface::ObjectList< ManagedType, BaseType >::remove().