17 template <
typename KeyType,
typename ValType>
18 class Branch<std::map<KeyType, ValType>>
30 explicit Branch(
const std::string& branch_name,
31 std::map<KeyType, ValType>* handle =
nullptr)
33 size_{branch_name +
"/" +
constants::SIZE_NAME},
34 keys_{branch_name +
"/keys"},
35 vals_{branch_name +
"/vals"} {}
47 void load() final
override {
49 for (std::size_t i_map{0}; i_map < size_.get(); i_map++) {
52 this->
handle_->emplace(keys_.get(), vals_.get());
72 void save() final
override {
73 size_.update(this->
handle_->size());
75 for (
auto const& [key, val] : *(this->
handle_)) {
#define hdtree_class_version(VERS)
define the version number for a class
Definition: ClassVersion.h:85
Type-specific base class to hold common data methods.
Definition: AbstractBranch.h:87
std::pair< std::string, int > save_type_
type this data that is being used to write
Definition: AbstractBranch.h:244
std::optional< std::pair< std::string, int > > load_type_
type this data is loading from
Definition: AbstractBranch.h:242
DataType * handle_
handle on current object in memory
Definition: AbstractBranch.h:247
std::string name_
name of branch
Definition: AbstractBranch.h:74
void attach(Writer &f) final override
pure virtual method for saving structure
Definition: MapBranch.h:83
void attach(Reader &f) final override
pure virtual method for loading data from the input file
Definition: MapBranch.h:56
void load() final override
Load a map from the input file.
Definition: MapBranch.h:47
Branch< KeyType > keys_
the data set holding the content of all the keys
Definition: MapBranch.h:94
Branch< ValType > vals_
the data set holding the content of all the vals
Definition: MapBranch.h:96
Branch(const std::string &branch_name, std::map< KeyType, ValType > *handle=nullptr)
We create three child data sets, one for the successive sizes of the maps and two to hold all the key...
Definition: MapBranch.h:30
Branch< std::size_t > size_
the data set of sizes of the vectors
Definition: MapBranch.h:92
void save() final override
Save a vector to the output file.
Definition: MapBranch.h:72
General data set.
Definition: GeneralBranch.h:46
Reading a file generated by fire.
Definition: Reader.h:24
Write the fire DataSets into a deterministic structure in the output HDF5 data file.
Definition: Writer.h:21
Geant4 does a GLOBAL definition of the keyword TRUE.
Definition: Atomic.cxx:3
Structure constants vital to serialization method.
Definition: Constants.h:15