ppap4lmp  0.7.2
gen_dict.h
Go to the documentation of this file.
1 
8 #ifndef GEN_DICT_H
9 #define GEN_DICT_H
10 
11 #include <core/element.h>
12 
20 class GenDict : public Generator {
28  public:
40  GenDict(
41  const Map<Str,ShPtr<Generator>> &generator_dict_);
42  virtual ~GenDict() = default;
55  virtual ElPtr get_element(
56  const Json &name = nullptr) override;
70  const Json &name = nullptr) override;
72  virtual void accessed_by_instance_of(
73  const Str &classname) override;
80 };
81 
82 #endif
This file has a definition of Element class, which is one of the cores of this program.
ShPtr< Element > ElPtr
An alias for a shared pointer of Element class.
Definition: element.h:378
virtual ElPtr get_element(const Json &name=nullptr) override
Get a value in generator_dict as a shared pointer of Element class.
Definition: gen_dict.cpp:28
std::string Str
Str is an alias for string.
Definition: std.h:21
nlohmann::json Json
Json is an alias for nlohmann::json.
Definition: json.h:22
Map< Str, ShPtr< Generator > > generator_dict
Definition: gen_dict.h:27
std::unordered_set< T > Set
Set is an alias for unordered set (same as set in Python).
Definition: std.h:49
virtual void accessed_by_instance_of(const Str &classname) override
Set class name of an instance calling Element::check_required_keys.
Definition: gen_dict.cpp:55
GenDict is a dictionary (or map) of Generator objects.
Definition: gen_dict.h:20
virtual ShPtr< Generator > get_generator(const Json &name=nullptr) override
Get a value in generator_dict as a shared pointer of Generator class.
Definition: gen_dict.cpp:42
Generator is an abstract class to generate data.
Definition: generator.h:41
GenDict(const Map< Str, ShPtr< Generator >> &generator_dict_)
Constructor of GenDict class.
Definition: gen_dict.cpp:15
std::shared_ptr< T > ShPtr
ShPtr is an alias for shared pointer.
Definition: std.h:16
Set< Str > get_keys()
Get a set of the keys of generator_dict.
Definition: gen_dict.cpp:66
std::unordered_map< T, U > Map
Map is an alias for unordered map (same as dict in Python).
Definition: std.h:38