update parser (#5)

This commit is contained in:
tompzf
2026-01-16 11:40:02 +01:00
committed by GitHub
parent 5039a37131
commit 234be8917f
115 changed files with 14038 additions and 5380 deletions

View File

@@ -40,14 +40,24 @@ namespace asc
enum class EState {header, body, footer} eState = EState::header;
while (std::getline(fstream, ssLine))
{
// Compare two characters and two strings case insensitive
auto ichar_equals = [](char a, char b)
{
return std::tolower(static_cast<unsigned char>(a)) == std::tolower(static_cast<unsigned char>(b));
};
auto iequals = [&](const std::string& a, const std::string& b)
{
return std::equal(a.begin(), a.end(), b.begin(), b.end(), ichar_equals);
};
switch (eState)
{
case EState::header:
if (ssLine.compare(0, 18, "Begin TriggerBlock") == 0)
if (iequals(ssLine.substr(0, 18), "Begin TriggerBlock"))
eState = EState::body;
break;
case EState::body:
if (ssLine.compare(0, 16, "End TriggerBlock") == 0)
if (iequals(ssLine.substr(0, 16), "End TriggerBlock"))
eState = EState::footer;
else
ProcessSample(ssLine);
@@ -74,7 +84,7 @@ namespace asc
uint32_t CAscReader::GetMessageCount() const
{
return m_lstMessages.size();
return static_cast<uint32_t>(m_lstMessages.size());
}
uint32_t CAscReader::GetLoopCount() const

View File

@@ -5,6 +5,7 @@
#include <functional>
#include <filesystem>
#include <thread>
#include <atomic>
namespace asc
{
@@ -159,8 +160,8 @@ namespace asc
std::list<SCanMessage> m_lstMessages; ///< Vector with messages
std::list<SCanMessage>::iterator m_itCurrent; ///< Current iterator position
std::thread m_threadPlayback; ///< Playback thread.
bool m_bPlaybackThread = false; ///< Set when running playback thread
bool m_bPlayback = false; ///< Set when running playback
std::atomic_bool m_bPlaybackThread = false; ///< Set when running playback thread
std::atomic_bool m_bPlayback = false; ///< Set when running playback
std::atomic<uint32_t> m_uiLoopCount{ 0 }; ///< Counter how often the data set was sent
};
}