16 template <
typename ContentType>
17 class Branch<std::vector<ContentType>>
29 explicit Branch(
const std::string& branch_name,
30 std::vector<ContentType>* handle =
nullptr)
32 size_{branch_name +
"/" +
constants::SIZE_NAME},
33 data_{branch_name +
"/data"} {}
50 void load() final
override {
52 this->
handle_->resize(size_.get());
53 for (std::size_t i_vec{0}; i_vec < size_.get(); i_vec++) {
55 (*(this->
handle_))[i_vec] = data_.get();
68 void save() final
override {
69 size_.update(this->
handle_->size());
71 for (std::size_t i_vec{0}; i_vec < this->
handle_->size(); i_vec++) {
72 data_.update(this->
handle_->at(i_vec));
#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(Reader &f) final override
pure virtual method for loading data from the input file
Definition: VectorBranch.h:35
Branch(const std::string &branch_name, std::vector< ContentType > *handle=nullptr)
We create two child data sets, one to hold the successive sizes of the vectors and one to hold all of...
Definition: VectorBranch.h:29
void load() final override
Load a vector from the input file.
Definition: VectorBranch.h:50
void attach(Writer &f) final override
pure virtual method for saving structure
Definition: VectorBranch.h:77
Branch< std::size_t > size_
the data set of sizes of the vectors
Definition: VectorBranch.h:85
void save() final override
Save a vector to the output file.
Definition: VectorBranch.h:68
Branch< ContentType > data_
the data set holding the content of all the vectors
Definition: VectorBranch.h:87
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