ppap4lmp  0.7.2
GenDict Class Reference

GenDict is a dictionary (or map) of Generator objects. More...

#include <gen_dict.h>

Inheritance diagram for GenDict:
Collaboration diagram for GenDict:

Public Member Functions

 GenDict (const Map< Str, ShPtr< Generator >> &generator_dict_)
 Constructor of GenDict class. More...
 
virtual ElPtr get_element (const Json &name=nullptr) override
 Get a value in generator_dict as a shared pointer of Element class. More...
 
virtual ShPtr< Generatorget_generator (const Json &name=nullptr) override
 Get a value in generator_dict as a shared pointer of Generator class. More...
 
virtual void accessed_by_instance_of (const Str &classname) override
 Set class name of an instance calling Element::check_required_keys. More...
 
Set< Strget_keys ()
 Get a set of the keys of generator_dict. More...
 
- Public Member Functions inherited from Generator
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...
 

Private Attributes

Map< Str, ShPtr< Generator > > generator_dict
 

Additional Inherited Members

- Protected Member Functions inherited from Generator
void merge_update_chain (const Vec< UpdatePair > &new_chain)
 
- Protected Attributes inherited from Generator
Vec< UpdatePairupdate_chain
 

Detailed Description

GenDict is a dictionary (or map) of Generator objects.

This class is a subclass of Generator class and stores an arbitrary number of Generator objects as a dictionary (map) of shared pointers of Generator class.

Definition at line 20 of file gen_dict.h.

Constructor & Destructor Documentation

◆ GenDict()

GenDict::GenDict ( const Map< Str, ShPtr< Generator >> &  generator_dict_)

Constructor of GenDict class.

Parameters
generator_dict_Dictionary of shared pointers of Generator class. This parameter is assigned to generator_dict.

This constructor is thread-unsafe because it accesses its members thread-globally. Ensure this constructor is not called in a multithreading context.

Definition at line 15 of file gen_dict.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ accessed_by_instance_of()

void GenDict::accessed_by_instance_of ( const Str classname)
overridevirtual

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

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

Implements Generator.

Definition at line 55 of file gen_dict.cpp.

◆ get_element()

ElPtr GenDict::get_element ( const Json name = nullptr)
overridevirtual

Get a value in generator_dict as a shared pointer of Element class.

Parameters
nameA string key in generator_dict.
Returns
A value of generator_dict up-casted to Element class.

One needs to get a value of generator_dict as Element when using its Element::data.

Implements Generator.

Definition at line 28 of file gen_dict.cpp.

Here is the call graph for this function:

◆ get_generator()

ShPtr< Generator > GenDict::get_generator ( const Json name = nullptr)
overridevirtual

Get a value in generator_dict as a shared pointer of Generator class.

Parameters
nameA string key in generator_dict.
Returns
A value of generator_dict.

One needs to get a value of generator_dict as Generator when storing that object.

Implements Generator.

Definition at line 42 of file gen_dict.cpp.

Here is the call graph for this function:

◆ get_keys()

Set< Str > GenDict::get_keys ( )

Get a set of the keys of generator_dict.

Returns
Set of strings.

Definition at line 66 of file gen_dict.cpp.

Member Data Documentation

◆ generator_dict

Map<Str,ShPtr<Generator> > GenDict::generator_dict
private

Dictionary of shared pointers of Generator class (keys are strings and values are shared pointers). The values can be a pointer of Element, GenDict or GenList class up-casted to a shared pointer of Generator class.

Definition at line 27 of file gen_dict.h.


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