Skip to content

Commit

Permalink
Adding first version of the rtdl format.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfpeterson committed Apr 2, 2014
1 parent 0e56ba9 commit bf195a5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ void BinFile::read_block<prenexus::OldPulse>(prenexus::OldPulse *buffer, const s
this->handle->read(reinterpret_cast<char *>(buffer),buffer_size*data_size);
}

template <>
void BinFile::read_block<prenexus::Rtdl>(prenexus::Rtdl *buffer, const std::size_t buffer_size) {
size_t data_size=sizeof(prenexus::Rtdl);

this->handle->read(reinterpret_cast<char *>(buffer),buffer_size*data_size);
}


template <typename NumT>
void BinFile::read(vector<NumT> & data, const size_t items)
{
Expand Down Expand Up @@ -255,3 +263,4 @@ template void BinFile::read<double>(vector<double> & data, const size_t items);
template void BinFile::read<prenexus::DasEvent>(vector<prenexus::DasEvent> & data, const size_t items);
template void BinFile::read<prenexus::Pulse>(vector<prenexus::Pulse> & data, const size_t items);
template void BinFile::read<prenexus::OldPulse>(vector<prenexus::OldPulse> & data, const size_t items);
template void BinFile::read<prenexus::Rtdl>(vector<prenexus::Rtdl> & data, const size_t items);
11 changes: 11 additions & 0 deletions prenexusrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ AllowedTypes getTypes() {
types.append("event");
types.append("pulseid");
types.append("oldpulseid");
types.append("rtdl");
return types;
}

Expand Down Expand Up @@ -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 <typename ComplexT>
void PrenexusRenderer::innerShowData(BinFile &file, size_t offset, size_t length)
{
Expand Down Expand Up @@ -157,6 +166,8 @@ void PrenexusRenderer::showData(BinFile & file, size_t offset, size_t length)
this->innerShowData<Pulse>(file, offset, length);
else if (this->m_dataDescr == "oldpulseid")
this->innerShowData<OldPulse>(file, offset, length);
else if (this->m_dataDescr == "rtdl")
this->innerShowData<Rtdl>(file, offset, length);
else
throw runtime_error("The code should have never gotten to this place");

Expand Down
17 changes: 17 additions & 0 deletions prenexustypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bf195a5

Please sign in to comment.