1 /* -*- c++ -*- */ 2 /* 3 * Copyright 2004,2010,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 %include <basic_block.i> 24 25 class gr::block; 26 typedef boost::shared_ptr<gr::block> gr::block_sptr; 27 %template(block_sptr) boost::shared_ptr<gr::block>; 28 29 // support vectors of these... 30 namespace std { 31 %template(x_vector_block_sptr) vector<gr::block_sptr>; 32 }; 33 34 class gr::block : public gr::basic_block 35 { 36 protected: 37 block (const std::string &name, 38 gr::io_signature::sptr input_signature, 39 gr::io_signature::sptr output_signature); 40 41 public: 42 43 virtual ~block (); 44 45 unsigned history () const; 46 47 void declare_sample_delay(int which, int delay); 48 void declare_sample_delay(unsigned int delay); 49 unsigned sample_delay(int which) const; 50 51 void set_output_multiple(int multiple); 52 int output_multiple () const; 53 double relative_rate () const; 54 uint64_t relative_rate_i () const; 55 uint64_t relative_rate_d () const; 56 57 bool start(); 58 bool stop(); 59 60 uint64_t nitems_read(unsigned int which_input); 61 uint64_t nitems_written(unsigned int which_output); 62 63 void set_log_level(std::string level); 64 std::string log_level(); 65 66 // Methods to manage the block's max_noutput_items size. 67 int max_noutput_items(); 68 void set_max_noutput_items(int m); 69 void unset_max_noutput_items(); 70 bool is_set_max_noutput_items(); 71 void set_min_noutput_items(int m); 72 int min_noutput_items() const; 73 74 // Methods to manage block's min/max buffer sizes. 75 long max_output_buffer(int i); 76 void set_max_output_buffer(long max_output_buffer); 77 void set_max_output_buffer(int port, long max_output_buffer); 78 long min_output_buffer(int i); 79 void set_min_output_buffer(long min_output_buffer); 80 void set_min_output_buffer(int port, long min_output_buffer); 81 82 // Methods to access performance counters 83 float pc_noutput_items(); 84 float pc_noutput_items_avg(); 85 float pc_noutput_items_var(); 86 float pc_nproduced(); 87 float pc_nproduced_avg(); 88 float pc_nproduced_var(); 89 float pc_input_buffers_full(int which); 90 float pc_input_buffers_full_avg(int which); 91 float pc_input_buffers_full_var(int which); 92 std::vector<float> pc_input_buffers_full(); 93 std::vector<float> pc_input_buffers_full_avg(); 94 std::vector<float> pc_input_buffers_full_var(); 95 float pc_output_buffers_full(int which); 96 float pc_output_buffers_full_avg(int which); 97 float pc_output_buffers_full_var(int which); 98 std::vector<float> pc_output_buffers_full(); 99 std::vector<float> pc_output_buffers_full_avg(); 100 std::vector<float> pc_output_buffers_full_var(); 101 float pc_work_time(); 102 float pc_work_time_avg(); 103 float pc_work_time_var(); 104 float pc_work_time_total(); 105 float pc_throughput_avg(); 106 107 // Methods to manage processor affinity. 108 void set_processor_affinity(const std::vector<int> &mask); 109 void unset_processor_affinity(); 110 std::vector<int> processor_affinity(); 111 112 // Methods to manage thread priority 113 int active_thread_priority(); 114 int thread_priority(); 115 int set_thread_priority(int priority); 116 117 // internal use 118 //block_detail_sptr detail () const { return d_detail; } 119 //void set_detail (block_detail_sptr detail) { d_detail = detail; } 120 }; 121