NGen
Loading...
Searching...
No Matches
ngen::serialization::FileBackend::Reader Class Reference
+ Inheritance diagram for ngen::serialization::FileBackend::Reader:
+ Collaboration diagram for ngen::serialization::FileBackend::Reader:

Public Member Functions

 Reader (std::string path, std::ifstream stream, std::shared_ptr< const Index > index, IdPredicate read_scope)
 
auto find_latest (const std::string &id) -> expected< Record, BackendError > override
 Return the latest record for id within this Reader's scope.
 
auto find_at_step (const std::string &id, int64_t time_step) -> expected< Record, BackendError > override
 Return the record for id at the given simulation step.
 
auto find_at_simulation_timestamp (const std::string &id, int64_t simulation_timestamp) -> expected< Record, BackendError > override
 Return the record for id at the given simulation timestamp (seconds since Unix epoch).
 
virtual auto close () -> expected< void, BackendError >
 Optional explicit close.
 

Private Member Functions

expected< Record, BackendError > load_at (const Index::Entry &entry)
 

Private Attributes

std::string path_
 
std::ifstream in_
 
std::shared_ptr< const Index > index_
 
IdPredicate read_scope_
 

Constructor & Destructor Documentation

◆ Reader()

ngen::serialization::FileBackend::Reader::Reader ( std::string path,
std::ifstream stream,
std::shared_ptr< const Index > index,
IdPredicate read_scope )
inline

Member Function Documentation

◆ close()

virtual auto ngen::serialization::RecordBackend::Reader::close ( ) -> expected<void, BackendError>
inlinenodiscardvirtualinherited

Optional explicit close.

Default is a no-op success; backends with fallible read-side teardown override to surface those errors. After a successful close(), subsequent find_* calls have undefined behavior. with_reader calls this automatically on success.

◆ find_at_simulation_timestamp()

auto ngen::serialization::FileBackend::Reader::find_at_simulation_timestamp ( const std::string & id,
int64_t simulation_timestamp ) -> expected< Record, BackendError >
inlineoverridevirtual

Return the record for id at the given simulation timestamp (seconds since Unix epoch).

Multiple records with the same (id, simulation_timestamp) resolve to the latest checkpoint_epoch.

Implements ngen::serialization::RecordBackend::Reader.

References index_, load_at(), path_, and read_scope_.

◆ find_at_step()

auto ngen::serialization::FileBackend::Reader::find_at_step ( const std::string & id,
int64_t time_step ) -> expected< Record, BackendError >
inlineoverridevirtual

Return the record for id at the given simulation step.

Multiple records with the same (id, time_step) resolve to the latest checkpoint_epoch.

Implements ngen::serialization::RecordBackend::Reader.

References index_, load_at(), path_, and read_scope_.

◆ find_latest()

auto ngen::serialization::FileBackend::Reader::find_latest ( const std::string & id) -> expected< Record, BackendError >
inlineoverridevirtual

Return the latest record for id within this Reader's scope.

Ordering: highest time_step first, ties broken by highest checkpoint_epoch (latest write wins).

Implements ngen::serialization::RecordBackend::Reader.

References index_, load_at(), path_, and read_scope_.

◆ load_at()

expected< Record, BackendError > ngen::serialization::FileBackend::Reader::load_at ( const Index::Entry & entry)
inlineprivate

Member Data Documentation

◆ in_

std::ifstream ngen::serialization::FileBackend::Reader::in_
private

Referenced by load_at().

◆ index_

std::shared_ptr<const Index> ngen::serialization::FileBackend::Reader::index_
private

◆ path_

std::string ngen::serialization::FileBackend::Reader::path_
private

◆ read_scope_

IdPredicate ngen::serialization::FileBackend::Reader::read_scope_
private

The documentation for this class was generated from the following file: