|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Reads back the time-sampled streams a SpatialCache wrote, in the same SpatialSample format it writes. More...
#include <SpatialReader.hpp>
Collaboration diagram for MayaFlux::IO::SpatialReader:Classes | |
| struct | Impl |
Public Member Functions | |
| void | close () |
| Release the archive. | |
| std::string | get_last_error () const |
| std::unordered_map< std::string, std::string > | get_metadata (const std::string &stream_name) const |
| Object level tags a stream was written with, the same form SpatialCache::write_metadata takes. | |
| size_t | get_sample_count (const std::string &stream_name) const |
| Number of samples in a stream, 0 for an unknown stream. | |
| const std::vector< std::string > & | get_stream_names () const |
| Names of the streams found at open(), in file order. | |
| std::optional< Portal::Graphics::PrimitiveTopology > | get_topology (const std::string &stream_name) const |
| Topology a stream is read as: POINT_LIST or LINE_STRIP. | |
| bool | is_open () const |
| bool | open (const std::string &filepath) |
| Open an Ogawa or HDF5 archive and index its streams. | |
| SpatialReader & | operator= (const SpatialReader &)=delete |
| SpatialReader & | operator= (SpatialReader &&) noexcept |
| std::optional< SpatialSample > | read_sample (const std::string &stream_name, size_t index) const |
| Read one sample of a stream. | |
| std::optional< double > | sample_time (const std::string &stream_name, size_t index) const |
| Time in seconds the archive assigns to a sample. | |
| SpatialReader () | |
| SpatialReader (const SpatialReader &)=delete | |
| SpatialReader (SpatialReader &&) noexcept | |
| ~SpatialReader () | |
Private Member Functions | |
| void | set_error (std::string msg) const |
Private Attributes | |
| std::unique_ptr< Impl > | m_impl |
| std::string | m_last_error |
Reads back the time-sampled streams a SpatialCache wrote, in the same SpatialSample format it writes.
Samples are read one at a time, on demand: nothing is loaded at open() beyond stream headers, so an archive of any length can be walked frame by frame.
A sample returned by read_sample() borrows the reader's own storage for that stream. It stays valid until the next read_sample() call for the same stream or close(); copy what must outlive that. Samples of different streams do not invalidate each other.
Only top level points and curves streams are read, which is everything SpatialCache writes. Any other object in the file is skipped with a warning. Attributes of types SpatialCache does not write are skipped with a warning. A curves stream is reported as LINE_STRIP: a file does not tell a list of pairs from curves of two vertices. Not safe to call from several threads at once.
Usage:
Definition at line 39 of file SpatialReader.hpp.