Class OsfFile¶
Defined in File file.h
Inheritance Relationships¶
Derived Types¶
public ouster::sdk::osf::CallbackOsfFileClass CallbackOsfFilepublic ouster::sdk::osf::MemoryMappedOsfFileClass MemoryMappedOsfFilepublic ouster::sdk::osf::StreamOsfFileClass StreamOsfFile
Class Documentation¶
-
class OsfFile¶
Base class for OSF file handling.
This class provides an interface for reading OSF files, including methods for accessing metadata, reading data, and managing file state.
Subclassed by ouster::sdk::osf::CallbackOsfFile, ouster::sdk::osf::MemoryMappedOsfFile, ouster::sdk::osf::StreamOsfFile
Public Functions
-
explicit OsfFile(std::string path)¶
Opens the OSF file.
- Parameters:
path[in] The path to the OSF.
-
virtual ~OsfFile()¶
Cleans up any filebuffers/memory mapping.
-
virtual uint64_t size() const = 0¶
Returns the size of the OSF file.
- Returns:
The size of the OSF file in bytes.
-
std::string path() const¶
Returns the path of the OSF file.
- Returns:
The path of the OSF file.
-
ouster::sdk::core::Version version()¶
Returns the version of the OSF file.
- Returns:
The version of the OSF file.
-
OsfOffset metadata_offset()¶
Returns the osf_offset in the OSF file where the metadata section is located.
- Returns:
Offset to the metadata
-
OsfOffset chunks_offset()¶
Returns the osf_offset in the OSF file where the chunk section is located.
- Throws:
std::runtime_error – Exception on bad osf file.
- Returns:
Offset to the chunks
-
bool good() const¶
Return the status of the OSF file.
- Returns:
If the OSF file is good or not.
-
virtual OsfBuffer read(OsfOffset offset) = 0¶
Read the following span of bytes (represented by OsfOffset) into the provided OsfBuffer.
- Throws:
std::out_of_range – if the offset exceeds file size or is invalid.
- Parameters:
offset[in] The offset and number of bytes to read.
- Returns:
an OsfBuffer initialized with the data specified by the offset.
-
virtual OsfBuffer read(OsfOffset base_offset, OsfOffset offset) = 0¶
Read the following span of bytes (represented by OsfOffset) using the provided base offset into the provided OsfBuffer.
- Throws:
std::out_of_range – if the offset exceeds file size or is invalid.
- Parameters:
offset[in] The offset and number of bytes to read.
base_offset[in]
- Returns:
an OsfBuffer initialized with the data specified by the offset.
-
virtual void close()¶
Clears file handle and allocated resources.
In current mmap implementation it’s unmapping memory and essentially invalidates the memory addresses that might be captured within MessageRefs and Reader.
-
std::string to_string()¶
Debug helper method to dump OsfFile state to a string.
- Returns:
The string representation of OsfFile
-
OsfFile &operator=(const OsfFile&) = delete¶
Copy policy: Don’t allow the copying of the file handler.
-
OsfFile(OsfFile &&other)¶
Move policy: Allow transferring ownership of the underlying file handler (mmap).
- Parameters:
other[in] The OSF file to move
-
OsfFile &operator=(OsfFile &&other)¶
Move policy: Allow transferring ownership of the underlying file handler (mmap).
- Parameters:
other[in] The OSF file to move
-
OsfOffset get_header_chunk_offset()¶
Get a pointer to the start of the header chunk.
- Returns:
Pointer to the header chunk. nullptr if filestream is bad.
-
OsfOffset get_metadata_chunk_offset()¶
Get a pointer to the start of the header chunk.
- Returns:
Pointer to the metadata chunk. nullptr if filestream is bad.
Public Static Functions
Public Static Attributes
-
explicit OsfFile(std::string path)¶