-
Notifications
You must be signed in to change notification settings - Fork 1
Streams
Athena provides various stream classes for reading from and writing to binary data. These streams are designed to handle file-based operations, with memory-based operations and multithreaded writing planned for future implementation. Below is an overview of the current functionality.
The streamReader class serves as the base class for reading binary data from different sources. It provides the foundational operations needed to read and manage binary data streams. Derived classes, like fileStreamReader, implement specific reading mechanisms tailored to different sources.
fileStreamReader is a specialized class derived from streamReader designed for reading binary data from files. This class provides various functionalities to efficiently handle and navigate through different sections of a binary file.
Key features include:
- File-Based Operations: Reads data from a specified file path using standard C++ file streams.
- Section Management: Supports navigating between different sections of the file, allowing the user to move to the previous or next section easily.
- Selective Decompression: Sections of the file are compressed and can be decompressed individually on-demand. The decompression occurs only when the section is accessed for the first time.
- Data Handling: Provides methods to read individual objects and arrays of trivially copyable types from the current section of the file.
- Stream Integrity: Ensures the stream's status is good for reading operations and manages the position within the stream or section.
The streamWriter class is the base class for writing binary data to different destinations. It provides essential methods for writing and managing binary data streams. Currently, file-based writing is supported through its derived class, fileStreamWriter.
fileStreamWriter is a specialized class derived from streamWriter, designed for writing binary data to files. It offers a structured approach to file I/O, allowing data to be organized into separate sections that can be navigated and managed independently.
This class is particularly useful for complex file formats that require segmented data storage, as it provides efficient section management, ensuring data integrity and flexibility in how data is written and stored.
Key features include:
- File-Based Operations: Writes data to a specified file path using standard C++ file streams.
- Sectioned Writing: Data is organized into sections, which can be navigated and written to independently.
- Data Handling: Provides methods to write individual objects and arrays of trivially copyable types to the current section of the file.
- Stream Integrity: Ensures that the stream's status is good for writing operations and manages the position within the stream or section.
- Flushing Data: Supports flushing the written data to the file, ensuring all buffered data is properly saved.
-
Memory Streams: Memory-based stream classes (
memoryStreamReaderandmemoryStreamWriter) are currently under development and will be documented once they are available. - Multithreaded Writing: Future work will include support for multithreaded writing, allowing different sections to be written to simultaneously from different threads. However, each section will be restricted to a single thread at a time, ensuring thread safety and preventing race conditions within sections.
This section provides a comprehensive look at the current stream functionality within Athena, focusing on file-based operations and outlining future developments.