template<class T>
Rodin::IO::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:

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

void load(std::istream& is) pure virtual
Loads object from an input stream.
void load(const boost::filesystem::path& is) virtual
Loads object from a file.

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::istream&). This provides a convenient file-based interface while reusing the stream loading logic.

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.