mirror of
https://github.com/gwm17/DaqGrimoire.git
synced 2024-11-23 03:08:52 -05:00
Redo file read api, to better facilitate time sorting multiple files.
This commit is contained in:
parent
09f1cf951c
commit
8f9b6a6246
|
@ -9,16 +9,18 @@ namespace DaqGrimoire {
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
static constexpr std::size_t Size = 24;
|
static constexpr std::size_t Size = 24;
|
||||||
|
static constexpr uint16_t InvalidBoard = 999;
|
||||||
|
static constexpr uint16_t InvalidChannel = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DYListData
|
struct DYListData
|
||||||
{
|
{
|
||||||
uint16_t board;
|
uint16_t board = Data::InvalidBoard;
|
||||||
uint16_t channel;
|
uint16_t channel = Data::InvalidChannel;
|
||||||
uint64_t timestamp;
|
uint64_t timestamp = 0;
|
||||||
uint32_t energy;
|
uint32_t energy = 0;
|
||||||
uint32_t energyShort;
|
uint32_t energyShort = 0;
|
||||||
uint32_t flags;
|
uint32_t flags = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace DaqGrimoire {
|
||||||
m_fileHandle->close();
|
m_fileHandle->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetNextEvent(DYListData& dataEvent)
|
bool ReadNextEvent()
|
||||||
{
|
{
|
||||||
if (!IsOpen() || IsEOF())
|
if (!IsOpen() || IsEOF())
|
||||||
return false;
|
return false;
|
||||||
|
@ -76,11 +76,13 @@ namespace DaqGrimoire {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::GetDataEventFromBuffer(m_bufferIter, dataEvent);
|
Utils::GetDataEventFromBuffer(m_bufferIter, m_dataEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DYListEvent& GetCurrentEvent() const { return m_dataEvent; }
|
||||||
|
|
||||||
|
|
||||||
const bool IsOpen() const { return m_fileHandle == nullptr ? false : m_fileHandle->is_open(); }
|
const bool IsOpen() const { return m_fileHandle == nullptr ? false : m_fileHandle->is_open(); }
|
||||||
const bool IsEOF() const { return m_isEOF; }
|
const bool IsEOF() const { return m_isEOF; }
|
||||||
|
@ -104,7 +106,6 @@ namespace DaqGrimoire {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::filesystem::path m_filepath;
|
std::filesystem::path m_filepath;
|
||||||
std::shared_ptr<std::ifstream> m_fileHandle;
|
std::shared_ptr<std::ifstream> m_fileHandle;
|
||||||
|
|
||||||
|
@ -114,6 +115,8 @@ namespace DaqGrimoire {
|
||||||
std::size_t m_fileSizeBytes; //in bytes
|
std::size_t m_fileSizeBytes; //in bytes
|
||||||
std::size_t m_fileSizeEvents; //in data events
|
std::size_t m_fileSizeEvents; //in data events
|
||||||
|
|
||||||
|
DYListData m_dataEvent;
|
||||||
|
|
||||||
bool m_isEOF;
|
bool m_isEOF;
|
||||||
|
|
||||||
char* m_bufferIter;
|
char* m_bufferIter;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user