template<class T>
Loader class
Base template for loading objects from files or streams.
| Template parameters | |
|---|---|
| T | Type of object to load |
Abstract base class template for loading objects from streams or files.
The Loader class provides a common interface for reading objects of type T from input streams or files. This class serves as the foundation for specialized loaders that handle different file formats and object types.
Derived classes must implement:
- load(std::
istream&) - Load object from an input stream - getObject() - Access the object being loaded
Usage Example
class MyObjectLoader : public Loader<MyObject> { public: void load(std::istream& is) override { // Read from stream and populate object is >> getObject(); } protected: ObjectType& getObject() override { return m_object; } private: MyObject m_object; };
Derived classes
-
template<class FES, class Data>class GridFunctionLoaderBase
- Base class for loading grid functions from files or streams.
Public types
- using ObjectType = T
- Type of object being loaded.
Public functions
Protected functions
- auto getObject() -> ObjectType& pure virtual
- Gets a reference to the object being loaded.
Function documentation
template<class T>
void Rodin:: IO:: Loader<T>:: load(std::istream& is) pure virtual
Loads object from an input stream.
| Parameters | |
|---|---|
| is in | Input stream to read from |
This pure virtual method must be implemented by derived classes to read the object data from the provided stream.
template<class T>
void Rodin:: IO:: Loader<T>:: load(const boost::filesystem::path& is) virtual
Loads object from a file.
| Parameters | |
|---|---|
| is in | Path to the file to load |
Opens the file at the specified path and delegates to load(std::
template<class T>
ObjectType& Rodin:: IO:: Loader<T>:: getObject() pure virtual protected
Gets a reference to the object being loaded.
| Returns | Reference to the object |
|---|
This method provides access to the object being populated during loading. Derived classes must implement this to return their internal object reference.