|
| Data (const std::string &path, Reader *input_file=nullptr, DataType *handle=nullptr) |
| Attach ourselves to the input type after construction. More...
|
|
void | load (h5::Reader &f) final override |
| Loading this dataset from the file involves simply loading all of the members of the data type. More...
|
|
void | save (Writer &f) final override |
| pure virtual method for saving data More...
|
|
void | structure (Writer &f) final override |
| pure virtual method for saving structure More...
|
|
template<typename MemberType > |
void | attach (const std::string &name, MemberType &m, SaveLoad sl=SaveLoad::Both) |
| Attach a member object from the our data handle. More...
|
|
template<typename MemberType > |
void | rename (const std::string &old_name, const std::string &new_name, MemberType &m) |
| Rename a member variable. More...
|
|
| AbstractData (const std::string &path, Reader *input_file=nullptr, DataType *handle=nullptr) |
| Define the dataset path and provide an optional handle. More...
|
|
virtual | ~AbstractData () |
| Delete our object if we own it, otherwise do nothing. More...
|
|
virtual void | clear () |
| Define the clear function here to handle the most common cases. More...
|
|
virtual const DataType & | get () const |
| Get the current in-memory data. More...
|
|
int | version () const |
| Get the version number for the type we are loading from. More...
|
|
virtual void | update (const DataType &val) |
| Update the in-memory data object with the passed value. More...
|
|
| BaseData (const std::string &path) |
| Define the full in-file path to the data set of this data. More...
|
|
virtual | ~BaseData ()=default |
| virtual destructor so inherited classes can be properly destructed.
|
|
template<typename DataType, typename Enable = void>
class fire::io::Data< DataType, Enable >
General data set.
This is the top-level data set that will be used most often. It is meant to be used by a class which registers its member variables to this set via the io::DataSet<DataType>::attach method.
More complete documentation is kept in the documentation of the fire::io namespace; nevertheless, a short example is kept here.
class MyData {
public:
MyData() = default;
private:
template<typename Data>
d.attach("my_double",my_double_);
if (d.version() < 2) d.rename("old","new",new_);
else d.attach("new",new_);
}
my_double_ = -1;
new_ = 0;
}
private:
double my_double_;
int new_;
int i_wont_be_on_disk_;
};
#define fire_class_version(VERS)
define the version number for a class
Definition: ClassVersion.h:83
virtual void clear()
Define the clear function here to handle the most common cases.
Definition: AbstractData.h:177
void attach(const std::string &name, MemberType &m, SaveLoad sl=SaveLoad::Both)
Attach a member object from the our data handle.
Definition: Data.h:188
Data(const std::string &path, Reader *input_file=nullptr, DataType *handle=nullptr)
Attach ourselves to the input type after construction.
Definition: Data.h:116
empty struct for connecting a instance of Data and the type it wraps
Definition: Access.h:22
template<typename DataType , typename Enable = void>
|
inlinefinaloverridevirtual |
Loading this dataset from the file involves simply loading all of the members of the data type.
We catch a HighFive exception early here so that we can detail to the user which class is causing the read issue. This is especially helpful in the case of containers of user types since the issue is (probably) not coming from serialization of the container.
- Exceptions
-
Exception | if HighFive is unable to load any of the members. |
- Parameters
-
Implements fire::io::AbstractData< DataType >.
template<typename DataType , typename Enable = void>
template<typename MemberType >
Rename a member variable.
This is a simple helper-function wrapping attach which does the two calls for the user sharing the same member variable, creating one member for loading from the old_name and one member for writing to the new_name.
- Template Parameters
-
MemberType | type of member variable we are attaching |
- Parameters
-
[in] | old_name | name of member variable in version being read from file |
[in] | new_name | name of member variable in version being written to output file |
[in] | m | reference of member variable |