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

Owning map of ObjectHandles. More...

#include <ObjectMap.hpp>

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

Public Types

using Base = ObjectContainer< ObjectMap, ManagedType, BaseType >
 

Public Member Functions

 ObjectMap ()
 
void do_construct (VariantMap const &params) override=0
 
void insert (KeyType const &key, std::shared_ptr< ManagedType > const &element)
 Add an element to the map.
 
KeyType insert (std::shared_ptr< ManagedType > const &element)
 Add an element to the map.
 
void erase (KeyType const &key)
 Removes all occurrences of an element from the map.
 
auto constelements () const
 Map elements.
 
void clear ()
 Clear the map.
 

Protected Member Functions

Variant do_call_method (std::string const &method, VariantMap const &parameters) override
 
void restore_from_checkpoint (VariantMap const &params)
 
KeyType get_key (Variant const &key) const
 

Private Member Functions

virtual KeyType insert_in_core (std::shared_ptr< ManagedType > const &obj_ptr)=0
 
virtual void insert_in_core (KeyType const &key, std::shared_ptr< ManagedType > const &obj_ptr)=0
 
virtual void erase_in_core (KeyType const &key)=0
 

Detailed Description

template<typename ManagedType, class BaseType = ObjectHandle, class KeyType = int>
class ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >

Owning map of ObjectHandles.

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

Definition at line 43 of file ObjectMap.hpp.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ ObjectMap()

Member Function Documentation

◆ clear()

◆ do_call_method()

◆ do_construct()

◆ elements()

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

Map elements.

Definition at line 103 of file ObjectMap.hpp.

◆ erase()

template<typename ManagedType , class BaseType = ObjectHandle, class KeyType = int>
void ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::erase ( KeyType const key)
inline

Removes all occurrences of an element from the map.

Parameters
keyIdentifier of the element to remove.

Definition at line 95 of file ObjectMap.hpp.

References ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::erase_in_core(), and ScriptInterface::get_value().

Referenced by ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::do_call_method().

◆ erase_in_core()

◆ get_key()

◆ insert() [1/2]

template<typename ManagedType , class BaseType = ObjectHandle, class KeyType = int>
void ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::insert ( KeyType const key,
std::shared_ptr< ManagedType > const element 
)
inline

Add an element to the map.

Parameters
keyIdentifier of the element to add.
elementThe element to add.

Definition at line 73 of file ObjectMap.hpp.

References ScriptInterface::get_value(), and ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::insert_in_core().

Referenced by ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::do_call_method().

◆ insert() [2/2]

template<typename ManagedType , class BaseType = ObjectHandle, class KeyType = int>
KeyType ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::insert ( std::shared_ptr< ManagedType > const element)
inline

Add an element to the map.

A free key is generated automatically.

Parameters
elementThe element to add.

Definition at line 84 of file ObjectMap.hpp.

References ScriptInterface::get_value(), and ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::insert_in_core().

◆ insert_in_core() [1/2]

template<typename ManagedType , class BaseType = ObjectHandle, class KeyType = int>
virtual void ScriptInterface::ObjectMap< ManagedType, BaseType, KeyType >::insert_in_core ( KeyType const key,
std::shared_ptr< ManagedType > const obj_ptr 
)
privatepure virtual

◆ insert_in_core() [2/2]

◆ restore_from_checkpoint()


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