diff --git a/psrdada_cpp/effelsberg/edd/VLBI.cuh b/psrdada_cpp/effelsberg/edd/VLBI.cuh index c53b4c0be8c262c0de35cbe2814eefcb1bf31c53..24093d0949e780cac611b9eee28fcbfc1ef19cb2 100644 --- a/psrdada_cpp/effelsberg/edd/VLBI.cuh +++ b/psrdada_cpp/effelsberg/edd/VLBI.cuh @@ -27,6 +27,7 @@ class VDIFHeaderView public: VDIFHeaderView(const uint32_t* data); void setDataLocation(const uint32_t* _data); + const uint32_t* getDataLocation() const; uint32_t getVersionNumber() const; bool isValid() const; uint32_t getSecondsFromReferenceEpoch() const; @@ -54,6 +55,8 @@ class VDIFHeader : public VDIFHeaderView public: VDIFHeader(); + VDIFHeader(const VDIFHeader &v); + VDIFHeader& operator=(const VDIFHeader& other); // return pointer to the data block for low level manipulation uint32_t* getData(); diff --git a/psrdada_cpp/effelsberg/edd/src/VLBI.cu b/psrdada_cpp/effelsberg/edd/src/VLBI.cu index 65fe79cf23ac410b29fc7a653196059e6a27029a..7199e73719a0ca9ef39978c75e8d6e7d1349fa0e 100644 --- a/psrdada_cpp/effelsberg/edd/src/VLBI.cu +++ b/psrdada_cpp/effelsberg/edd/src/VLBI.cu @@ -19,6 +19,10 @@ void VDIFHeaderView::setDataLocation(const uint32_t* _data) { data = _data; }; +const uint32_t* VDIFHeaderView::getDataLocation() const { + return data; +}; + bool VDIFHeaderView::isValid() const { return (getBitsValue(data[0], 31, 31) == 0); } @@ -91,6 +95,22 @@ VDIFHeader::VDIFHeader() : VDIFHeaderView(data) setBitsWithValue(data[2], 29, 31, 1); } +VDIFHeader::VDIFHeader(const VDIFHeader &v): VDIFHeaderView(data) +{ + for (int i = 0; i < 8; i++) { + data[i] = v.getDataLocation()[i]; + } + setDataLocation(data); +} + +VDIFHeader& VDIFHeader::operator=(const VDIFHeader& other) +{ + for (int i = 0; i < 8; i++) { + data[i] = other.getDataLocation()[i]; + } + return *this; +} + uint32_t *VDIFHeader::getData() { return data; } void VDIFHeader::setInvalid() { setBitsWithValue(data[0], 31, 31, 1); }