GNU Radio 3.6.5 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2009 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 along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 */ 00021 #ifndef INCLUDED_GRUEL_MSG_PASSING_H 00022 #define INCLUDED_GRUEL_MSG_PASSING_H 00023 00024 /*! 00025 * \brief Include this header to use the message passing features 00026 */ 00027 00028 #include <gruel/api.h> 00029 #include <gruel/pmt.h> 00030 #include <gruel/msg_accepter.h> 00031 00032 00033 namespace gruel { 00034 00035 /*! 00036 * \brief send message to msg_accepter 00037 * 00038 * \param accepter is the target of the send. 00039 * \param which_port A pmt symbol describing the port by name. 00040 * \param msg is the message to send. It's usually a pmt tuple. 00041 * 00042 * Sending a message is an asynchronous operation. The \p send 00043 * call will not wait for the message either to arrive at the 00044 * destination or to be received. 00045 * 00046 * \returns msg 00047 */ 00048 static inline pmt::pmt_t 00049 send(msg_accepter_sptr accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg) 00050 { 00051 accepter->post(which_port, msg); 00052 return msg; 00053 } 00054 00055 /*! 00056 * \brief send message to msg_accepter 00057 * 00058 * \param accepter is the target of the send. 00059 * \param which_port A pmt symbol describing the port by name. 00060 * \param msg is the message to send. It's usually a pmt tuple. 00061 * 00062 * Sending a message is an asynchronous operation. The \p send 00063 * call will not wait for the message either to arrive at the 00064 * destination or to be received. 00065 * 00066 * \returns msg 00067 */ 00068 static inline pmt::pmt_t 00069 send(msg_accepter *accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg) 00070 { 00071 accepter->post(which_port, msg); 00072 return msg; 00073 } 00074 00075 /*! 00076 * \brief send message to msg_accepter 00077 * 00078 * \param accepter is the target of the send. 00079 * \param which_port A pmt symbol describing the port by name. 00080 * \param msg is the message to send. It's usually a pmt tuple. 00081 * 00082 * Sending a message is an asynchronous operation. The \p send 00083 * call will not wait for the message either to arrive at the 00084 * destination or to be received. 00085 * 00086 * \returns msg 00087 */ 00088 static inline pmt::pmt_t 00089 send(msg_accepter &accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg) 00090 { 00091 accepter.post(which_port, msg); 00092 return msg; 00093 } 00094 00095 /*! 00096 * \brief send message to msg_accepter 00097 * 00098 * \param accepter is the target of the send. precond: pmt_is_msg_accepter(accepter) 00099 * \param which_port A pmt symbol describing the port by name. 00100 * \param msg is the message to send. It's usually a pmt tuple. 00101 * 00102 * Sending a message is an asynchronous operation. The \p send 00103 * call will not wait for the message either to arrive at the 00104 * destination or to be received. 00105 * 00106 * \returns msg 00107 */ 00108 static inline pmt::pmt_t 00109 send(pmt::pmt_t accepter, const pmt::pmt_t &which_port, const pmt::pmt_t &msg) 00110 { 00111 return send(pmt_msg_accepter_ref(accepter), which_port, msg); 00112 } 00113 00114 } /* namespace gruel */ 00115 00116 #endif /* INCLUDED_GRUEL_MSG_PASSING_H */