ppap4lmp
0.7.2
|
Generator is an abstract class to generate data. More...
#include <generator.h>
Public Member Functions | |
virtual ShPtr< Element > | get_element (const Json &name=nullptr)=0 |
Get a shared pointer of Element class. | |
virtual ShPtr< Generator > | get_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< UpdatePair > | update_chain |
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.
|
pure virtual |
Set class name of an instance calling Element::check_required_keys.
classname | A string to be assigned to Element::accessing_classname. |
void Generator::book_to_generate_data | ( | ) |
void Generator::finish_using_generated_data | ( | ) |
void Generator::generate_data | ( | ) |
Hello to this Generator object.
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.
const Vec< UpdatePair > & Generator::get_update_chain | ( | ) |
Get update_chain of this object.
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.
|
protected |
Merge a given chain of UpdatePair objects to update_chain.
new_chain | List of UpdatePair objects to be merged. |
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.
|
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.