ppap4lmp
0.7.2
|
AddMap adds a new property by mapping from an existing property. More...
#include <add_map.h>
Public Member Functions | |
AddMap (const Str &key_ref_, const Str &key_new_, const Map< Json, Json > &mapping_) | |
Constructor of AddMap class. More... | |
ShPtr< AddMap > | overwrite (bool do_overwrite_=true) |
Allow overwriting an existing property by a new property with the same name. More... | |
![]() | |
Updater ()=default | |
Constructor of Updater class. More... | |
![]() | |
Updater ()=default | |
Constructor of Updater class. More... | |
void | compute (const ElPtr &elem, const int elementid, Json &data) |
Managing computation to update Element::data. More... | |
void | remove_from_skippable_elementids (const int elementid) |
Remove Element::elementid from skippable_elementids. More... | |
const ShPtr< Generator > & | get_ext_generator () |
Get ext_generator of this object. More... | |
Protected Member Functions | |
virtual void | compute_impl (Json &data, JsonToVoidFunc check_required_keys, JsonToBoolFunc check_optional_keys) override |
This method overrides Updater::compute_impl. More... | |
![]() | |
virtual void | compute_body (const ElPtr &elem, Json &data) override |
Compute properties and add them to Element::data given as a mutable reference. More... | |
![]() | |
virtual void | compute_common (const ElPtr &elem, Json &data) |
Common part of compute_body. More... | |
Private Attributes | |
bool | do_overwrite = false |
Str | key_ref |
Str | key_new |
Map< Json, Json > | mapping |
Additional Inherited Members | |
![]() | |
ShPtr< Generator > | ext_generator |
AddMap adds a new property by mapping from an existing property.
An object of this class owns a mapping. Domain of the mapping consists of values for an existing property of an Element object where the object of this class is appended to. Codomain of the mapping consists of values for a new property. Note that the domain must cover all values for the existing property.
About usage in Python, please see pybind::py_add_map.
Constructor of AddMap class.
key_ref_ | A string key for a reference property: an existing property to be used as domain of mapping. This parameter is assigned to key_ref. |
key_new_ | A string key for a new property to be added. Values for the new property are determined by mapping. This parameter is assigned to key_new. |
mapping_ | Dictionary defining a mapping from values for the reference property to values for the new property. Keys of the dictionary corresponds to domain of the mapping, and values of the dictionary corresponds to codomain of the mapping. Note that the keys must cover all values of the reference property in an Element object where the constructed object is appended to. This parameter is assigned to mapping. |
Definition at line 16 of file add_map.cpp.
|
overrideprotectedvirtual |
This method overrides Updater::compute_impl.
[key_new]
: any type [key_ref]
: any type (but, in most cases, integer or strings) Implements Updater.
Definition at line 28 of file add_map.cpp.
Allow overwriting an existing property by a new property with the same name.
do_overwrite_ | A boolean, whether an existing property can be overwritten by a new property (default is true ). This parameter is assigned to do_overwrite. |
Please be careful not to call this method in a multithreading context because it is thread-unsafe.
Definition at line 59 of file add_map.cpp.
|
private |
|
private |
|
private |
Mapping from values for an existing property specified by key_ref to values for a new property specified by key_new. Domain of the mapping consists of values for the existing property in Element::data of an Element object where this object is appended to. Codomain of the mapping consists of user-defined values for the new property to be added to the Element::data.