MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / MdfReader

Class MdfReader

lib/mdflib/include/mdf/mdfreader.h:84–278  ·  view source on GitHub ↗

\class MdfReader mdfreader.h "mdf/mdfreader.h" * \brief Reader interface to an MDF file. * * This is the main interface when reading MDF3 and MDF4 files. */

Source from the content-addressed store, hash-verified

82 * This is the main interface when reading MDF3 and MDF4 files.
83 */
84class MdfReader {
85 public:
86 /** \brief Constructor for readers using an external file.
87 *
88 * This constructor is used when reading from an external file. The other
89 * way of reading from a C++ stream buffer. The latter is more complicated
90 * but more generic as it support environment without a file block
91 * storage.
92 *
93 * @param filename Full file path to the input file.
94 */
95 explicit MdfReader(std::string filename);
96
97 explicit MdfReader(const std::shared_ptr<std::streambuf>& buffer);
98 virtual ~MdfReader(); ///< Destructor that close any open file and destructs.
99
100 MdfReader() = delete;
101 MdfReader(const MdfReader&) = delete;
102 MdfReader(MdfReader&&) = delete;
103 MdfReader& operator=(const MdfReader&) = delete;
104 MdfReader& operator=(MdfReader&&) = delete;
105
106 /**
107 * Unique index for this reader. This index is typically used when fetching
108 * files from a database. The index itself is not used by the reader.
109 * @return An unique index.
110 */
111 [[nodiscard]] int64_t Index() const { return index_; }
112
113 /**
114 * Sets a unique index to this reader or actually its file. This index is
115 * typically retrieved from a database and makes finding files much easier
116 * than comparing paths.
117 * @param index Unique index.
118 */
119 void Index(int64_t index) { index_ = index; }
120
121 /// Checks if the file was read without errors.
122 /// \return True if the file was read OK.
123 [[nodiscard]] bool IsOk() const { return static_cast<bool>(instance_); }
124
125 /** \brief Return true if the file is marked as finalized
126 *
127 * This function returns true if the file is marked as finalized. This
128 * is done by checking the ID block.
129 * @return True if the file is marked as finalized.
130 */
131 [[nodiscard]] bool IsFinalized() const;
132
133 /// Returns a pointer to the MDF file. This file holds references to the MDF
134 /// blocks. \return Pointer to the MDF file object. Note it may return a null
135 /// pointer.
136 [[nodiscard]] const MdfFile* GetFile() const { return instance_.get(); }
137
138 /** \brief Returns the header (HD) block. */
139 [[nodiscard]] const IHeader* GetHeader() const;
140 /** \brief Returns the data group (DG) block. */
141 [[nodiscard]] IDataGroup* GetDataGroup(size_t order) const;

Callers 2

MdfReader.cppFile · 0.50
MdfReader.hFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected