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