mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:50:05 +00:00
Support text product updates
This commit is contained in:
parent
be1d7323bd
commit
a202e0e2a0
7 changed files with 66 additions and 3 deletions
|
|
@ -68,10 +68,23 @@ bool TextProductFile::LoadData(std::istream& is)
|
|||
{
|
||||
std::shared_ptr<TextProductMessage> message =
|
||||
TextProductMessage::Create(is);
|
||||
bool duplicate = false;
|
||||
|
||||
if (message != nullptr)
|
||||
{
|
||||
p->messages_.push_back(message);
|
||||
for (auto m : p->messages_)
|
||||
{
|
||||
if (*m->wmo_header().get() == *message->wmo_header().get())
|
||||
{
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!duplicate)
|
||||
{
|
||||
p->messages_.push_back(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include <scwx/awips/text_product_message.hpp>
|
||||
#include <scwx/awips/pvtec.hpp>
|
||||
#include <scwx/awips/wmo_header.hpp>
|
||||
#include <scwx/common/characters.hpp>
|
||||
#include <scwx/util/streams.hpp>
|
||||
|
||||
|
|
@ -100,6 +99,11 @@ TextProductMessage::TextProductMessage(TextProductMessage&&) noexcept = default;
|
|||
TextProductMessage&
|
||||
TextProductMessage::operator=(TextProductMessage&&) noexcept = default;
|
||||
|
||||
std::shared_ptr<WmoHeader> TextProductMessage::wmo_header() const
|
||||
{
|
||||
return p->wmoHeader_;
|
||||
}
|
||||
|
||||
size_t TextProductMessage::data_size() const
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ public:
|
|||
}
|
||||
~WmoHeaderImpl() = default;
|
||||
|
||||
bool operator==(const WmoHeaderImpl& o) const;
|
||||
|
||||
std::string sequenceNumber_;
|
||||
std::string dataType_;
|
||||
std::string geographicDesignator_;
|
||||
|
|
@ -54,6 +56,24 @@ WmoHeader::~WmoHeader() = default;
|
|||
WmoHeader::WmoHeader(WmoHeader&&) noexcept = default;
|
||||
WmoHeader& WmoHeader::operator=(WmoHeader&&) noexcept = default;
|
||||
|
||||
bool WmoHeader::operator==(const WmoHeader& o) const
|
||||
{
|
||||
return (*p.get() == *o.p.get());
|
||||
}
|
||||
|
||||
bool WmoHeaderImpl::operator==(const WmoHeaderImpl& o) const
|
||||
{
|
||||
return (sequenceNumber_ == o.sequenceNumber_ && //
|
||||
dataType_ == o.dataType_ && //
|
||||
geographicDesignator_ == o.geographicDesignator_ && //
|
||||
bulletinId_ == o.bulletinId_ && //
|
||||
icao_ == o.icao_ && //
|
||||
dateTime_ == o.dateTime_ && //
|
||||
bbbIndicator_ == o.bbbIndicator_ && //
|
||||
productCategory_ == o.productCategory_ && //
|
||||
productDesignator_ == o.productDesignator_);
|
||||
}
|
||||
|
||||
const std::string& WmoHeader::sequence_number() const
|
||||
{
|
||||
return p->sequenceNumber_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue