Skip to content

Commit

Permalink
Added MdfReader::PartialRead function and MdfConverter writer.
Browse files Browse the repository at this point in the history
  • Loading branch information
ihedvall committed Jul 17, 2024
1 parent 5bf2254 commit fd98cec
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mdflib/mdflib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<ClCompile Include="src\mdf4writer.cpp" />
<ClCompile Include="src\mdfblock.cpp" />
<ClCompile Include="src\mdfbuslogger.cpp" />
<ClCompile Include="src\mdfconverter.cpp" />
<ClCompile Include="src\mdffactory.cpp" />
<ClCompile Include="src\mdffile.cpp" />
<ClCompile Include="src\mdfhelper.cpp" />
Expand Down Expand Up @@ -348,6 +349,7 @@
<ClInclude Include="src\mdf4writer.h" />
<ClInclude Include="src\mdfblock.h" />
<ClInclude Include="src\mdfbuslogger.h" />
<ClInclude Include="src\mdfconverter.h" />
<ClInclude Include="src\platform.h" />
<ClInclude Include="src\pr3block.h" />
<ClInclude Include="src\rd4block.h" />
Expand Down
6 changes: 6 additions & 0 deletions mdflib/mdflib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@
<ClCompile Include="src\dgrange.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\mdfconverter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\at4block.h">
Expand Down Expand Up @@ -551,5 +554,8 @@
<ClInclude Include="src\dgrange.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\mdfconverter.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions mdflib/src/mdffactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ MdfWriter* MdfFactory::CreateMdfWriterEx(MdfWriterType type) {
writer = new MdfBusLogger();
break;
}

case MdfWriterType::MdfConverter: {
writer = new MdfConverter();
break;
}

default:
break;
Expand Down
10 changes: 10 additions & 0 deletions mdflibrary/src/MdfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,15 @@ bool MdfReader::ReadData(MdfDataGroup^ group) {
reader_->ReadData(*data_group) : false;
}

bool MdfReader::ReadPartialData(MdfDataGroup^ group,
UInt64 min_sample,
UInt64 max_sample) {
auto* data_group = group->group_;
return reader_ != nullptr && data_group != nullptr ?
reader_->ReadPartialData(*data_group,
static_cast<size_t>(min_sample),
static_cast<size_t>(max_sample)) : false;
}

}

2 changes: 1 addition & 1 deletion mdflibrary/src/MdfReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ref class MdfReader {
bool ReadMeasurementInfo();
bool ReadEverythingButData();
bool ReadData( MdfDataGroup^ group);

bool ReadPartialData( MdfDataGroup^ group, UInt64 min_sample, UInt64 max_sample);
protected:
!MdfReader();
private:
Expand Down
1 change: 1 addition & 0 deletions mdflibrary/src/MdfWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum class MdfWriterType : int {
Mdf3Basic = 0, ///< Basic MDF version 3 writer.
Mdf4Basic = 1, ///< Basic MDF version 4 writer.
MdfBusLogger = 2, ///< Bus Logger MDF 4 version only
MdfConverter = 3, ///< MDF writer for MDF 4 conversion applications.
};

/** \brief Enumerate that defines how the raw data is stored. By default
Expand Down

0 comments on commit fd98cec

Please sign in to comment.