GNU Radio 3.7.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2012-2013 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef GR_RUNTIME_BLOCK_REGISTRY_H 00024 #define GR_RUNTIME_BLOCK_REGISTRY_H 00025 00026 #include <gnuradio/api.h> 00027 #include <gnuradio/basic_block.h> 00028 #include <map> 00029 00030 namespace gr { 00031 00032 #ifndef GR_BASIC_BLOCK_H 00033 class basic_block; 00034 class block; 00035 #endif 00036 00037 class GR_RUNTIME_API block_registry 00038 { 00039 public: 00040 block_registry(); 00041 00042 long block_register(basic_block* block); 00043 void block_unregister(basic_block* block); 00044 00045 std::string register_symbolic_name(basic_block* block); 00046 void register_symbolic_name(basic_block* block, std::string name); 00047 00048 basic_block_sptr block_lookup(pmt::pmt_t symbol); 00049 00050 void register_primitive(std::string blk, gr::block* ref); 00051 void unregister_primitive(std::string blk); 00052 void notify_blk(std::string blk); 00053 00054 private: 00055 //typedef std::map< long, basic_block_sptr > blocksubmap_t; 00056 typedef std::map< long, basic_block* > blocksubmap_t; 00057 typedef std::map< std::string, blocksubmap_t > blockmap_t; 00058 00059 blockmap_t d_map; 00060 pmt::pmt_t d_ref_map; 00061 std::map< std::string, block*> primitive_map; 00062 gr::thread::mutex d_mutex; 00063 }; 00064 00065 } /* namespace gr */ 00066 00067 GR_RUNTIME_API extern gr::block_registry global_block_registry; 00068 00069 #endif /* GR_RUNTIME_BLOCK_REGISTRY_H */