mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:50:04 +00:00
Boost.Log -> spdlog - wsr88d/rpg
This commit is contained in:
parent
dda71133e0
commit
766940e60f
39 changed files with 253 additions and 351 deletions
|
|
@ -1,12 +1,11 @@
|
|||
#include <scwx/wsr88d/rpg/ccb_header.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
#include <scwx/util/streams.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <WinSock2.h>
|
||||
#else
|
||||
|
|
@ -20,7 +19,8 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::wsr88d::rpg::ccb_header] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::ccb_header";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class CcbHeaderImpl
|
||||
{
|
||||
|
|
@ -197,7 +197,7 @@ bool CcbHeader::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
headerValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::cell_trend_data_packet] ";
|
||||
"scwx::wsr88d::rpg::cell_trend_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct CellTrendData
|
||||
{
|
||||
|
|
@ -134,21 +134,19 @@ bool CellTrendDataPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 21)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->lengthOfBlock_ < 12 || p->lengthOfBlock_ > 198)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
|
||||
logger_->warn("Invalid length of block: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::cell_trend_volume_scan_times] ";
|
||||
"scwx::wsr88d::rpg::cell_trend_volume_scan_times";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class CellTrendVolumeScanTimesImpl
|
||||
{
|
||||
|
|
@ -93,21 +93,19 @@ bool CellTrendVolumeScanTimes::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 22)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->lengthOfBlock_ < 4 || p->lengthOfBlock_ > 22)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
|
||||
logger_->warn("Invalid length of block: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::digital_precipitation_data_array_packet] ";
|
||||
"scwx::wsr88d::rpg::digital_precipitation_data_array_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class DigitalPrecipitationDataArrayPacketImpl
|
||||
{
|
||||
|
|
@ -97,21 +97,19 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 17)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRows_ != 131)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of rows: " << p->numberOfRows_;
|
||||
logger_->warn("Invalid number of rows: {}", p->numberOfRows_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -134,10 +132,9 @@ bool DigitalPrecipitationDataArrayPacket::Parse(std::istream& is)
|
|||
if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 262 ||
|
||||
row.numberOfBytes_ % 2 != 0)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of bytes in row: " << row.numberOfBytes_
|
||||
<< " (Row " << r << ")";
|
||||
logger_->warn("Invalid number of bytes in row: {} (Row {})",
|
||||
row.numberOfBytes_,
|
||||
r);
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/digital_radial_data_array_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::digital_radial_data_array_packet] ";
|
||||
"scwx::wsr88d::rpg::digital_radial_data_array_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class DigitalRadialDataArrayPacketImpl
|
||||
{
|
||||
|
|
@ -148,36 +148,31 @@ bool DigitalRadialDataArrayPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 16)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->indexOfFirstRangeBin_ < 0 || p->indexOfFirstRangeBin_ > 230)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid index of first range bin: " << p->indexOfFirstRangeBin_;
|
||||
logger_->warn("Invalid index of first range bin: {}",
|
||||
p->indexOfFirstRangeBin_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRangeBins_ < 0 || p->numberOfRangeBins_ > 1840)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of range bins: " << p->numberOfRangeBins_;
|
||||
logger_->warn("Invalid number of range bins: {}",
|
||||
p->numberOfRangeBins_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 720)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of radials: " << p->numberOfRadials_;
|
||||
logger_->warn("Invalid number of radials: {}", p->numberOfRadials_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -201,19 +196,19 @@ bool DigitalRadialDataArrayPacket::Parse(std::istream& is)
|
|||
|
||||
if (radial.numberOfBytes_ < 1 || radial.numberOfBytes_ > 1840)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of bytes: " << radial.numberOfBytes_
|
||||
<< " (Radial " << r << ")";
|
||||
logger_->warn("Invalid number of bytes: {} (Radial {})",
|
||||
radial.numberOfBytes_,
|
||||
r);
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
else if (radial.numberOfBytes_ < p->numberOfRangeBins_)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Number of bytes < number of range bins: "
|
||||
<< radial.numberOfBytes_ << " < " << p->numberOfRangeBins_
|
||||
<< " (Radial " << r << ")";
|
||||
logger_->warn(
|
||||
"Number of bytes < number of range bins: {} < {} (Radial {})",
|
||||
radial.numberOfBytes_,
|
||||
p->numberOfRangeBins_,
|
||||
r);
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +12,7 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::general_status_message] ";
|
||||
"scwx::wsr88d::rpg::general_status_message";
|
||||
|
||||
class GeneralStatusMessageImpl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/generic_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -12,8 +11,8 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::generic_data_packet] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::generic_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class GenericDataPacketImpl
|
||||
{
|
||||
|
|
@ -70,15 +69,14 @@ bool GenericDataPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 28 && p->packetCode_ != 29)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -12,7 +10,7 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::generic_radial_data_packet] ";
|
||||
"scwx::wsr88d::rpg::generic_radial_data_packet";
|
||||
|
||||
class GenericRadialDataPacketImpl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include <scwx/wsr88d/rpg/graphic_alphanumeric_block.hpp>
|
||||
#include <scwx/wsr88d/rpg/packet_factory.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +13,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::graphic_alphanumeric_block] ";
|
||||
"scwx::wsr88d::rpg::graphic_alphanumeric_block";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class GraphicAlphanumericBlockImpl
|
||||
{
|
||||
|
|
@ -76,33 +76,29 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->blockDivider_ != -1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block divider: " << p->blockDivider_;
|
||||
logger_->warn("Invalid block divider: {}", p->blockDivider_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->blockId_ != 2)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block ID: " << p->blockId_;
|
||||
logger_->warn("Invalid block ID: {}", p->blockId_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->lengthOfBlock_ < 10)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block length: " << p->lengthOfBlock_;
|
||||
logger_->warn("Invalid block length: {}", p->lengthOfBlock_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of pages: " << p->numberOfPages_;
|
||||
logger_->warn("Invalid number of pages: {}", p->numberOfPages_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +110,7 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
|
|||
|
||||
for (uint16_t i = 0; i < p->numberOfPages_; i++)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Page " << (i + 1);
|
||||
logger_->trace("Page {}", (i + 1));
|
||||
|
||||
std::vector<std::shared_ptr<Packet>> packetList;
|
||||
uint32_t bytesRead = 0;
|
||||
|
|
@ -131,9 +127,8 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
|
|||
|
||||
if (pageNumber != i + 1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Page out of order: Expected " << (i + 1)
|
||||
<< ", found " << pageNumber;
|
||||
logger_->warn(
|
||||
"Page out of order: Expected {}, found {}", (i + 1), pageNumber);
|
||||
}
|
||||
|
||||
while (bytesRead < lengthOfPage)
|
||||
|
|
@ -152,19 +147,17 @@ bool GraphicAlphanumericBlock::Parse(std::istream& is)
|
|||
|
||||
if (bytesRead < lengthOfPage)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace)
|
||||
<< logPrefix_
|
||||
<< "Page bytes read smaller than size: " << bytesRead << " < "
|
||||
<< lengthOfPage << " bytes";
|
||||
logger_->trace("Page bytes read smaller than size: {} < {} bytes",
|
||||
bytesRead,
|
||||
lengthOfPage);
|
||||
blockValid = false;
|
||||
is.seekg(pageEnd, std::ios_base::beg);
|
||||
}
|
||||
if (bytesRead > lengthOfPage)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Page bytes read larger than size: " << bytesRead << " > "
|
||||
<< lengthOfPage << " bytes";
|
||||
logger_->warn("Page bytes read larger than size: {} > {} bytes",
|
||||
bytesRead,
|
||||
lengthOfPage);
|
||||
blockValid = false;
|
||||
is.seekg(pageEnd, std::ios_base::beg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <scwx/wsr88d/rpg/graphic_product_message.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
#include <scwx/util/rangebuf.hpp>
|
||||
|
||||
#include <istream>
|
||||
|
|
@ -7,7 +8,6 @@
|
|||
#include <boost/iostreams/copy.hpp>
|
||||
#include <boost/iostreams/filtering_streambuf.hpp>
|
||||
#include <boost/iostreams/filter/bzip2.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -17,7 +17,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::graphic_product_message] ";
|
||||
"scwx::wsr88d::rpg::graphic_product_message";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class GraphicProductMessageImpl
|
||||
{
|
||||
|
|
@ -102,17 +103,14 @@ bool GraphicProductMessage::Parse(std::istream& is)
|
|||
{
|
||||
std::stringstream ss;
|
||||
std::streamsize bytesCopied = boost::iostreams::copy(in, ss);
|
||||
BOOST_LOG_TRIVIAL(trace)
|
||||
<< logPrefix_ << "Decompressed data size = " << bytesCopied
|
||||
<< " bytes";
|
||||
logger_->trace("Decompressed data size = {} bytes", bytesCopied);
|
||||
|
||||
dataValid = p->LoadBlocks(ss);
|
||||
}
|
||||
catch (const boost::iostreams::bzip2_error& ex)
|
||||
{
|
||||
int error = ex.error();
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Error decompressing data: " << ex.what();
|
||||
logger_->warn("Error decompressing data: {}", ex.what());
|
||||
|
||||
dataValid = false;
|
||||
}
|
||||
|
|
@ -138,7 +136,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
|
|||
bool graphicValid = true;
|
||||
bool tabularValid = true;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks";
|
||||
logger_->debug("Loading Blocks");
|
||||
|
||||
std::streampos offsetBasePos = is.tellg();
|
||||
|
||||
|
|
@ -157,8 +155,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
|
|||
symbologyValid = symbologyBlock_->Parse(is);
|
||||
is.seekg(offsetBasePos, std::ios_base::beg);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< logPrefix_ << "Product symbology block valid: " << symbologyValid;
|
||||
logger_->debug("Product symbology block valid: {}", symbologyValid);
|
||||
|
||||
if (!symbologyValid)
|
||||
{
|
||||
|
|
@ -174,8 +171,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
|
|||
graphicValid = graphicBlock_->Parse(is);
|
||||
is.seekg(offsetBasePos, std::ios_base::beg);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< logPrefix_ << "Graphic alphanumeric block valid: " << graphicValid;
|
||||
logger_->debug("Graphic alphanumeric block valid: {}", graphicValid);
|
||||
|
||||
if (!graphicValid)
|
||||
{
|
||||
|
|
@ -191,8 +187,7 @@ bool GraphicProductMessageImpl::LoadBlocks(std::istream& is)
|
|||
tabularValid = tabularBlock_->Parse(is);
|
||||
is.seekg(offsetBasePos, std::ios_base::beg);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< logPrefix_ << "Tabular alphanumeric block valid: " << tabularValid;
|
||||
logger_->debug("Tabular alphanumeric block valid: {}", tabularValid);
|
||||
|
||||
if (!tabularValid)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/hda_hail_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::hda_hail_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::hda_hail_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct HdaHailSymbol
|
||||
{
|
||||
|
|
@ -90,8 +90,7 @@ bool HdaHailSymbolPacket::ParseData(std::istream& is)
|
|||
|
||||
if (packet_code() != 19)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#include <scwx/wsr88d/rpg/level3_message.hpp>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -9,7 +7,7 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::wsr88d::rpg::level3_message] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::level3_message";
|
||||
|
||||
class Level3MessageImpl
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <scwx/wsr88d/rpg/level3_message_factory.hpp>
|
||||
|
||||
#include <scwx/util/logger.hpp>
|
||||
#include <scwx/util/vectorbuf.hpp>
|
||||
#include <scwx/wsr88d/rpg/general_status_message.hpp>
|
||||
#include <scwx/wsr88d/rpg/graphic_product_message.hpp>
|
||||
|
|
@ -9,8 +10,6 @@
|
|||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -19,7 +18,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
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_);
|
||||
|
||||
typedef std::function<std::shared_ptr<Level3Message>(Level3MessageHeader&&,
|
||||
std::istream&)>
|
||||
|
|
@ -133,8 +133,7 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is)
|
|||
|
||||
if (headerValid && create_.find(header.message_code()) == create_.end())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Unknown message type: " << header.message_code();
|
||||
logger_->warn("Unknown message type: {}", header.message_code());
|
||||
messageValid = false;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +142,7 @@ std::shared_ptr<Level3Message> Level3MessageFactory::Create(std::istream& is)
|
|||
int16_t messageCode = header.message_code();
|
||||
size_t dataSize = header.length_of_message() - Level3MessageHeader::SIZE;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Found Message " << messageCode;
|
||||
logger_->debug("Found Message {}", messageCode);
|
||||
|
||||
message = create_.at(messageCode)(std::move(header), is);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/level3_message_header.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
# include <WinSock2.h>
|
||||
#else
|
||||
|
|
@ -19,7 +18,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::level3_message_header] ";
|
||||
"scwx::wsr88d::rpg::level3_message_header";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class Level3MessageHeaderImpl
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ bool Level3MessageHeader::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
headerValid = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -122,52 +122,44 @@ bool Level3MessageHeader::Parse(std::istream& is)
|
|||
(p->messageCode_ > -16 && p->messageCode_ < 0) ||
|
||||
p->messageCode_ > 211)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid message code: " << p->messageCode_;
|
||||
logger_->warn("Invalid message code: {}", p->messageCode_);
|
||||
headerValid = false;
|
||||
}
|
||||
if (p->dateOfMessage_ > 32'767u)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid date: " << p->dateOfMessage_;
|
||||
logger_->warn("Invalid date: {}", p->dateOfMessage_);
|
||||
headerValid = false;
|
||||
}
|
||||
if (p->timeOfMessage_ > 86'399u)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid time: " << p->timeOfMessage_;
|
||||
logger_->warn("Invalid time: {}", p->timeOfMessage_);
|
||||
headerValid = false;
|
||||
}
|
||||
if (p->lengthOfMessage_ < 18 || p->lengthOfMessage_ > 1'329'270u)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid length: " << p->lengthOfMessage_;
|
||||
logger_->warn("Invalid length: {}", p->lengthOfMessage_);
|
||||
headerValid = false;
|
||||
}
|
||||
if ((p->sourceId_ > 999u && p->sourceId_ < 3000) || p->sourceId_ > 3045)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid source ID: " << p->sourceId_;
|
||||
logger_->warn("Invalid source ID: {}", p->sourceId_);
|
||||
headerValid = false;
|
||||
}
|
||||
if (p->destinationId_ > 999u)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid destination ID: " << p->destinationId_;
|
||||
logger_->warn("Invalid destination ID: {}", p->destinationId_);
|
||||
headerValid = false;
|
||||
}
|
||||
if (p->numberBlocks_ < 1u || p->numberBlocks_ > 51u)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block count: " << p->numberBlocks_;
|
||||
logger_->warn("Invalid block count: {}", p->numberBlocks_);
|
||||
headerValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (headerValid)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace)
|
||||
<< logPrefix_ << "Message code: " << p->messageCode_;
|
||||
logger_->trace("Message code: {}", p->messageCode_);
|
||||
}
|
||||
|
||||
return headerValid;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/linked_contour_vector_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::linked_contour_vector_packet] ";
|
||||
"scwx::wsr88d::rpg::linked_contour_vector_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class LinkedContourVectorPacketImpl
|
||||
{
|
||||
|
|
@ -93,22 +93,20 @@ bool LinkedContourVectorPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 0x0E03)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->initialPointIndicator_ != 0x8000)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid initial point indicator: " << p->initialPointIndicator_;
|
||||
logger_->warn("Invalid initial point indicator: {}",
|
||||
p->initialPointIndicator_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/linked_vector_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -12,8 +11,8 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::linked_vector_packet] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::linked_vector_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class LinkedVectorPacketImpl
|
||||
{
|
||||
|
|
@ -93,7 +92,7 @@ bool LinkedVectorPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->packetCode_ == 9)
|
||||
|
|
@ -107,8 +106,7 @@ bool LinkedVectorPacket::Parse(std::istream& is)
|
|||
{
|
||||
if (p->packetCode_ != 6 && p->packetCode_ != 9)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include <scwx/wsr88d/rpg/mesocyclone_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +13,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::mesocyclone_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::mesocyclone_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::set<uint16_t> packetCodes_ = {3, 11};
|
||||
|
||||
|
|
@ -77,8 +77,7 @@ bool MesocycloneSymbolPacket::ParseData(std::istream& is)
|
|||
|
||||
if (!packetCodes_.contains(packet_code()))
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "[scwx::wsr88d::rpg::packet] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::packet";
|
||||
|
||||
Packet::Packet() = default;
|
||||
Packet::~Packet() = default;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <scwx/wsr88d/rpg/packet_factory.hpp>
|
||||
|
||||
#include <scwx/util/logger.hpp>
|
||||
#include <scwx/wsr88d/rpg/cell_trend_data_packet.hpp>
|
||||
#include <scwx/wsr88d/rpg/cell_trend_volume_scan_times.hpp>
|
||||
#include <scwx/wsr88d/rpg/digital_precipitation_data_array_packet.hpp>
|
||||
|
|
@ -26,8 +27,6 @@
|
|||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -35,7 +34,8 @@ 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_);
|
||||
|
||||
typedef std::function<std::shared_ptr<Packet>(std::istream&)>
|
||||
CreateMessageFunction;
|
||||
|
|
@ -95,17 +95,13 @@ std::shared_ptr<Packet> PacketFactory::Create(std::istream& is)
|
|||
|
||||
if (packetValid && create_.find(packetCode) == create_.end())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Unknown packet code: " << packetCode << " (0x"
|
||||
<< std::hex << packetCode << std::dec << ")";
|
||||
logger_->warn("Unknown packet code: {0} (0x{0:x})", packetCode);
|
||||
packetValid = false;
|
||||
}
|
||||
|
||||
if (packetValid)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace)
|
||||
<< logPrefix_ << "Found packet code: " << packetCode << " (0x"
|
||||
<< std::hex << packetCode << std::dec << ")";
|
||||
logger_->trace("Found packet code: {0} (0x{0:x})", packetCode);
|
||||
packet = create_.at(packetCode)(is);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/point_feature_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::point_feature_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::point_feature_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct PointFeature
|
||||
{
|
||||
|
|
@ -95,8 +95,7 @@ bool PointFeatureSymbolPacket::ParseData(std::istream& is)
|
|||
|
||||
if (packet_code() != 20)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include <scwx/wsr88d/rpg/point_graphic_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +13,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::point_graphic_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::point_graphic_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::set<uint16_t> packetCodes_ = {12, 13, 14, 26};
|
||||
|
||||
|
|
@ -70,8 +70,7 @@ bool PointGraphicSymbolPacket::ParseData(std::istream& is)
|
|||
|
||||
if (!packetCodes_.contains(packet_code()))
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/precipitation_rate_data_array_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::precipitation_rate_data_array_packet] ";
|
||||
"scwx::wsr88d::rpg::precipitation_rate_data_array_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class PrecipitationRateDataArrayPacketImpl
|
||||
{
|
||||
|
|
@ -94,21 +94,19 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 18)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRows_ != 13)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of rows: " << p->numberOfRows_;
|
||||
logger_->warn("Invalid number of rows: {}", p->numberOfRows_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -131,10 +129,9 @@ bool PrecipitationRateDataArrayPacket::Parse(std::istream& is)
|
|||
if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 14 ||
|
||||
row.numberOfBytes_ % 2 != 0)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of bytes in row: " << row.numberOfBytes_
|
||||
<< " (Row " << r << ")";
|
||||
logger_->warn("Invalid number of bytes in row: {} (Row {})",
|
||||
row.numberOfBytes_,
|
||||
r);
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
#include <scwx/wsr88d/rpg/product_description_block.hpp>
|
||||
#include <scwx/util/float.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <istream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -16,7 +15,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::product_description_block] ";
|
||||
"scwx::wsr88d::rpg::product_description_block";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::set<int16_t> compressedProducts_ = {
|
||||
32, 94, 99, 134, 135, 138, 149, 152, 153, 154, 155,
|
||||
|
|
@ -660,31 +660,28 @@ bool ProductDescriptionBlock::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->blockDivider_ != -1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block divider: " << p->blockDivider_;
|
||||
logger_->warn("Invalid block divider: {}", p->blockDivider_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->productCode_ < -299 ||
|
||||
(p->productCode_ > -16 && p->productCode_ < 16) ||
|
||||
p->productCode_ > 299)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid product code: " << p->productCode_;
|
||||
logger_->warn("Invalid product code: {}", p->productCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (blockValid)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace)
|
||||
<< logPrefix_ << "Product code: " << p->productCode_;
|
||||
logger_->trace("Product code: {}", p->productCode_);
|
||||
}
|
||||
|
||||
const std::streampos blockEnd = is.tellg();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include <scwx/wsr88d/rpg/product_symbology_block.hpp>
|
||||
#include <scwx/wsr88d/rpg/packet_factory.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +13,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::product_symbology_block] ";
|
||||
"scwx::wsr88d::rpg::product_symbology_block";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class ProductSymbologyBlockImpl
|
||||
{
|
||||
|
|
@ -87,33 +87,29 @@ bool ProductSymbologyBlock::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->blockDivider_ != -1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block divider: " << p->blockDivider_;
|
||||
logger_->warn("Invalid block divider: {}", p->blockDivider_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->blockId_ != 1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block ID: " << p->blockId_;
|
||||
logger_->warn("Invalid block ID: {}", p->blockId_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->lengthOfBlock_ < 10)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block length: " << p->lengthOfBlock_;
|
||||
logger_->warn("Invalid block length: {}", p->lengthOfBlock_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfLayers_ < 1 || p->numberOfLayers_ > 18)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of layers: " << p->numberOfLayers_;
|
||||
logger_->warn("Invalid number of layers: {}", p->numberOfLayers_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -125,7 +121,7 @@ bool ProductSymbologyBlock::Parse(std::istream& is)
|
|||
|
||||
for (uint16_t i = 0; i < p->numberOfLayers_; i++)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace) << logPrefix_ << "Layer " << i;
|
||||
logger_->trace("Layer {}", i);
|
||||
|
||||
std::vector<std::shared_ptr<Packet>> packetList;
|
||||
uint32_t bytesRead = 0;
|
||||
|
|
@ -156,19 +152,17 @@ bool ProductSymbologyBlock::Parse(std::istream& is)
|
|||
|
||||
if (bytesRead < lengthOfDataLayer)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace)
|
||||
<< logPrefix_
|
||||
<< "Layer bytes read smaller than size: " << bytesRead << " < "
|
||||
<< lengthOfDataLayer << " bytes";
|
||||
logger_->trace("Layer bytes read smaller than size: {} < {} bytes",
|
||||
bytesRead,
|
||||
lengthOfDataLayer);
|
||||
blockValid = false;
|
||||
is.seekg(layerEnd, std::ios_base::beg);
|
||||
}
|
||||
if (bytesRead > lengthOfDataLayer)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Layer bytes read larger than size: " << bytesRead << " > "
|
||||
<< lengthOfDataLayer << " bytes";
|
||||
logger_->warn("Layer bytes read larger than size: {} > {} bytes",
|
||||
bytesRead,
|
||||
lengthOfDataLayer);
|
||||
blockValid = false;
|
||||
is.seekg(layerEnd, std::ios_base::beg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/radar_coded_message.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -12,8 +11,8 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::radar_coded_message] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::radar_coded_message";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class RadarCodedMessageImpl
|
||||
{
|
||||
|
|
@ -77,7 +76,7 @@ bool RadarCodedMessage::Parse(std::istream& is)
|
|||
|
||||
bool RadarCodedMessageImpl::LoadBlocks(std::istream& is)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks";
|
||||
logger_->debug("Loading Blocks");
|
||||
|
||||
pupSiteIdentifier_.resize(4);
|
||||
productCategory_.resize(5);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/radial_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -12,8 +11,8 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::radial_data_packet] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::radial_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class RadialDataPacketImpl
|
||||
{
|
||||
|
|
@ -152,29 +151,25 @@ bool RadialDataPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 0xAF1F)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRangeBins_ < 1 || p->numberOfRangeBins_ > 460)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of range bins: " << p->numberOfRangeBins_;
|
||||
logger_->warn("Invalid number of range bins: {}",
|
||||
p->numberOfRangeBins_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRadials_ < 1 || p->numberOfRadials_ > 400)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of radials: " << p->numberOfRadials_;
|
||||
logger_->warn("Invalid number of radials: {}", p->numberOfRadials_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -199,9 +194,9 @@ bool RadialDataPacket::Parse(std::istream& is)
|
|||
if (radial.numberOfRleHalfwords_ < 1 ||
|
||||
radial.numberOfRleHalfwords_ > 230)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of RLE halfwords: "
|
||||
<< radial.numberOfRleHalfwords_ << " (Radial " << r << ")";
|
||||
logger_->warn("Invalid number of RLE halfwords: {} (Radial {})",
|
||||
radial.numberOfRleHalfwords_,
|
||||
r);
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/raster_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -12,8 +11,8 @@ namespace wsr88d
|
|||
namespace rpg
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::raster_data_packet] ";
|
||||
static const std::string logPrefix_ = "scwx::wsr88d::rpg::raster_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class RasterDataPacketImpl
|
||||
{
|
||||
|
|
@ -162,21 +161,19 @@ bool RasterDataPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 0xBA0F && p->packetCode_ != 0xBA07)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfRows_ < 1 || p->numberOfRows_ > 464)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of rows: " << p->numberOfRows_;
|
||||
logger_->warn("Invalid number of rows: {}", p->numberOfRows_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -199,10 +196,9 @@ bool RasterDataPacket::Parse(std::istream& is)
|
|||
if (row.numberOfBytes_ < 2 || row.numberOfBytes_ > 920 ||
|
||||
row.numberOfBytes_ % 2 != 0)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of bytes in row: " << row.numberOfBytes_
|
||||
<< " (Row " << r << ")";
|
||||
logger_->warn("Invalid number of bytes in row: {} (Row {})",
|
||||
row.numberOfBytes_,
|
||||
r);
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include <scwx/wsr88d/rpg/scit_forecast_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +13,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::scit_forecast_data_packet] ";
|
||||
"scwx::wsr88d::rpg::scit_forecast_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::set<uint16_t> packetCodes_ = {23, 24};
|
||||
|
||||
|
|
@ -55,8 +55,7 @@ bool ScitForecastDataPacket::ParseData(std::istream& is)
|
|||
|
||||
if (!packetCodes_.contains(packet_code()))
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/set_color_level_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::set_color_level_packet] ";
|
||||
"scwx::wsr88d::rpg::set_color_level_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class SetColorLevelPacketImpl
|
||||
{
|
||||
|
|
@ -76,22 +76,20 @@ bool SetColorLevelPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 0x0802)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->colorValueIndicator_ != 0x0002)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid color value indicator: " << p->colorValueIndicator_;
|
||||
logger_->warn("Invalid color value indicator: {}",
|
||||
p->colorValueIndicator_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
#include <scwx/wsr88d/rpg/special_graphic_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -14,7 +13,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::special_graphic_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::special_graphic_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
static const std::set<uint16_t> packetCodes_ = {
|
||||
3, 11, 12, 13, 14, 15, 19, 20, 23, 24, 25, 26};
|
||||
|
|
@ -72,7 +72,7 @@ bool SpecialGraphicSymbolPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
|
|
@ -82,15 +82,13 @@ bool SpecialGraphicSymbolPacket::Parse(std::istream& is)
|
|||
|
||||
if (!packetCodes_.contains(p->packetCode_))
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->lengthOfBlock_ < minBlockLength ||
|
||||
p->lengthOfBlock_ > maxBlockLength)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
|
||||
logger_->warn("Invalid length of block: {}", p->lengthOfBlock_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/sti_circle_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::sti_circle_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::sti_circle_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct StiCircleSymbol
|
||||
{
|
||||
|
|
@ -71,8 +71,7 @@ bool StiCircleSymbolPacket::ParseData(std::istream& is)
|
|||
|
||||
if (packet_code() != 25)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/storm_id_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::storm_id_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::storm_id_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct StormIdSymbol
|
||||
{
|
||||
|
|
@ -71,8 +71,7 @@ bool StormIdSymbolPacket::ParseData(std::istream& is)
|
|||
|
||||
if (packet_code() != 15)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << packet_code();
|
||||
logger_->warn("Invalid packet code: {}", packet_code());
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@
|
|||
#include <scwx/wsr88d/rpg/level3_message_header.hpp>
|
||||
#include <scwx/wsr88d/rpg/packet_factory.hpp>
|
||||
#include <scwx/wsr88d/rpg/product_description_block.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -16,7 +15,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::tabular_alphanumeric_block] ";
|
||||
"scwx::wsr88d::rpg::tabular_alphanumeric_block";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class TabularAlphanumericBlockImpl
|
||||
{
|
||||
|
|
@ -92,28 +92,24 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->blockDivider1_ != -1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid first block divider: " << p->blockDivider1_;
|
||||
logger_->warn("Invalid first block divider: {}", p->blockDivider1_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->blockId_ != 3)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block ID: " << p->blockId_;
|
||||
logger_->warn("Invalid block ID: {}", p->blockId_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->lengthOfBlock_ < 10)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid block length: " << p->lengthOfBlock_;
|
||||
logger_->warn("Invalid block length: {}", p->lengthOfBlock_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -151,15 +147,12 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
|
|||
|
||||
if (p->blockDivider2_ != -1)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid second block divider: " << p->blockDivider2_;
|
||||
logger_->warn("Invalid second block divider: {}", p->blockDivider2_);
|
||||
blockValid = false;
|
||||
}
|
||||
if (p->numberOfPages_ < 1 || p->numberOfPages_ > 48)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid number of pages: " << p->numberOfPages_;
|
||||
logger_->warn("Invalid number of pages: {}", p->numberOfPages_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -184,10 +177,9 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
|
|||
}
|
||||
else if (numberOfCharacters > 80)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_
|
||||
<< "Invalid number of characters: " << numberOfCharacters
|
||||
<< " (Page " << (i + 1) << ")";
|
||||
logger_->warn("Invalid number of characters: {} (Page {})",
|
||||
numberOfCharacters,
|
||||
(i + 1));
|
||||
blockValid = false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -211,7 +203,7 @@ bool TabularAlphanumericBlock::Parse(std::istream& is, bool skipHeader)
|
|||
}
|
||||
else if (skipHeader && is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/tabular_product_message.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::tabular_product_message] ";
|
||||
"scwx::wsr88d::rpg::tabular_product_message";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class TabularProductMessageImpl
|
||||
{
|
||||
|
|
@ -82,7 +82,7 @@ bool TabularProductMessageImpl::LoadBlocks(std::istream& is)
|
|||
|
||||
bool tabularValid = true;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Loading Blocks";
|
||||
logger_->debug("Loading Blocks");
|
||||
|
||||
std::streampos offsetBasePos = is.tellg();
|
||||
|
||||
|
|
@ -99,8 +99,7 @@ bool TabularProductMessageImpl::LoadBlocks(std::istream& is)
|
|||
tabularValid = tabularBlock_->Parse(is, skipTabularHeader);
|
||||
is.seekg(offsetBasePos, std::ios_base::beg);
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug)
|
||||
<< logPrefix_ << "Tabular alphanumeric block valid: " << tabularValid;
|
||||
logger_->debug("Tabular alphanumeric block valid: {}", tabularValid);
|
||||
|
||||
if (!tabularValid)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/text_and_special_symbol_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::text_and_special_symbol_packet] ";
|
||||
"scwx::wsr88d::rpg::text_and_special_symbol_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class TextAndSpecialSymbolPacketImpl
|
||||
{
|
||||
|
|
@ -113,21 +113,19 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 1 && p->packetCode_ != 2 && p->packetCode_ != 8)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->lengthOfBlock_ < 1 || p->lengthOfBlock_ > 32767)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid length of block: " << p->packetCode_;
|
||||
logger_->warn("Invalid length of block: {}", p->lengthOfBlock_);
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->packetCode_ == 8)
|
||||
|
|
@ -141,8 +139,7 @@ bool TextAndSpecialSymbolPacket::Parse(std::istream& is)
|
|||
|
||||
if (blockValid && textLength < 0)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Too few bytes in block: " << p->lengthOfBlock_;
|
||||
logger_->warn("Too few bytes in block: {}", p->lengthOfBlock_);
|
||||
blockValid = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/unlinked_contour_vector_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::unlinked_contour_vector_packet] ";
|
||||
"scwx::wsr88d::rpg::unlinked_contour_vector_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class UnlinkedContourVectorPacketImpl
|
||||
{
|
||||
|
|
@ -80,15 +80,14 @@ bool UnlinkedContourVectorPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 0x3501)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/unlinked_vector_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::unlinked_vector_packet] ";
|
||||
"scwx::wsr88d::rpg::unlinked_vector_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
class UnlinkedVectorPacketImpl
|
||||
{
|
||||
|
|
@ -94,7 +94,7 @@ bool UnlinkedVectorPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else if (p->packetCode_ == 10)
|
||||
|
|
@ -108,8 +108,7 @@ bool UnlinkedVectorPacket::Parse(std::istream& is)
|
|||
{
|
||||
if (p->packetCode_ != 7 && p->packetCode_ != 10)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/vector_arrow_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::vector_arrow_data_packet] ";
|
||||
"scwx::wsr88d::rpg::vector_arrow_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct VectorArrow
|
||||
{
|
||||
|
|
@ -88,15 +88,14 @@ bool VectorArrowDataPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 5)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
#include <scwx/wsr88d/rpg/wind_barb_data_packet.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace wsr88d
|
||||
|
|
@ -13,7 +12,8 @@ namespace rpg
|
|||
{
|
||||
|
||||
static const std::string logPrefix_ =
|
||||
"[scwx::wsr88d::rpg::wind_barb_data_packet] ";
|
||||
"scwx::wsr88d::rpg::wind_barb_data_packet";
|
||||
static const auto logger_ = util::Logger::Create(logPrefix_);
|
||||
|
||||
struct WindBarb
|
||||
{
|
||||
|
|
@ -87,15 +87,14 @@ bool WindBarbDataPacket::Parse(std::istream& is)
|
|||
|
||||
if (is.eof())
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Reached end of file";
|
||||
logger_->debug("Reached end of file");
|
||||
blockValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p->packetCode_ != 4)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(warning)
|
||||
<< logPrefix_ << "Invalid packet code: " << p->packetCode_;
|
||||
logger_->warn("Invalid packet code: {}", p->packetCode_);
|
||||
blockValid = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue