From 4864cb3f3e39e1b5b5627c1776727258a2d437c3 Mon Sep 17 00:00:00 2001 From: Tobias Winchen <tobias.winchen@rwth-aachen.de> Date: Wed, 8 Jan 2020 11:43:43 +0100 Subject: [PATCH] Added missing constructor, rule of 3 --- psrdada_cpp/effelsberg/edd/VLBI.cuh | 3 +++ psrdada_cpp/effelsberg/edd/src/VLBI.cu | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/psrdada_cpp/effelsberg/edd/VLBI.cuh b/psrdada_cpp/effelsberg/edd/VLBI.cuh index c53b4c0b..24093d09 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 65fe79cf..7199e737 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); } -- GitLab