Skip to content

Commit

Permalink
Associate devices with added senders and receivers
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofigueiredobisect committed Sep 10, 2024
1 parent e012e93 commit 1bfba3a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
36 changes: 36 additions & 0 deletions cpp/libs/ossrf_nmos_api/lib/src/context/resource_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,39 @@ std::vector<std::string> resource_map_t::get_receiver_ids() const

return ids;
}

std::vector<std::string> resource_map_t::get_sender_ids() const
{
std::vector<std::string> ids;
lock_t lock(mutex_);
for(const auto& [id, resources] : map_)
{
for(const auto& resource : resources)
{
if(resource->get_resource_type() == nmos::types::sender)
{
ids.push_back(id);
}
}
}

return ids;
}

std::vector<std::string> resource_map_t::get_receiver_ids() const
{
std::vector<std::string> ids;
lock_t lock(mutex_);
for(const auto& [id, resources] : map_)
{
for(const auto& resource : resources)
{
if(resource->get_resource_type() == nmos::types::receiver)
{
ids.push_back(id);
}
}
}

return ids;
}
1 change: 0 additions & 1 deletion cpp/libs/ossrf_nmos_api/lib/src/context/resource_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace ossrf
std::vector<std::string> get_sender_ids() const;
std::vector<std::string> get_receiver_ids() const;
};

using resource_map_ptr = std::shared_ptr<resource_map_t>;
using resource_map_uptr = std::unique_ptr<resource_map_t>;
} // namespace ossrf

0 comments on commit 1bfba3a

Please sign in to comment.