GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2005,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 INCLUDED_GR_MESSAGE_DEBUG_IMPL_H 00024 #define INCLUDED_GR_MESSAGE_DEBUG_IMPL_H 00025 00026 #include <blocks/message_debug.h> 00027 #include <gr_block.h> 00028 #include <gruel/thread.h> 00029 #include <gruel/pmt.h> 00030 00031 namespace gr { 00032 namespace blocks { 00033 00034 class message_debug_impl : public message_debug 00035 { 00036 private: 00037 00038 /*! 00039 * \brief Messages received in this port are printed to stdout. 00040 * 00041 * This port receives messages from the scheduler's message 00042 * handling mechanism and prints it to stdout. This message 00043 * handler function is only meant to be used by the scheduler to 00044 * handle messages posted to port 'print'. 00045 * 00046 * \param msg A pmt message passed from the scheduler's message handling. 00047 */ 00048 void print(pmt::pmt_t msg); 00049 00050 /*! 00051 * \brief PDU formatted messages received in this port are printed to stdout. 00052 * 00053 * This port receives messages from the scheduler's message 00054 * handling mechanism and prints it to stdout. This message 00055 * handler function is only meant to be used by the scheduler to 00056 * handle messages posted to port 'print'. 00057 * 00058 * \param pdu A PDU message passed from the scheduler's message handling. 00059 */ 00060 void print_pdu(pmt::pmt_t pdu); 00061 00062 /*! 00063 * \brief Messages received in this port are stored in a vector. 00064 * 00065 * This port receives messages from the scheduler's message 00066 * handling mechanism and stores it in a vector. Messages can be 00067 * retrieved later using the 'get_message' function. This 00068 * message handler function is only meant to be used by the 00069 * scheduler to handle messages posted to port 'store'. 00070 * 00071 * \param msg A pmt message passed from the scheduler's message handling. 00072 */ 00073 void store(pmt::pmt_t msg); 00074 00075 gruel::mutex d_mutex; 00076 std::vector<pmt::pmt_t> d_messages; 00077 00078 public: 00079 message_debug_impl(); 00080 ~message_debug_impl(); 00081 00082 int num_messages(); 00083 pmt::pmt_t get_message(int i); 00084 }; 00085 00086 } /* namespace blocks */ 00087 } /* namespace gr */ 00088 00089 #endif /* INCLUDED_GR_MESSAGE_DEBUG_IMPL_H */