From f0371292a43c3e4e3c68d8631c57d64ab10faf4c Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 7 May 2019 14:39:26 -0700 Subject: rfnoc: Add detail::block_container_t class This is a storage for the noc_block_base derivatives. It supports finding blocks. --- host/lib/include/uhdlib/rfnoc/block_container.hpp | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 host/lib/include/uhdlib/rfnoc/block_container.hpp (limited to 'host/lib/include/uhdlib') diff --git a/host/lib/include/uhdlib/rfnoc/block_container.hpp b/host/lib/include/uhdlib/rfnoc/block_container.hpp new file mode 100644 index 000000000..e32feed52 --- /dev/null +++ b/host/lib/include/uhdlib/rfnoc/block_container.hpp @@ -0,0 +1,57 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_LIBUHD_BLOCK_CONTAINER_HPP +#define INCLUDED_LIBUHD_BLOCK_CONTAINER_HPP + +#include +#include +#include +#include +#include +#include + +namespace uhd { namespace rfnoc { namespace detail { + +/*! Storage container for RFNoC block controllers + */ +class block_container_t +{ +public: + block_container_t(); + + void register_block(noc_block_base::sptr block); + + /*! Returns the block ids of all blocks that match the specified hint + * + * See uhd::rfnoc::rfnoc_graph::find_blocks() for details. + */ + std::vector find_blocks(const std::string& block_id_hint) const; + + /*! Checks if a specific NoC block exists on the device. + * + * See uhd::rfnoc::rfnoc_graph::has_block() for details. + */ + bool has_block(const block_id_t& block_id) const; + + /*! \brief Returns a block controller class for an NoC block. + * + * See uhd::rfnoc::rfnoc_graph::get_block() for details. + */ + noc_block_base::sptr get_block(const block_id_t& block_id) const; + +private: + //! Lock access to the storage + mutable std::mutex _mutex; + + //! The actual block registry + std::unordered_set _blocks; +}; + +}}} /* namespace uhd::rfnoc::detail */ + +#endif /* INCLUDED_LIBUHD_BLOCK_CONTAINER_HPP */ + -- cgit v1.2.3