![]() |
ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
|
Owning list of object handles. More...
#include <ObjectList.hpp>
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.
|
inlineoverride |
Definition at line 83 of file ObjectList.hpp.
|
inline |
Add an element to the list.
| element | The element to add. |
Definition at line 97 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< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::add(), and ScriptInterface::ObjectList< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::do_construct().
|
inline |
Clear the list.
Definition at line 132 of file ObjectList.hpp.
Referenced by ScriptInterface::ObjectList< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::do_call_method(), and ScriptInterface::ObjectList< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::do_destruct().
|
inlineoverrideprotected |
Definition at line 141 of file ObjectList.hpp.
|
inlineoverride |
Definition at line 85 of file ObjectList.hpp.
|
inlineprotected |
Definition at line 69 of file ObjectList.hpp.
|
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< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::add(), and ScriptInterface::ObjectList< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::remove().
|
inline |
Removes all occurrences of an element from the list.
| element | The element to remove. |
Definition at line 113 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< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::clear(), and ScriptInterface::ObjectList< AccumulatorBase, AutoParameters< ObjectList< AccumulatorBase, System::Leaf >, System::Leaf > >::remove().