USRP Hardware Driver and USRP Manual  Version: 4.7.0.0-22-g6758966a
UHD and USRP Manual
block_controller_factory_python.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2020 Ettus Research, a National Instruments Brand
3 //
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 //
6 
7 #pragma once
8 
10 
11 namespace uhd { namespace rfnoc {
12 
13 // Static factory for constructing a block controller T given an instance of
14 // the superclass noc_block_base for the block controller, as might be
15 // returned from uhd::rfnoc::graph::get_block(). The instance is downcast to
16 // the derived class and returned to the client as a T::sptr. If block_base
17 // does not represent an instance of T, nullptr is returned.
18 template <typename T>
20 {
21 public:
22  static typename T::sptr make_from(uhd::rfnoc::noc_block_base::sptr block_base)
23  {
24  return std::dynamic_pointer_cast<T>(block_base);
25  }
26 };
27 
28 }} // namespace uhd::rfnoc
Definition: block_controller_factory_python.hpp:20
static T::sptr make_from(uhd::rfnoc::noc_block_base::sptr block_base)
Definition: block_controller_factory_python.hpp:22
std::shared_ptr< noc_block_base > sptr
Definition: noc_block_base.hpp:48
Definition: build_info.hpp:12