GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
block_registry.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012-2013 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef GR_RUNTIME_BLOCK_REGISTRY_H
24 #define GR_RUNTIME_BLOCK_REGISTRY_H
25 
26 #include <gnuradio/api.h>
27 #include <gnuradio/basic_block.h>
28 #include <gnuradio/thread/thread.h>
29 #include <map>
30 
31 namespace gr {
32 
33 #ifndef GR_BASIC_BLOCK_H
34 class basic_block;
35 class block;
36 #endif
37 
39 {
40 public:
42 
43  long block_register(basic_block* block);
44  void block_unregister(basic_block* block);
45 
46  std::string register_symbolic_name(basic_block* block);
47  void register_symbolic_name(basic_block* block, std::string name);
48  void update_symbolic_name(basic_block* block, std::string name);
49 
50  basic_block_sptr block_lookup(pmt::pmt_t symbol);
51 
52  void register_primitive(std::string blk, gr::block* ref);
53  void unregister_primitive(std::string blk);
54  void notify_blk(std::string blk);
55 
56 private:
57  // typedef std::map< long, basic_block_sptr > blocksubmap_t;
58  typedef std::map<long, basic_block*> blocksubmap_t;
59  typedef std::map<std::string, blocksubmap_t> blockmap_t;
60 
61  blockmap_t d_map;
62  pmt::pmt_t d_ref_map;
63  std::map<std::string, block*> primitive_map;
64  gr::thread::mutex d_mutex;
65 };
66 
67 } /* namespace gr */
68 
70 
71 #endif /* GR_RUNTIME_BLOCK_REGISTRY_H */
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
Definition: pmt.h:96
#define GR_RUNTIME_API
Definition: gnuradio-runtime/include/gnuradio/api.h:30
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
The abstract base class for all signal processing blocks.Basic blocks are the bare abstraction of an ...
Definition: basic_block.h:56
GR_RUNTIME_API gr::block_registry global_block_registry
boost::mutex mutex
Definition: thread.h:48
Definition: block_registry.h:38
The abstract base class for all &#39;terminal&#39; processing blocks.A signal processing flow is constructed ...
Definition: block.h:71