ppap4lmp  0.7.2
generator.h
Go to the documentation of this file.
1 
9 #ifndef GENERATOR_H
10 #define GENERATOR_H
11 
12 #include <alias/std.h>
13 #include <alias/json.h>
14 
15 class Element;
16 class Updater;
17 
27 using UpdatePair = std::pair<ShPtr<Element>,ShPtr<Updater>>;
28 
41 class Generator {
42  protected:
71  void merge_update_chain(
72  const Vec<UpdatePair> &new_chain);
73  public:
74  Generator() = default;
75  virtual ~Generator() = default;
78  const Json &name = nullptr) = 0;
81  const Json &name = nullptr) = 0;
91  virtual void accessed_by_instance_of(
92  const Str &classname) = 0;
98  void book_to_generate_data();
111  void generate_data();
127 };
128 
129 #endif
Updater is an abstract class to update data held by an Element object.
Definition: updater.h:34
virtual ShPtr< Element > get_element(const Json &name=nullptr)=0
Get a shared pointer of Element class.
virtual void accessed_by_instance_of(const Str &classname)=0
Set class name of an instance calling Element::check_required_keys.
std::string Str
Str is an alias for string.
Definition: std.h:21
std::pair< ShPtr< Element >, ShPtr< Updater > > UpdatePair
UpdatePair is a pair of shared pointer of Element class and Updater class.
Definition: generator.h:27
nlohmann::json Json
Json is an alias for nlohmann::json.
Definition: json.h:22
This file includes nlohmann/json and defines an alias for a JSON class.
void generate_data()
Hello to this Generator object.
Definition: generator.cpp:67
void merge_update_chain(const Vec< UpdatePair > &new_chain)
Definition: generator.cpp:15
std::vector< T > Vec
Vec is an alias for vector (same as list in Python).
Definition: std.h:27
Element inherits Generator class and contains data element (or entity) as a Json object.
Definition: element.h:42
This file includes a part of C++ Standard Template Library and defines aliases for them...
void finish_using_generated_data()
Goodbye to this object.
Definition: generator.cpp:77
Generator is an abstract class to generate data.
Definition: generator.h:41
Vec< UpdatePair > update_chain
Definition: generator.h:52
const Vec< UpdatePair > & get_update_chain()
Get update_chain of this object.
Definition: generator.cpp:87
std::shared_ptr< T > ShPtr
ShPtr is an alias for shared pointer.
Definition: std.h:16
virtual ShPtr< Generator > get_generator(const Json &name=nullptr)=0
Get a shared pointer of Generator class.
void book_to_generate_data()
Appoint to this Generator object.
Definition: generator.cpp:57