From bf195a5e3e54e0ed5f3ba35f99d297770f03692b Mon Sep 17 00:00:00 2001 From: Peter Peterson Date: Wed, 2 Apr 2014 15:15:55 -0400 Subject: [PATCH] Adding first version of the rtdl format. --- bin_file.cpp | 9 +++++++++ prenexusrenderer.cpp | 11 +++++++++++ prenexustypes.hpp | 17 +++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/bin_file.cpp b/bin_file.cpp index b4ff16f..3ceaf7e 100644 --- a/bin_file.cpp +++ b/bin_file.cpp @@ -157,6 +157,14 @@ void BinFile::read_block(prenexus::OldPulse *buffer, const s this->handle->read(reinterpret_cast(buffer),buffer_size*data_size); } +template <> +void BinFile::read_block(prenexus::Rtdl *buffer, const std::size_t buffer_size) { + size_t data_size=sizeof(prenexus::Rtdl); + + this->handle->read(reinterpret_cast(buffer),buffer_size*data_size); +} + + template void BinFile::read(vector & data, const size_t items) { @@ -255,3 +263,4 @@ template void BinFile::read(vector & data, const size_t items); template void BinFile::read(vector & data, const size_t items); template void BinFile::read(vector & data, const size_t items); template void BinFile::read(vector & data, const size_t items); +template void BinFile::read(vector & data, const size_t items); diff --git a/prenexusrenderer.cpp b/prenexusrenderer.cpp index b7e42fd..d7530c2 100644 --- a/prenexusrenderer.cpp +++ b/prenexusrenderer.cpp @@ -28,6 +28,7 @@ AllowedTypes getTypes() { types.append("event"); types.append("pulseid"); types.append("oldpulseid"); + types.append("rtdl"); return types; } @@ -100,6 +101,14 @@ void printValue(ostream & os, const OldPulse & value) os << toStr(value.seconds, value.nanoseconds) << " \t" << value.event_index; } +void printValue(ostream & os, const Rtdl & value) +{ + os << toStr(value.seconds, value.nanoseconds) << " \t" + << value.pulseType << "\t" << value.vetoStatus << "\t" + << value.vetoStatus << "\t" << value.pulseCurrent << "\t" + << value.spare; +} + template void PrenexusRenderer::innerShowData(BinFile &file, size_t offset, size_t length) { @@ -157,6 +166,8 @@ void PrenexusRenderer::showData(BinFile & file, size_t offset, size_t length) this->innerShowData(file, offset, length); else if (this->m_dataDescr == "oldpulseid") this->innerShowData(file, offset, length); + else if (this->m_dataDescr == "rtdl") + this->innerShowData(file, offset, length); else throw runtime_error("The code should have never gotten to this place"); diff --git a/prenexustypes.hpp b/prenexustypes.hpp index ce09b4c..7c8259a 100644 --- a/prenexustypes.hpp +++ b/prenexustypes.hpp @@ -49,6 +49,23 @@ struct OldPulse uint64_t event_index; }; #pragma pack(pop) + +#pragma pack(push, 4) //Make sure the structure is the correct number of bytes. +struct Rtdl +{ + /// The number of nanoseconds since the seconds field. This is not necessarily less than one second. + uint32_t nanoseconds; + + /// The number of seconds since January 1, 1990. + uint32_t seconds; + + uint32_t pulseType; + uint32_t vetoStatus; + uint32_t pulseCurrent; + uint32_t spare; +}; +#pragma pack(pop) + } // namespace prenexus #endif