Base class for banks that store objects of type T by integer ID and look them up by the name given in the JSON input file. More...
#include <bank_base.h>
Public Member Functions | |
| const T & | GetByID (const int id) const |
| Get the object by its ID. | |
| const T & | GetByName (const std::string &name) const |
| Get the object by its name in the JSON input file. | |
| int | GetIDByName (const std::string &name) const |
| Get the ID of an object by its name in the JSON input file. | |
Protected Member Functions | |
| virtual void | Build (const json &json_input)=0 |
| Build the bank. | |
Protected Attributes | |
| std::unordered_map< int, T > | id_object_map_ |
| ID to object map. | |
| std::unordered_map< std::string, int > | name_id_map_ |
| name to object ID map | |
Base class for banks that store objects of type T by integer ID and look them up by the name given in the JSON input file.
| T | Stored object type |
Definition at line 21 of file bank_base.h.
|
protectedpure virtual |
Build the bank.
| json_input | JSON input |
Implemented in hummingbird::BCBank, hummingbird::MaterialBank, and hummingbird::SourceBank.
|
inline |
Get the object by its ID.
| id | ID |
Definition at line 29 of file bank_base.h.
|
inline |
Get the object by its name in the JSON input file.
| name | Object name |
Definition at line 37 of file bank_base.h.
|
inline |
Get the ID of an object by its name in the JSON input file.
| name | Object name |
Definition at line 47 of file bank_base.h.
|
protected |
ID to object map.
Definition at line 53 of file bank_base.h.
|
protected |
name to object ID map
Definition at line 56 of file bank_base.h.