ppap4lmp  0.7.2
Generator Class Referenceabstract

Generator is an abstract class to generate data. More...

#include <generator.h>

Inheritance diagram for Generator:
Collaboration diagram for Generator:

Public Member Functions

virtual ShPtr< Elementget_element (const Json &name=nullptr)=0
 Get a shared pointer of Element class.
 
virtual ShPtr< Generatorget_generator (const Json &name=nullptr)=0
 Get a shared pointer of Generator class.
 
virtual void accessed_by_instance_of (const Str &classname)=0
 Set class name of an instance calling Element::check_required_keys. More...
 
void book_to_generate_data ()
 Appoint to this Generator object. More...
 
void generate_data ()
 Hello to this Generator object. More...
 
void finish_using_generated_data ()
 Goodbye to this object. More...
 
const Vec< UpdatePair > & get_update_chain ()
 Get update_chain of this object. More...
 

Protected Member Functions

void merge_update_chain (const Vec< UpdatePair > &new_chain)
 

Protected Attributes

Vec< UpdatePairupdate_chain
 

Detailed Description

Generator is an abstract class to generate data.

This class is a superclass of Element class.

This class stores a chain (sequence) of UpdatePair objects which describes a process how Element::data will be generated and updated. In addition, by using GenDict and GenList class, which are subclasses of this class, one can group Element objects in one Generator object and control all updating processes associated with the Element objects.

Definition at line 41 of file generator.h.

Member Function Documentation

◆ accessed_by_instance_of()

virtual void Generator::accessed_by_instance_of ( const Str classname)
pure virtual

Set class name of an instance calling Element::check_required_keys.

Parameters
classnameA string to be assigned to Element::accessing_classname.
Returns
None.

Implemented in Element, GenDict, GenList, and PyElement.

◆ book_to_generate_data()

void Generator::book_to_generate_data ( )

Appoint to this Generator object.

Returns
None.

Definition at line 57 of file generator.cpp.

◆ finish_using_generated_data()

void Generator::finish_using_generated_data ( )

Goodbye to this object.

Returns
None.

Definition at line 77 of file generator.cpp.

◆ generate_data()

void Generator::generate_data ( )

Hello to this Generator object.

Returns
None.

This method calls Element::update_data for all the UpdatePair objects in update_chain, that is, executing whole updating process associated with this object. By executing this method, Element::data in this Element object (or Element objects in this GenDict or GenList object) is ready to be used (filled with values).

Definition at line 67 of file generator.cpp.

Here is the caller graph for this function:

◆ get_update_chain()

const Vec< UpdatePair > & Generator::get_update_chain ( )

Get update_chain of this object.

Returns
Constant reference to Vec<UpdatePair>.

This method is mainly used in Element::append_updater to access update_chain of Updater::ext_generator.

Definition at line 87 of file generator.cpp.

◆ merge_update_chain()

void Generator::merge_update_chain ( const Vec< UpdatePair > &  new_chain)
protected

Merge a given chain of UpdatePair objects to update_chain.

Parameters
new_chainList of UpdatePair objects to be merged.
Returns
None.

In merging a chain of UpdatePair objects, relative orders of UpdatePair objects in the new_chain and update_chain are retained so that dependency order of the updating process will be preserved. During the merging, duplication of UpdatePair objects will be removed. If there is no explicit preference, elements in the new_chain will be appended to the end of update_chain. This method is thread-unsafe because it accesses update_chain thread-globally. Ensure this method is not called in a multithreading context.

Definition at line 15 of file generator.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ update_chain

Vec<UpdatePair> Generator::update_chain
protected

Chain (sequence) of UpdatePair objects. It describes a process how Element::data is generated and updated. This chain of UpdatePair objects is executed one by one using generate_data. In this updating process, the Element objects (the first items of UpdatePair) uses the Updater objects (the second items of UpdatePair) to update their Element::data. This member can be extended only in Element::append_updater.

Definition at line 52 of file generator.h.


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