From 74d8e949bbbd50043779291121a5e2cc262b8963 Mon Sep 17 00:00:00 2001 From: JonathanMeans Date: Tue, 28 Jan 2020 08:36:46 -0500 Subject: [PATCH 1/2] Pull up DomainType accessors to base cphd Metadata class --- six/modules/c++/cphd/include/cphd/Metadata.h | 7 +++++++ .../c++/cphd/include/cphd/MetadataBase.h | 19 +++++++++++++++++++ six/modules/c++/cphd/source/Metadata.cpp | 10 ++++++++++ .../c++/cphd03/include/cphd03/Metadata.h | 12 +----------- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/six/modules/c++/cphd/include/cphd/Metadata.h b/six/modules/c++/cphd/include/cphd/Metadata.h index 97e2c8a54..0256eccaf 100644 --- a/six/modules/c++/cphd/include/cphd/Metadata.h +++ b/six/modules/c++/cphd/include/cphd/Metadata.h @@ -71,6 +71,13 @@ struct Metadata : MetadataBase size_t getCompressedSignalSize(size_t channel) const override; bool isCompressed() const override; + /*! + * Get domain type + * FX for frequency domain, + * TOA for time-of-arrival domain + */ + cphd::DomainType getDomainType() const override; + //! Get CPHD version std::string getVersion() const; diff --git a/six/modules/c++/cphd/include/cphd/MetadataBase.h b/six/modules/c++/cphd/include/cphd/MetadataBase.h index af2940050..545699659 100644 --- a/six/modules/c++/cphd/include/cphd/MetadataBase.h +++ b/six/modules/c++/cphd/include/cphd/MetadataBase.h @@ -25,6 +25,7 @@ #include #include +#include namespace cphd { @@ -86,6 +87,24 @@ struct MetadataBase return false; } + /*! + * Get domain type + * FX for frequency domain, + * TOA for time-of-arrival domain + */ + virtual cphd::DomainType getDomainType() const = 0; + + //! Is this CPHD formed in the transmit frequency domain? + bool isFX() const + { + return (getDomainType() == cphd::DomainType::FX); + } + + //! Is this CPHD formed in the Time of Arrival domain? + bool isTOA() const + { + return (getDomainType() == cphd::DomainType::TOA); + } }; } diff --git a/six/modules/c++/cphd/source/Metadata.cpp b/six/modules/c++/cphd/source/Metadata.cpp index 60765b149..c070d9d63 100644 --- a/six/modules/c++/cphd/source/Metadata.cpp +++ b/six/modules/c++/cphd/source/Metadata.cpp @@ -34,27 +34,37 @@ size_t Metadata::getNumChannels() const { return data.getNumChannels(); } + size_t Metadata::getNumVectors(size_t channel) const { return data.getNumVectors(channel); } + size_t Metadata::getNumSamples(size_t channel) const { return data.getNumSamples(channel); } + size_t Metadata::getNumBytesPerSample() const { return data.getNumBytesPerSample(); } + size_t Metadata::getCompressedSignalSize(size_t channel) const { return data.getCompressedSignalSize(channel); } + bool Metadata::isCompressed() const { return data.isCompressed(); } +cphd::DomainType Metadata::getDomainType() const +{ + return global.getDomainType(); +} + std::string Metadata::getVersion() const { return mVersion; diff --git a/six/modules/c++/cphd03/include/cphd03/Metadata.h b/six/modules/c++/cphd03/include/cphd03/Metadata.h index 618d4d561..eda3b9ef8 100644 --- a/six/modules/c++/cphd03/include/cphd03/Metadata.h +++ b/six/modules/c++/cphd03/include/cphd03/Metadata.h @@ -71,21 +71,11 @@ struct Metadata : cphd::MetadataBase size_t getNumSamples(size_t channel) const; // 0-based channel number size_t getNumBytesPerSample() const; // 2, 4, or 8 bytes/complex sample - bool isFX() const - { - return (getDomainType() == cphd::DomainType::FX); - } - - bool isTOA() const - { - return (getDomainType() == cphd::DomainType::TOA); - } - // returns "FX", "TOA", or "NOT_SET" std::string getDomainTypeString() const; // returns enum for FX, TOA, or NOT_SET - cphd::DomainType getDomainType() const; + cphd::DomainType getDomainType() const override; //! CollectionInfo block. Contains the general collection information //! CPHD03 can use the SICD Collection Information block directly From 4d5963b830c04d7e417048128a53b093f1fb4626 Mon Sep 17 00:00:00 2001 From: JonathanMeans Date: Tue, 28 Jan 2020 10:17:06 -0500 Subject: [PATCH 2/2] Fix namespacing --- six/modules/c++/cphd/include/cphd/Metadata.h | 2 +- six/modules/c++/cphd/include/cphd/MetadataBase.h | 2 +- six/modules/c++/cphd/source/Metadata.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/six/modules/c++/cphd/include/cphd/Metadata.h b/six/modules/c++/cphd/include/cphd/Metadata.h index 0256eccaf..15a093b40 100644 --- a/six/modules/c++/cphd/include/cphd/Metadata.h +++ b/six/modules/c++/cphd/include/cphd/Metadata.h @@ -76,7 +76,7 @@ struct Metadata : MetadataBase * FX for frequency domain, * TOA for time-of-arrival domain */ - cphd::DomainType getDomainType() const override; + DomainType getDomainType() const override; //! Get CPHD version std::string getVersion() const; diff --git a/six/modules/c++/cphd/include/cphd/MetadataBase.h b/six/modules/c++/cphd/include/cphd/MetadataBase.h index 545699659..984874e6f 100644 --- a/six/modules/c++/cphd/include/cphd/MetadataBase.h +++ b/six/modules/c++/cphd/include/cphd/MetadataBase.h @@ -92,7 +92,7 @@ struct MetadataBase * FX for frequency domain, * TOA for time-of-arrival domain */ - virtual cphd::DomainType getDomainType() const = 0; + virtual DomainType getDomainType() const = 0; //! Is this CPHD formed in the transmit frequency domain? bool isFX() const diff --git a/six/modules/c++/cphd/source/Metadata.cpp b/six/modules/c++/cphd/source/Metadata.cpp index c070d9d63..f90f8427f 100644 --- a/six/modules/c++/cphd/source/Metadata.cpp +++ b/six/modules/c++/cphd/source/Metadata.cpp @@ -60,7 +60,7 @@ bool Metadata::isCompressed() const return data.isCompressed(); } -cphd::DomainType Metadata::getDomainType() const +DomainType Metadata::getDomainType() const { return global.getDomainType(); }