shared pointers for discovered universe metadata
This commit is contained in:
parent
3e8cc72a61
commit
1e2bb87493
|
@ -226,8 +226,8 @@ void MultiverseModel::doDiscovery()
|
|||
endRemoveRows();
|
||||
|
||||
beginInsertRows(parentIndex, 0, node_->discovered.size());
|
||||
for (auto discovery : node_->discovered)
|
||||
insert(parentIndex, nullptr, &discovery);
|
||||
for (auto& discovery : node_->discovered)
|
||||
new MultiverseItem(parent, nullptr, discovery.get());
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ void discovery_list_data::iStream(ACN::PDU::Stream stream)
|
|||
{
|
||||
while (stream->good())
|
||||
{
|
||||
found.emplace_back(discoveredUniverse());
|
||||
*stream >> found.back().universe;
|
||||
found.emplace_back(std::make_shared<discoveredUniverse>());
|
||||
*stream >> found.back()->universe;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void discovery_list_data::iStream(ACN::PDU::Stream stream)
|
|||
void discovery_list_data::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
for (auto & d : found)
|
||||
*stream << d.universe;
|
||||
*stream << d->universe;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ struct discoveredUniverse
|
|||
struct discovery_list_data
|
||||
: ACN::PDU::pdu_data
|
||||
{
|
||||
std::vector<discoveredUniverse> found; //!< discovered universes
|
||||
std::vector<std::shared_ptr<discoveredUniverse>> found; //!< discovered universes
|
||||
|
||||
size_t streamSize() const override { return 2 * found.size(); }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
|
|
@ -331,7 +331,7 @@ void Receiver::discoveryListHanlder(ACN::PDU::Message<EXTENDED::DISCOVERY::Pdu>
|
|||
// wipe all known discoveries from this CID
|
||||
for (auto disc = discovered.begin(); disc != discovered.end();)
|
||||
{
|
||||
if (disc->source == rlpHeader->cid)
|
||||
if (disc->get()->source == rlpHeader->cid)
|
||||
disc = discovered.erase(disc);
|
||||
else
|
||||
++disc;
|
||||
|
@ -339,8 +339,8 @@ void Receiver::discoveryListHanlder(ACN::PDU::Message<EXTENDED::DISCOVERY::Pdu>
|
|||
|
||||
for (auto& found : data->found)
|
||||
{
|
||||
found.source = rlpHeader->cid;
|
||||
found.description = frameHeader->source_name;
|
||||
found->source = rlpHeader->cid;
|
||||
found->description = frameHeader->source_name;
|
||||
discovered.insert(found);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
void discoveryStop();
|
||||
void onDiscovered(const std::function<void()>);
|
||||
/// The listing of discovered universes.
|
||||
std::set<EXTENDED::DISCOVERY::discoveredUniverse> discovered;
|
||||
std::set<std::shared_ptr<EXTENDED::DISCOVERY::discoveredUniverse>> discovered;
|
||||
|
||||
protected:
|
||||
// 5 - E1.31 use of the ACN Root Layer Protocol
|
||||
|
|
|
@ -128,7 +128,7 @@ void Source::discoveryAnnounce()
|
|||
auto header = std::make_shared<EXTENDED::DISCOVERY::discovery_list_header>();
|
||||
|
||||
// known universes
|
||||
std::vector<EXTENDED::DISCOVERY::discoveredUniverse> list;
|
||||
std::vector<std::shared_ptr<EXTENDED::DISCOVERY::discoveredUniverse>> list;
|
||||
universes_mutext_.lock();
|
||||
for (const auto & [num, univ] : universes_)
|
||||
{
|
||||
|
@ -136,8 +136,8 @@ void Source::discoveryAnnounce()
|
|||
continue;
|
||||
if (univ->destination.type != ACN::SDT::SDT_ADDR_NULL)
|
||||
continue;
|
||||
list.emplace_back(EXTENDED::DISCOVERY::discoveredUniverse());
|
||||
list.back().universe = num;
|
||||
list.emplace_back(std::make_shared<EXTENDED::DISCOVERY::discoveredUniverse>());
|
||||
list.back()->universe = num;
|
||||
}
|
||||
universes_mutext_.unlock();
|
||||
|
||||
|
|
Loading…
Reference in New Issue