ppap4lmp  0.7.2
AddRename Class Reference

AddRename renames an existing property. More...

#include <add_rename.h>

Inheritance diagram for AddRename:
Collaboration diagram for AddRename:

Public Member Functions

 AddRename (const Str &key_old_, const Str &key_new_)
 Constructor of AddRename class. More...
 
ShPtr< AddRenameoverwrite (bool do_overwrite_=true)
 Allow overwriting an existing property by a renamed property with the same name. More...
 
- Public Member Functions inherited from Adder
 Updater ()=default
 Constructor of Updater class. More...
 
- Public Member Functions inherited from Updater
 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.
 
- Protected Member Functions inherited from Adder
virtual void compute_body (const ElPtr &elem, Json &data) override
 Compute properties and add them to Element::data given as a mutable reference. More...
 
- Protected Member Functions inherited from Updater
virtual void compute_common (const ElPtr &elem, Json &data)
 Common part of compute_body. More...
 

Private Attributes

bool do_overwrite = false
 
Str key_old
 
Str key_new
 

Additional Inherited Members

- Protected Attributes inherited from Updater
ShPtr< Generatorext_generator
 

Detailed Description

AddRename renames an existing property.

An object of this class simply renames an existing property of an Element object; that is, copies values for the existing property, store the values with a new user-defined name, and then deletes the old property.

About usage in Python, please see pybind::py_add_rename.

Definition at line 25 of file add_rename.h.

Constructor & Destructor Documentation

◆ AddRename()

AddRename::AddRename ( const Str key_old_,
const Str key_new_ 
)

Constructor of AddRename class.

Parameters
key_old_

A string key for an existing property to be renamed. This parameter is assigned to key_old.

key_new_A string key by which the old key for the existing property is renamed. This parameter is assigned to key_new.

Definition at line 16 of file add_rename.cpp.

Member Function Documentation

◆ overwrite()

ShPtr< AddRename > AddRename::overwrite ( bool  do_overwrite_ = true)

Allow overwriting an existing property by a renamed property with the same name.

Parameters
do_overwrite_A boolean, whether an existing property can be overwritten by a renamed property (default is true). This parameter is assigned to do_overwrite.
Returns
Shared pointer to this object.

Please be careful not to call this method in a multithreading context because it is thread-unsafe.

Definition at line 57 of file add_rename.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ do_overwrite

bool AddRename::do_overwrite = false
private

Whether overwriting an existing property whose name is the same as key_new (default is false).

Definition at line 30 of file add_rename.h.

◆ key_new

Str AddRename::key_new
private

New key by which the existing property is renamed.

Definition at line 38 of file add_rename.h.

◆ key_old

Str AddRename::key_old
private

Key for an existing property to be renamed.

Definition at line 34 of file add_rename.h.


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