mirror of
https://github.com/gwm17/DaqGrimoire.git
synced 2024-11-22 18:58:51 -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
|
||||
{
|
||||
static constexpr std::size_t Size = 24;
|
||||
static constexpr uint16_t InvalidBoard = 999;
|
||||
static constexpr uint16_t InvalidChannel = 999;
|
||||
}
|
||||
|
||||
struct DYListData
|
||||
{
|
||||
uint16_t board;
|
||||
uint16_t channel;
|
||||
uint64_t timestamp;
|
||||
uint32_t energy;
|
||||
uint32_t energyShort;
|
||||
uint32_t flags;
|
||||
uint16_t board = Data::InvalidBoard;
|
||||
uint16_t channel = Data::InvalidChannel;
|
||||
uint64_t timestamp = 0;
|
||||
uint32_t energy = 0;
|
||||
uint32_t energyShort = 0;
|
||||
uint32_t flags = 0;
|
||||
};
|
||||
|
||||
namespace Utils
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace DaqGrimoire {
|
|||
m_fileHandle->close();
|
||||
}
|
||||
|
||||
bool GetNextEvent(DYListData& dataEvent)
|
||||
bool ReadNextEvent()
|
||||
{
|
||||
if (!IsOpen() || IsEOF())
|
||||
return false;
|
||||
|
@ -76,11 +76,13 @@ namespace DaqGrimoire {
|
|||
return false;
|
||||
}
|
||||
|
||||
Utils::GetDataEventFromBuffer(m_bufferIter, dataEvent);
|
||||
Utils::GetDataEventFromBuffer(m_bufferIter, m_dataEvent);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const DYListEvent& GetCurrentEvent() const { return m_dataEvent; }
|
||||
|
||||
|
||||
const bool IsOpen() const { return m_fileHandle == nullptr ? false : m_fileHandle->is_open(); }
|
||||
const bool IsEOF() const { return m_isEOF; }
|
||||
|
@ -103,7 +105,6 @@ namespace DaqGrimoire {
|
|||
m_bufferEnd = m_bufferIter + m_fileHandle->gcount(); //one past the last datum
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::filesystem::path m_filepath;
|
||||
std::shared_ptr<std::ifstream> m_fileHandle;
|
||||
|
@ -114,6 +115,8 @@ namespace DaqGrimoire {
|
|||
std::size_t m_fileSizeBytes; //in bytes
|
||||
std::size_t m_fileSizeEvents; //in data events
|
||||
|
||||
DYListData m_dataEvent;
|
||||
|
||||
bool m_isEOF;
|
||||
|
||||
char* m_bufferIter;
|
||||
|
|
Loading…
Reference in New Issue
Block a user