Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull up DomainType accessors to base cphd Metadata class #308

Merged
merged 2 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions six/modules/c++/cphd/include/cphd/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
DomainType getDomainType() const override;

//! Get CPHD version
std::string getVersion() const;

Expand Down
19 changes: 19 additions & 0 deletions six/modules/c++/cphd/include/cphd/MetadataBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <ostream>
#include <six/Init.h>
#include <cphd/Enums.h>

namespace cphd
{
Expand Down Expand Up @@ -86,6 +87,24 @@ struct MetadataBase
return false;
}

/*!
* Get domain type
* FX for frequency domain,
* TOA for time-of-arrival domain
*/
virtual 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);
}
};
}

Expand Down
10 changes: 10 additions & 0 deletions six/modules/c++/cphd/source/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

DomainType Metadata::getDomainType() const
{
return global.getDomainType();
}

std::string Metadata::getVersion() const
{
return mVersion;
Expand Down
12 changes: 1 addition & 11 deletions six/modules/c++/cphd03/include/cphd03/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down