mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 06:10:04 +00:00
RPG clang-tidy cleanup
This commit is contained in:
parent
e49adafda9
commit
68a5baa5c4
6 changed files with 223 additions and 204 deletions
|
|
@ -2,16 +2,12 @@
|
||||||
|
|
||||||
#include <scwx/wsr88d/rpg/level3_message.hpp>
|
#include <scwx/wsr88d/rpg/level3_message.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::wsr88d::rpg
|
||||||
{
|
|
||||||
namespace wsr88d
|
|
||||||
{
|
|
||||||
namespace rpg
|
|
||||||
{
|
{
|
||||||
|
|
||||||
class Level3MessageFactory
|
class Level3MessageFactory
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
explicit Level3MessageFactory() = delete;
|
explicit Level3MessageFactory() = delete;
|
||||||
~Level3MessageFactory() = delete;
|
~Level3MessageFactory() = delete;
|
||||||
|
|
||||||
|
|
@ -21,10 +17,7 @@ private:
|
||||||
Level3MessageFactory(Level3MessageFactory&&) noexcept = delete;
|
Level3MessageFactory(Level3MessageFactory&&) noexcept = delete;
|
||||||
Level3MessageFactory& operator=(Level3MessageFactory&&) noexcept = delete;
|
Level3MessageFactory& operator=(Level3MessageFactory&&) noexcept = delete;
|
||||||
|
|
||||||
public:
|
|
||||||
static std::shared_ptr<Level3Message> Create(std::istream& is);
|
static std::shared_ptr<Level3Message> Create(std::istream& is);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpg
|
} // namespace scwx::wsr88d::rpg
|
||||||
} // namespace wsr88d
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,12 @@
|
||||||
|
|
||||||
#include <scwx/wsr88d/rpg/packet.hpp>
|
#include <scwx/wsr88d/rpg/packet.hpp>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::wsr88d::rpg
|
||||||
{
|
|
||||||
namespace wsr88d
|
|
||||||
{
|
|
||||||
namespace rpg
|
|
||||||
{
|
{
|
||||||
|
|
||||||
class PacketFactory
|
class PacketFactory
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
explicit PacketFactory() = delete;
|
explicit PacketFactory() = delete;
|
||||||
~PacketFactory() = delete;
|
~PacketFactory() = delete;
|
||||||
|
|
||||||
|
|
@ -21,10 +17,7 @@ private:
|
||||||
PacketFactory(PacketFactory&&) noexcept = delete;
|
PacketFactory(PacketFactory&&) noexcept = delete;
|
||||||
PacketFactory& operator=(PacketFactory&&) noexcept = delete;
|
PacketFactory& operator=(PacketFactory&&) noexcept = delete;
|
||||||
|
|
||||||
public:
|
|
||||||
static std::shared_ptr<Packet> Create(std::istream& is);
|
static std::shared_ptr<Packet> Create(std::istream& is);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpg
|
} // namespace scwx::wsr88d::rpg
|
||||||
} // namespace wsr88d
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@
|
||||||
namespace scwx::wsr88d::rpg
|
namespace scwx::wsr88d::rpg
|
||||||
{
|
{
|
||||||
|
|
||||||
class ProductDescriptionBlockImpl;
|
|
||||||
|
|
||||||
class ProductDescriptionBlock : public awips::Message
|
class ProductDescriptionBlock : public awips::Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -26,38 +24,38 @@ public:
|
||||||
ProductDescriptionBlock(ProductDescriptionBlock&&) noexcept;
|
ProductDescriptionBlock(ProductDescriptionBlock&&) noexcept;
|
||||||
ProductDescriptionBlock& operator=(ProductDescriptionBlock&&) noexcept;
|
ProductDescriptionBlock& operator=(ProductDescriptionBlock&&) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] int16_t block_divider() const;
|
[[nodiscard]] std::int16_t block_divider() const;
|
||||||
[[nodiscard]] float latitude_of_radar() const;
|
[[nodiscard]] float latitude_of_radar() const;
|
||||||
[[nodiscard]] float longitude_of_radar() const;
|
[[nodiscard]] float longitude_of_radar() const;
|
||||||
[[nodiscard]] int16_t height_of_radar() const;
|
[[nodiscard]] std::int16_t height_of_radar() const;
|
||||||
[[nodiscard]] int16_t product_code() const;
|
[[nodiscard]] std::int16_t product_code() const;
|
||||||
[[nodiscard]] uint16_t operational_mode() const;
|
[[nodiscard]] std::uint16_t operational_mode() const;
|
||||||
[[nodiscard]] uint16_t volume_coverage_pattern() const;
|
[[nodiscard]] std::uint16_t volume_coverage_pattern() const;
|
||||||
[[nodiscard]] int16_t sequence_number() const;
|
[[nodiscard]] std::int16_t sequence_number() const;
|
||||||
[[nodiscard]] uint16_t volume_scan_number() const;
|
[[nodiscard]] std::uint16_t volume_scan_number() const;
|
||||||
[[nodiscard]] uint16_t volume_scan_date() const;
|
[[nodiscard]] std::uint16_t volume_scan_date() const;
|
||||||
[[nodiscard]] uint32_t volume_scan_start_time() const;
|
[[nodiscard]] std::uint32_t volume_scan_start_time() const;
|
||||||
[[nodiscard]] uint16_t generation_date_of_product() const;
|
[[nodiscard]] std::uint16_t generation_date_of_product() const;
|
||||||
[[nodiscard]] uint32_t generation_time_of_product() const;
|
[[nodiscard]] std::uint32_t generation_time_of_product() const;
|
||||||
[[nodiscard]] uint16_t elevation_number() const;
|
[[nodiscard]] std::uint16_t elevation_number() const;
|
||||||
[[nodiscard]] uint16_t data_level_threshold(size_t i) const;
|
[[nodiscard]] std::uint16_t data_level_threshold(size_t i) const;
|
||||||
[[nodiscard]] uint8_t version() const;
|
[[nodiscard]] std::uint8_t version() const;
|
||||||
[[nodiscard]] uint8_t spot_blank() const;
|
[[nodiscard]] std::uint8_t spot_blank() const;
|
||||||
[[nodiscard]] uint32_t offset_to_symbology() const;
|
[[nodiscard]] std::uint32_t offset_to_symbology() const;
|
||||||
[[nodiscard]] uint32_t offset_to_graphic() const;
|
[[nodiscard]] std::uint32_t offset_to_graphic() const;
|
||||||
[[nodiscard]] uint32_t offset_to_tabular() const;
|
[[nodiscard]] std::uint32_t offset_to_tabular() const;
|
||||||
|
|
||||||
[[nodiscard]] float range() const;
|
[[nodiscard]] float range() const;
|
||||||
[[nodiscard]] uint16_t range_raw() const;
|
[[nodiscard]] std::uint16_t range_raw() const;
|
||||||
[[nodiscard]] float x_resolution() const;
|
[[nodiscard]] float x_resolution() const;
|
||||||
[[nodiscard]] uint16_t x_resolution_raw() const;
|
[[nodiscard]] std::uint16_t x_resolution_raw() const;
|
||||||
[[nodiscard]] float y_resolution() const;
|
[[nodiscard]] float y_resolution() const;
|
||||||
[[nodiscard]] uint16_t y_resolution_raw() const;
|
[[nodiscard]] std::uint16_t y_resolution_raw() const;
|
||||||
|
|
||||||
[[nodiscard]] uint16_t threshold() const;
|
[[nodiscard]] std::uint16_t threshold() const;
|
||||||
[[nodiscard]] float offset() const;
|
[[nodiscard]] float offset() const;
|
||||||
[[nodiscard]] float scale() const;
|
[[nodiscard]] float scale() const;
|
||||||
[[nodiscard]] uint16_t number_of_levels() const;
|
[[nodiscard]] std::uint16_t number_of_levels() const;
|
||||||
|
|
||||||
[[nodiscard]] std::optional<DataLevelCode>
|
[[nodiscard]] std::optional<DataLevelCode>
|
||||||
data_level_code(std::uint8_t level) const;
|
data_level_code(std::uint8_t level) const;
|
||||||
|
|
@ -78,14 +76,15 @@ public:
|
||||||
[[nodiscard]] bool IsCompressionEnabled() const;
|
[[nodiscard]] bool IsCompressionEnabled() const;
|
||||||
[[nodiscard]] bool IsDataLevelCoded() const;
|
[[nodiscard]] bool IsDataLevelCoded() const;
|
||||||
|
|
||||||
[[nodiscard]] size_t data_size() const override;
|
[[nodiscard]] std::size_t data_size() const override;
|
||||||
|
|
||||||
bool Parse(std::istream& is) override;
|
bool Parse(std::istream& is) override;
|
||||||
|
|
||||||
static constexpr size_t SIZE = 102u;
|
static constexpr std::size_t SIZE = 102u;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<ProductDescriptionBlockImpl> p;
|
class Impl;
|
||||||
|
std::unique_ptr<Impl> p;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace scwx::wsr88d::rpg
|
} // namespace scwx::wsr88d::rpg
|
||||||
|
|
|
||||||
|
|
@ -9,22 +9,17 @@
|
||||||
#include <scwx/wsr88d/rpg/tabular_product_message.hpp>
|
#include <scwx/wsr88d/rpg/tabular_product_message.hpp>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::wsr88d::rpg
|
||||||
{
|
|
||||||
namespace wsr88d
|
|
||||||
{
|
|
||||||
namespace rpg
|
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ =
|
static const std::string logPrefix_ =
|
||||||
"scwx::wsr88d::rpg::level3_message_factory";
|
"scwx::wsr88d::rpg::level3_message_factory";
|
||||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
typedef std::function<std::shared_ptr<Level3Message>(Level3MessageHeader&&,
|
using CreateLevel3MessageFunction =
|
||||||
std::istream&)>
|
std::function<std::shared_ptr<Level3Message>(Level3MessageHeader&&,
|
||||||
CreateLevel3MessageFunction;
|
std::istream&)>;
|
||||||
|
|
||||||
static const std::unordered_map<int, CreateLevel3MessageFunction> //
|
static const std::unordered_map<int, CreateLevel3MessageFunction> //
|
||||||
create_ {{2, GeneralStatusMessage::Create},
|
create_ {{2, GeneralStatusMessage::Create},
|
||||||
|
|
@ -154,13 +149,12 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is)
|
||||||
else if (headerValid)
|
else if (headerValid)
|
||||||
{
|
{
|
||||||
// Seek to the end of the current message
|
// Seek to the end of the current message
|
||||||
is.seekg(header.length_of_message() - Level3MessageHeader::SIZE,
|
is.seekg(static_cast<std::streamoff>(header.length_of_message()) -
|
||||||
|
static_cast<std::streamoff>(Level3MessageHeader::SIZE),
|
||||||
std::ios_base::cur);
|
std::ios_base::cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rpg
|
} // namespace scwx::wsr88d::rpg
|
||||||
} // namespace wsr88d
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -28,18 +28,14 @@
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace scwx
|
namespace scwx::wsr88d::rpg
|
||||||
{
|
|
||||||
namespace wsr88d
|
|
||||||
{
|
|
||||||
namespace rpg
|
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::packet_factory";
|
static const std::string logPrefix_ = "scwx::wsr88d::rpg::packet_factory";
|
||||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
typedef std::function<std::shared_ptr<Packet>(std::istream&)>
|
using CreateMessageFunction =
|
||||||
CreateMessageFunction;
|
std::function<std::shared_ptr<Packet>(std::istream&)>;
|
||||||
|
|
||||||
static const std::unordered_map<unsigned int, CreateMessageFunction> create_ {
|
static const std::unordered_map<unsigned int, CreateMessageFunction> create_ {
|
||||||
{1, TextAndSpecialSymbolPacket::Create},
|
{1, TextAndSpecialSymbolPacket::Create},
|
||||||
|
|
@ -83,7 +79,7 @@ std::shared_ptr<Packet> PacketFactory::Create(std::istream& is)
|
||||||
std::shared_ptr<Packet> packet = nullptr;
|
std::shared_ptr<Packet> packet = nullptr;
|
||||||
bool packetValid = true;
|
bool packetValid = true;
|
||||||
|
|
||||||
uint16_t packetCode;
|
std::uint16_t packetCode {0};
|
||||||
|
|
||||||
is.read(reinterpret_cast<char*>(&packetCode), 2);
|
is.read(reinterpret_cast<char*>(&packetCode), 2);
|
||||||
packetCode = ntohs(packetCode);
|
packetCode = ntohs(packetCode);
|
||||||
|
|
@ -110,6 +106,4 @@ std::shared_ptr<Packet> PacketFactory::Create(std::istream& is)
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rpg
|
} // namespace scwx::wsr88d::rpg
|
||||||
} // namespace wsr88d
|
|
||||||
} // namespace scwx
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <cstddef>
|
||||||
#include <scwx/wsr88d/rpg/product_description_block.hpp>
|
#include <scwx/wsr88d/rpg/product_description_block.hpp>
|
||||||
#include <scwx/util/float.hpp>
|
#include <scwx/util/float.hpp>
|
||||||
#include <scwx/util/logger.hpp>
|
#include <scwx/util/logger.hpp>
|
||||||
|
|
@ -95,73 +96,57 @@ static const std::unordered_map<std::int16_t, float> grScale_ {
|
||||||
{174, ((units::inches<float> {1} * 0.01f) / units::millimeters<float> {1})},
|
{174, ((units::inches<float> {1} * 0.01f) / units::millimeters<float> {1})},
|
||||||
{175, ((units::inches<float> {1} * 0.01f) / units::millimeters<float> {1})}};
|
{175, ((units::inches<float> {1} * 0.01f) / units::millimeters<float> {1})}};
|
||||||
|
|
||||||
class ProductDescriptionBlockImpl
|
class ProductDescriptionBlock::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ProductDescriptionBlockImpl() :
|
explicit Impl() = default;
|
||||||
blockDivider_ {0},
|
~Impl() = default;
|
||||||
latitudeOfRadar_ {0},
|
|
||||||
longitudeOfRadar_ {0},
|
|
||||||
heightOfRadar_ {0},
|
|
||||||
productCode_ {0},
|
|
||||||
operationalMode_ {0},
|
|
||||||
volumeCoveragePattern_ {0},
|
|
||||||
sequenceNumber_ {0},
|
|
||||||
volumeScanNumber_ {0},
|
|
||||||
volumeScanDate_ {0},
|
|
||||||
volumeScanStartTime_ {0},
|
|
||||||
generationDateOfProduct_ {0},
|
|
||||||
generationTimeOfProduct_ {0},
|
|
||||||
elevationNumber_ {0},
|
|
||||||
version_ {0},
|
|
||||||
spotBlank_ {0},
|
|
||||||
offsetToSymbology_ {0},
|
|
||||||
offsetToGraphic_ {0},
|
|
||||||
offsetToTabular_ {0},
|
|
||||||
parameters_ {0},
|
|
||||||
halfwords_ {0}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
~ProductDescriptionBlockImpl() = default;
|
|
||||||
|
|
||||||
uint16_t halfword(size_t i);
|
Impl(const Impl&) = delete;
|
||||||
|
Impl& operator=(const Impl&) = delete;
|
||||||
|
Impl(const Impl&&) = delete;
|
||||||
|
Impl& operator=(const Impl&&) = delete;
|
||||||
|
|
||||||
int16_t blockDivider_;
|
std::uint16_t halfword(std::size_t i);
|
||||||
int32_t latitudeOfRadar_;
|
|
||||||
int32_t longitudeOfRadar_;
|
std::int16_t blockDivider_ {0};
|
||||||
int16_t heightOfRadar_;
|
std::int32_t latitudeOfRadar_ {0};
|
||||||
int16_t productCode_;
|
std::int32_t longitudeOfRadar_ {0};
|
||||||
uint16_t operationalMode_;
|
std::int16_t heightOfRadar_ {0};
|
||||||
uint16_t volumeCoveragePattern_;
|
std::int16_t productCode_ {0};
|
||||||
int16_t sequenceNumber_;
|
std::uint16_t operationalMode_ {0};
|
||||||
uint16_t volumeScanNumber_;
|
std::uint16_t volumeCoveragePattern_ {0};
|
||||||
uint16_t volumeScanDate_;
|
std::int16_t sequenceNumber_ {0};
|
||||||
uint32_t volumeScanStartTime_;
|
std::uint16_t volumeScanNumber_ {0};
|
||||||
uint16_t generationDateOfProduct_;
|
std::uint16_t volumeScanDate_ {0};
|
||||||
uint32_t generationTimeOfProduct_;
|
std::uint32_t volumeScanStartTime_ {0};
|
||||||
|
std::uint16_t generationDateOfProduct_ {0};
|
||||||
|
std::uint32_t generationTimeOfProduct_ {0};
|
||||||
// 27-28: Product dependent parameters 1 and 2 (Table V)
|
// 27-28: Product dependent parameters 1 and 2 (Table V)
|
||||||
uint16_t elevationNumber_;
|
std::uint16_t elevationNumber_ {0};
|
||||||
// 30: Product dependent parameter 3 (Table V)
|
// 30: Product dependent parameter 3 (Table V)
|
||||||
// 31-46: Product dependent (Note 1)
|
// 31-46: Product dependent (Note 1)
|
||||||
// 47-53: Product dependent parameters 4-10 (Table V, Note 3)
|
// 47-53: Product dependent parameters 4-10 (Table V, Note 3)
|
||||||
uint8_t version_;
|
std::uint8_t version_ {0};
|
||||||
uint8_t spotBlank_;
|
std::uint8_t spotBlank_ {0};
|
||||||
uint32_t offsetToSymbology_;
|
std::uint32_t offsetToSymbology_ {0};
|
||||||
uint32_t offsetToGraphic_;
|
std::uint32_t offsetToGraphic_ {0};
|
||||||
uint32_t offsetToTabular_;
|
std::uint32_t offsetToTabular_ {0};
|
||||||
|
|
||||||
std::array<uint16_t, 10> parameters_;
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
std::array<uint16_t, 16> halfwords_;
|
std::array<std::uint16_t, 10> parameters_ {0};
|
||||||
|
std::array<std::uint16_t, 16> halfwords_ {0};
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
};
|
};
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlockImpl::halfword(size_t i)
|
std::uint16_t ProductDescriptionBlock::Impl::halfword(std::size_t i)
|
||||||
{
|
{
|
||||||
// Halfwords start at halfword 31
|
// Halfwords start at halfword 31
|
||||||
return halfwords_[i - 31];
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
return halfwords_.at(i - 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductDescriptionBlock::ProductDescriptionBlock() :
|
ProductDescriptionBlock::ProductDescriptionBlock() : p(std::make_unique<Impl>())
|
||||||
p(std::make_unique<ProductDescriptionBlockImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ProductDescriptionBlock::~ProductDescriptionBlock() = default;
|
ProductDescriptionBlock::~ProductDescriptionBlock() = default;
|
||||||
|
|
@ -171,102 +156,104 @@ ProductDescriptionBlock::ProductDescriptionBlock(
|
||||||
ProductDescriptionBlock& ProductDescriptionBlock::operator=(
|
ProductDescriptionBlock& ProductDescriptionBlock::operator=(
|
||||||
ProductDescriptionBlock&&) noexcept = default;
|
ProductDescriptionBlock&&) noexcept = default;
|
||||||
|
|
||||||
int16_t ProductDescriptionBlock::block_divider() const
|
std::int16_t ProductDescriptionBlock::block_divider() const
|
||||||
{
|
{
|
||||||
return p->blockDivider_;
|
return p->blockDivider_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ProductDescriptionBlock::latitude_of_radar() const
|
float ProductDescriptionBlock::latitude_of_radar() const
|
||||||
{
|
{
|
||||||
return p->latitudeOfRadar_ * 0.001f;
|
static constexpr float kScale = 0.001f;
|
||||||
|
return static_cast<float>(p->latitudeOfRadar_) * kScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ProductDescriptionBlock::longitude_of_radar() const
|
float ProductDescriptionBlock::longitude_of_radar() const
|
||||||
{
|
{
|
||||||
return p->longitudeOfRadar_ * 0.001f;
|
static constexpr float kScale = 0.001f;
|
||||||
|
return static_cast<float>(p->longitudeOfRadar_) * kScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t ProductDescriptionBlock::height_of_radar() const
|
std::int16_t ProductDescriptionBlock::height_of_radar() const
|
||||||
{
|
{
|
||||||
return p->heightOfRadar_;
|
return p->heightOfRadar_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t ProductDescriptionBlock::product_code() const
|
std::int16_t ProductDescriptionBlock::product_code() const
|
||||||
{
|
{
|
||||||
return p->productCode_;
|
return p->productCode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::operational_mode() const
|
std::uint16_t ProductDescriptionBlock::operational_mode() const
|
||||||
{
|
{
|
||||||
return p->operationalMode_;
|
return p->operationalMode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::volume_coverage_pattern() const
|
std::uint16_t ProductDescriptionBlock::volume_coverage_pattern() const
|
||||||
{
|
{
|
||||||
return p->volumeCoveragePattern_;
|
return p->volumeCoveragePattern_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t ProductDescriptionBlock::sequence_number() const
|
std::int16_t ProductDescriptionBlock::sequence_number() const
|
||||||
{
|
{
|
||||||
return p->sequenceNumber_;
|
return p->sequenceNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::volume_scan_number() const
|
std::uint16_t ProductDescriptionBlock::volume_scan_number() const
|
||||||
{
|
{
|
||||||
return p->volumeScanNumber_;
|
return p->volumeScanNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::volume_scan_date() const
|
std::uint16_t ProductDescriptionBlock::volume_scan_date() const
|
||||||
{
|
{
|
||||||
return p->volumeScanDate_;
|
return p->volumeScanDate_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ProductDescriptionBlock::volume_scan_start_time() const
|
std::uint32_t ProductDescriptionBlock::volume_scan_start_time() const
|
||||||
{
|
{
|
||||||
return p->volumeScanStartTime_;
|
return p->volumeScanStartTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::generation_date_of_product() const
|
std::uint16_t ProductDescriptionBlock::generation_date_of_product() const
|
||||||
{
|
{
|
||||||
return p->generationDateOfProduct_;
|
return p->generationDateOfProduct_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ProductDescriptionBlock::generation_time_of_product() const
|
std::uint32_t ProductDescriptionBlock::generation_time_of_product() const
|
||||||
{
|
{
|
||||||
return p->generationTimeOfProduct_;
|
return p->generationTimeOfProduct_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::elevation_number() const
|
std::uint16_t ProductDescriptionBlock::elevation_number() const
|
||||||
{
|
{
|
||||||
return p->elevationNumber_;
|
return p->elevationNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::data_level_threshold(size_t i) const
|
std::uint16_t ProductDescriptionBlock::data_level_threshold(std::size_t i) const
|
||||||
{
|
{
|
||||||
return p->halfwords_[i];
|
return p->halfwords_.at(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ProductDescriptionBlock::version() const
|
std::uint8_t ProductDescriptionBlock::version() const
|
||||||
{
|
{
|
||||||
return p->version_;
|
return p->version_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ProductDescriptionBlock::spot_blank() const
|
std::uint8_t ProductDescriptionBlock::spot_blank() const
|
||||||
{
|
{
|
||||||
return p->spotBlank_;
|
return p->spotBlank_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ProductDescriptionBlock::offset_to_symbology() const
|
std::uint32_t ProductDescriptionBlock::offset_to_symbology() const
|
||||||
{
|
{
|
||||||
return p->offsetToSymbology_;
|
return p->offsetToSymbology_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ProductDescriptionBlock::offset_to_graphic() const
|
std::uint32_t ProductDescriptionBlock::offset_to_graphic() const
|
||||||
{
|
{
|
||||||
return p->offsetToGraphic_;
|
return p->offsetToGraphic_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ProductDescriptionBlock::offset_to_tabular() const
|
std::uint32_t ProductDescriptionBlock::offset_to_tabular() const
|
||||||
{
|
{
|
||||||
return p->offsetToTabular_;
|
return p->offsetToTabular_;
|
||||||
}
|
}
|
||||||
|
|
@ -276,14 +263,14 @@ float ProductDescriptionBlock::range() const
|
||||||
return range_raw();
|
return range_raw();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::range_raw() const
|
std::uint16_t ProductDescriptionBlock::range_raw() const
|
||||||
{
|
{
|
||||||
uint16_t range = 0;
|
std::uint16_t range = 0;
|
||||||
|
|
||||||
auto it = rangeMap_.find(p->productCode_);
|
auto it = rangeMap_.find(p->productCode_);
|
||||||
if (it != rangeMap_.cend())
|
if (it != rangeMap_.cend())
|
||||||
{
|
{
|
||||||
range = static_cast<uint16_t>(it->second);
|
range = static_cast<std::uint16_t>(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return range;
|
return range;
|
||||||
|
|
@ -291,17 +278,18 @@ uint16_t ProductDescriptionBlock::range_raw() const
|
||||||
|
|
||||||
float ProductDescriptionBlock::x_resolution() const
|
float ProductDescriptionBlock::x_resolution() const
|
||||||
{
|
{
|
||||||
return x_resolution_raw() * 0.001f;
|
static constexpr float kScale = 0.001f;
|
||||||
|
return static_cast<float>(x_resolution_raw()) * kScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::x_resolution_raw() const
|
std::uint16_t ProductDescriptionBlock::x_resolution_raw() const
|
||||||
{
|
{
|
||||||
uint16_t xResolution = 0;
|
std::uint16_t xResolution = 0;
|
||||||
|
|
||||||
auto it = xResolutionMap_.find(p->productCode_);
|
auto it = xResolutionMap_.find(p->productCode_);
|
||||||
if (it != xResolutionMap_.cend())
|
if (it != xResolutionMap_.cend())
|
||||||
{
|
{
|
||||||
xResolution = static_cast<uint16_t>(it->second);
|
xResolution = static_cast<std::uint16_t>(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return xResolution;
|
return xResolution;
|
||||||
|
|
@ -309,25 +297,28 @@ uint16_t ProductDescriptionBlock::x_resolution_raw() const
|
||||||
|
|
||||||
float ProductDescriptionBlock::y_resolution() const
|
float ProductDescriptionBlock::y_resolution() const
|
||||||
{
|
{
|
||||||
return y_resolution_raw() * 0.001f;
|
static constexpr float kScale = 0.001f;
|
||||||
|
return static_cast<float>(y_resolution_raw()) * kScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::y_resolution_raw() const
|
std::uint16_t ProductDescriptionBlock::y_resolution_raw() const
|
||||||
{
|
{
|
||||||
uint16_t yResolution = 0;
|
std::uint16_t yResolution = 0;
|
||||||
|
|
||||||
auto it = yResolutionMap_.find(p->productCode_);
|
auto it = yResolutionMap_.find(p->productCode_);
|
||||||
if (it != yResolutionMap_.cend())
|
if (it != yResolutionMap_.cend())
|
||||||
{
|
{
|
||||||
yResolution = static_cast<uint16_t>(it->second);
|
yResolution = static_cast<std::uint16_t>(it->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
return yResolution;
|
return yResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::threshold() const
|
std::uint16_t ProductDescriptionBlock::threshold() const
|
||||||
{
|
{
|
||||||
uint16_t threshold = 1;
|
std::uint16_t threshold = 1;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
|
|
@ -384,6 +375,8 @@ uint16_t ProductDescriptionBlock::threshold() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return threshold;
|
return threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,6 +384,8 @@ float ProductDescriptionBlock::offset() const
|
||||||
{
|
{
|
||||||
float offset = 0.0f;
|
float offset = 0.0f;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
|
|
@ -406,7 +401,8 @@ float ProductDescriptionBlock::offset() const
|
||||||
case 186:
|
case 186:
|
||||||
case 193:
|
case 193:
|
||||||
case 195:
|
case 195:
|
||||||
offset = static_cast<int16_t>(p->halfword(31)) * 0.1f;
|
offset =
|
||||||
|
static_cast<float>(static_cast<std::int16_t>(p->halfword(31))) * 0.1f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 134:
|
case 134:
|
||||||
|
|
@ -414,7 +410,7 @@ float ProductDescriptionBlock::offset() const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 135:
|
case 135:
|
||||||
offset = static_cast<int16_t>(p->halfword(33));
|
offset = static_cast<std::int16_t>(p->halfword(33));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 159:
|
case 159:
|
||||||
|
|
@ -435,6 +431,8 @@ float ProductDescriptionBlock::offset() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -442,6 +440,8 @@ float ProductDescriptionBlock::scale() const
|
||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
|
|
@ -456,11 +456,11 @@ float ProductDescriptionBlock::scale() const
|
||||||
case 186:
|
case 186:
|
||||||
case 193:
|
case 193:
|
||||||
case 195:
|
case 195:
|
||||||
scale = p->halfword(32) * 0.1f;
|
scale = static_cast<float>(p->halfword(32)) * 0.1f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 81:
|
case 81:
|
||||||
scale = p->halfword(32) * 0.001f;
|
scale = static_cast<float>(p->halfword(32)) * 0.001f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 134:
|
case 134:
|
||||||
|
|
@ -472,7 +472,7 @@ float ProductDescriptionBlock::scale() const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 138:
|
case 138:
|
||||||
scale = p->halfword(32) * 0.01f;
|
scale = static_cast<float>(p->halfword(32)) * 0.01f;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 159:
|
case 159:
|
||||||
|
|
@ -493,12 +493,16 @@ float ProductDescriptionBlock::scale() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ProductDescriptionBlock::number_of_levels() const
|
std::uint16_t ProductDescriptionBlock::number_of_levels() const
|
||||||
{
|
{
|
||||||
uint16_t numberOfLevels = 16u;
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
|
std::uint16_t numberOfLevels = 16u;
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
|
|
@ -613,6 +617,8 @@ uint16_t ProductDescriptionBlock::number_of_levels() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return numberOfLevels;
|
return numberOfLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -620,6 +626,8 @@ std::uint16_t ProductDescriptionBlock::log_start() const
|
||||||
{
|
{
|
||||||
std::uint16_t logStart = std::numeric_limits<std::uint16_t>::max();
|
std::uint16_t logStart = std::numeric_limits<std::uint16_t>::max();
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 134:
|
case 134:
|
||||||
|
|
@ -630,6 +638,8 @@ std::uint16_t ProductDescriptionBlock::log_start() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return logStart;
|
return logStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -637,6 +647,8 @@ float ProductDescriptionBlock::log_offset() const
|
||||||
{
|
{
|
||||||
float logOffset = 0.0f;
|
float logOffset = 0.0f;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 134:
|
case 134:
|
||||||
|
|
@ -647,6 +659,8 @@ float ProductDescriptionBlock::log_offset() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return logOffset;
|
return logOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -654,6 +668,8 @@ float ProductDescriptionBlock::log_scale() const
|
||||||
{
|
{
|
||||||
float logScale = 1.0f;
|
float logScale = 1.0f;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 134:
|
case 134:
|
||||||
|
|
@ -664,6 +680,8 @@ float ProductDescriptionBlock::log_scale() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return logScale;
|
return logScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,6 +700,8 @@ float ProductDescriptionBlock::gr_scale() const
|
||||||
|
|
||||||
std::uint8_t ProductDescriptionBlock::data_mask() const
|
std::uint8_t ProductDescriptionBlock::data_mask() const
|
||||||
{
|
{
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
std::uint8_t dataMask = 0xff;
|
std::uint8_t dataMask = 0xff;
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
|
|
@ -694,6 +714,8 @@ std::uint8_t ProductDescriptionBlock::data_mask() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return dataMask;
|
return dataMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -701,6 +723,8 @@ std::uint8_t ProductDescriptionBlock::topped_mask() const
|
||||||
{
|
{
|
||||||
std::uint8_t toppedMask = 0x00;
|
std::uint8_t toppedMask = 0x00;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 135:
|
case 135:
|
||||||
|
|
@ -711,6 +735,8 @@ std::uint8_t ProductDescriptionBlock::topped_mask() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return toppedMask;
|
return toppedMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -722,7 +748,7 @@ units::angle::degrees<double> ProductDescriptionBlock::elevation() const
|
||||||
{
|
{
|
||||||
// Elevation is given in tenths of a degree
|
// Elevation is given in tenths of a degree
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
||||||
elevation = static_cast<int16_t>(p->parameters_[2]) * 0.1;
|
elevation = static_cast<std::int16_t>(p->parameters_[2]) * 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return units::angle::degrees<double> {elevation};
|
return units::angle::degrees<double> {elevation};
|
||||||
|
|
@ -737,11 +763,15 @@ bool ProductDescriptionBlock::IsCompressionEnabled() const
|
||||||
{
|
{
|
||||||
bool isCompressed = false;
|
bool isCompressed = false;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
if (compressedProducts_.contains(p->productCode_))
|
if (compressedProducts_.contains(p->productCode_))
|
||||||
{
|
{
|
||||||
isCompressed = (p->parameters_[7] == 1u);
|
isCompressed = (p->parameters_[7] == 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return isCompressed;
|
return isCompressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -750,7 +780,7 @@ bool ProductDescriptionBlock::IsDataLevelCoded() const
|
||||||
return !uncodedDataLevelProducts_.contains(p->productCode_);
|
return !uncodedDataLevelProducts_.contains(p->productCode_);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ProductDescriptionBlock::data_size() const
|
std::size_t ProductDescriptionBlock::data_size() const
|
||||||
{
|
{
|
||||||
return SIZE;
|
return SIZE;
|
||||||
}
|
}
|
||||||
|
|
@ -761,6 +791,8 @@ bool ProductDescriptionBlock::Parse(std::istream& is)
|
||||||
|
|
||||||
const std::streampos blockStart = is.tellg();
|
const std::streampos blockStart = is.tellg();
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
is.read(reinterpret_cast<char*>(&p->blockDivider_), 2); // 10
|
is.read(reinterpret_cast<char*>(&p->blockDivider_), 2); // 10
|
||||||
is.read(reinterpret_cast<char*>(&p->latitudeOfRadar_), 4); // 11-12
|
is.read(reinterpret_cast<char*>(&p->latitudeOfRadar_), 4); // 11-12
|
||||||
is.read(reinterpret_cast<char*>(&p->longitudeOfRadar_), 4); // 13-14
|
is.read(reinterpret_cast<char*>(&p->longitudeOfRadar_), 4); // 13-14
|
||||||
|
|
@ -774,25 +806,29 @@ bool ProductDescriptionBlock::Parse(std::istream& is)
|
||||||
is.read(reinterpret_cast<char*>(&p->volumeScanStartTime_), 4); // 22-23
|
is.read(reinterpret_cast<char*>(&p->volumeScanStartTime_), 4); // 22-23
|
||||||
is.read(reinterpret_cast<char*>(&p->generationDateOfProduct_), 2); // 24
|
is.read(reinterpret_cast<char*>(&p->generationDateOfProduct_), 2); // 24
|
||||||
is.read(reinterpret_cast<char*>(&p->generationTimeOfProduct_), 4); // 25-26
|
is.read(reinterpret_cast<char*>(&p->generationTimeOfProduct_), 4); // 25-26
|
||||||
is.read(reinterpret_cast<char*>(&p->parameters_[0]), 2 * 2); // 27-28
|
is.read(reinterpret_cast<char*>(&p->parameters_[0]),
|
||||||
|
static_cast<std::streamsize>(2 * 2)); // 27-28
|
||||||
is.read(reinterpret_cast<char*>(&p->elevationNumber_), 2); // 29
|
is.read(reinterpret_cast<char*>(&p->elevationNumber_), 2); // 29
|
||||||
is.read(reinterpret_cast<char*>(&p->parameters_[2]), 2); // 30
|
is.read(reinterpret_cast<char*>(&p->parameters_[2]), 2); // 30
|
||||||
is.read(reinterpret_cast<char*>(&p->halfwords_[0]), 16 * 2); // 31-46
|
is.read(reinterpret_cast<char*>(&p->halfwords_[0]),
|
||||||
is.read(reinterpret_cast<char*>(&p->parameters_[3]), 7 * 2); // 47-53
|
static_cast<std::streamsize>(16 * 2)); // 31-46
|
||||||
|
is.read(reinterpret_cast<char*>(&p->parameters_[3]),
|
||||||
|
static_cast<std::streamsize>(7 * 2)); // 47-53
|
||||||
is.read(reinterpret_cast<char*>(&p->version_), 1); // 54
|
is.read(reinterpret_cast<char*>(&p->version_), 1); // 54
|
||||||
is.read(reinterpret_cast<char*>(&p->spotBlank_), 1); // 54
|
is.read(reinterpret_cast<char*>(&p->spotBlank_), 1); // 54
|
||||||
is.read(reinterpret_cast<char*>(&p->offsetToSymbology_), 4); // 55-56
|
is.read(reinterpret_cast<char*>(&p->offsetToSymbology_), 4); // 55-56
|
||||||
is.read(reinterpret_cast<char*>(&p->offsetToGraphic_), 4); // 57-58
|
is.read(reinterpret_cast<char*>(&p->offsetToGraphic_), 4); // 57-58
|
||||||
is.read(reinterpret_cast<char*>(&p->offsetToTabular_), 4); // 59-60
|
is.read(reinterpret_cast<char*>(&p->offsetToTabular_), 4); // 59-60
|
||||||
|
|
||||||
p->blockDivider_ = ntohs(p->blockDivider_);
|
p->blockDivider_ = static_cast<std::int16_t>(ntohs(p->blockDivider_));
|
||||||
p->latitudeOfRadar_ = ntohl(p->latitudeOfRadar_);
|
p->latitudeOfRadar_ = static_cast<std::int32_t>(ntohl(p->latitudeOfRadar_));
|
||||||
p->longitudeOfRadar_ = ntohl(p->longitudeOfRadar_);
|
p->longitudeOfRadar_ =
|
||||||
p->heightOfRadar_ = ntohs(p->heightOfRadar_);
|
static_cast<std::int32_t>(ntohl(p->longitudeOfRadar_));
|
||||||
p->productCode_ = ntohs(p->productCode_);
|
p->heightOfRadar_ = static_cast<std::int16_t>(ntohs(p->heightOfRadar_));
|
||||||
|
p->productCode_ = static_cast<std::int16_t>(ntohs(p->productCode_));
|
||||||
p->operationalMode_ = ntohs(p->operationalMode_);
|
p->operationalMode_ = ntohs(p->operationalMode_);
|
||||||
p->volumeCoveragePattern_ = ntohs(p->volumeCoveragePattern_);
|
p->volumeCoveragePattern_ = ntohs(p->volumeCoveragePattern_);
|
||||||
p->sequenceNumber_ = ntohs(p->sequenceNumber_);
|
p->sequenceNumber_ = static_cast<std::int16_t>(ntohs(p->sequenceNumber_));
|
||||||
p->volumeScanNumber_ = ntohs(p->volumeScanNumber_);
|
p->volumeScanNumber_ = ntohs(p->volumeScanNumber_);
|
||||||
p->volumeScanDate_ = ntohs(p->volumeScanDate_);
|
p->volumeScanDate_ = ntohs(p->volumeScanDate_);
|
||||||
p->volumeScanStartTime_ = ntohl(p->volumeScanStartTime_);
|
p->volumeScanStartTime_ = ntohl(p->volumeScanStartTime_);
|
||||||
|
|
@ -827,6 +863,8 @@ bool ProductDescriptionBlock::Parse(std::istream& is)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
if (blockValid)
|
if (blockValid)
|
||||||
{
|
{
|
||||||
logger_->trace("Product code: {}", p->productCode_);
|
logger_->trace("Product code: {}", p->productCode_);
|
||||||
|
|
@ -844,6 +882,8 @@ bool ProductDescriptionBlock::Parse(std::istream& is)
|
||||||
std::optional<DataLevelCode>
|
std::optional<DataLevelCode>
|
||||||
ProductDescriptionBlock::data_level_code(std::uint8_t level) const
|
ProductDescriptionBlock::data_level_code(std::uint8_t level) const
|
||||||
{
|
{
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
switch (p->productCode_)
|
switch (p->productCode_)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
|
|
@ -1033,11 +1073,11 @@ ProductDescriptionBlock::data_level_code(std::uint8_t level) const
|
||||||
if (number_of_levels() <= 16 && level < 16 &&
|
if (number_of_levels() <= 16 && level < 16 &&
|
||||||
!uncodedDataLevelProducts_.contains(p->productCode_))
|
!uncodedDataLevelProducts_.contains(p->productCode_))
|
||||||
{
|
{
|
||||||
uint16_t th = data_level_threshold(level);
|
std::uint16_t th = data_level_threshold(level);
|
||||||
if ((th & 0x8000u))
|
if ((th & 0x8000u))
|
||||||
{
|
{
|
||||||
// If bit 0 is one, then the LSB is coded
|
// If bit 0 is one, then the LSB is coded
|
||||||
uint16_t lsb = th & 0x00ffu;
|
std::uint16_t lsb = th & 0x00ffu;
|
||||||
|
|
||||||
switch (lsb)
|
switch (lsb)
|
||||||
{
|
{
|
||||||
|
|
@ -1081,6 +1121,8 @@ ProductDescriptionBlock::data_level_code(std::uint8_t level) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1099,6 +1141,8 @@ ProductDescriptionBlock::data_value(std::uint8_t level) const
|
||||||
|
|
||||||
std::optional<float> f = std::nullopt;
|
std::optional<float> f = std::nullopt;
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// Different products use different scale/offset formulas
|
// Different products use different scale/offset formulas
|
||||||
if (numberOfLevels > 16 ||
|
if (numberOfLevels > 16 ||
|
||||||
uncodedDataLevelProducts_.contains(p->productCode_))
|
uncodedDataLevelProducts_.contains(p->productCode_))
|
||||||
|
|
@ -1116,17 +1160,17 @@ ProductDescriptionBlock::data_value(std::uint8_t level) const
|
||||||
case 174:
|
case 174:
|
||||||
case 175:
|
case 175:
|
||||||
case 176:
|
case 176:
|
||||||
f = (level - dataOffset) / dataScale;
|
f = (static_cast<float>(level) - dataOffset) / dataScale;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 134:
|
case 134:
|
||||||
if (level < log_start())
|
if (level < log_start())
|
||||||
{
|
{
|
||||||
f = (level - dataOffset) / dataScale;
|
f = (static_cast<float>(level) - dataOffset) / dataScale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
f = expf((level - log_offset()) / log_scale());
|
f = expf((static_cast<float>(level) - log_offset()) / log_scale());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1135,7 +1179,7 @@ ProductDescriptionBlock::data_value(std::uint8_t level) const
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
f = level * dataScale + dataOffset;
|
f = static_cast<float>(level) * dataScale + dataOffset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1175,6 +1219,8 @@ ProductDescriptionBlock::data_value(std::uint8_t level) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// Scale for GR compatibility
|
// Scale for GR compatibility
|
||||||
if (f.has_value())
|
if (f.has_value())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue