GNU Radio 3.4.2 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/pmt.h> 00029 #include <gruel/msg_accepter.h> 00030 00031 00032 namespace gruel { 00033 00034 /*! 00035 * \brief send message to msg_accepter 00036 * 00037 * \param accepter is the target of the send. 00038 * \param msg is the message to send. It's usually a pmt tuple. 00039 * 00040 * Sending a message is an asynchronous operation. The \p send 00041 * call will not wait for the message either to arrive at the 00042 * destination or to be received. 00043 * 00044 * \returns msg 00045 */ 00046 static inline pmt::pmt_t 00047 send(msg_accepter_sptr accepter, const pmt::pmt_t &msg) 00048 { 00049 accepter->post(msg); 00050 return msg; 00051 } 00052 00053 /*! 00054 * \brief send message to msg_accepter 00055 * 00056 * \param accepter is the target of the send. 00057 * \param msg is the message to send. It's usually a pmt tuple. 00058 * 00059 * Sending a message is an asynchronous operation. The \p send 00060 * call will not wait for the message either to arrive at the 00061 * destination or to be received. 00062 * 00063 * \returns msg 00064 */ 00065 static inline pmt::pmt_t 00066 send(msg_accepter *accepter, const pmt::pmt_t &msg) 00067 { 00068 accepter->post(msg); 00069 return msg; 00070 } 00071 00072 /*! 00073 * \brief send message to msg_accepter 00074 * 00075 * \param accepter is the target of the send. 00076 * \param msg is the message to send. It's usually a pmt tuple. 00077 * 00078 * Sending a message is an asynchronous operation. The \p send 00079 * call will not wait for the message either to arrive at the 00080 * destination or to be received. 00081 * 00082 * \returns msg 00083 */ 00084 static inline pmt::pmt_t 00085 send(msg_accepter &accepter, const pmt::pmt_t &msg) 00086 { 00087 accepter.post(msg); 00088 return msg; 00089 } 00090 00091 /*! 00092 * \brief send message to msg_accepter 00093 * 00094 * \param accepter is the target of the send. precond: pmt_is_msg_accepter(accepter) 00095 * \param msg is the message to send. It's usually a pmt tuple. 00096 * 00097 * Sending a message is an asynchronous operation. The \p send 00098 * call will not wait for the message either to arrive at the 00099 * destination or to be received. 00100 * 00101 * \returns msg 00102 */ 00103 static inline pmt::pmt_t 00104 send(pmt::pmt_t accepter, const pmt::pmt_t &msg) 00105 { 00106 return send(pmt_msg_accepter_ref(accepter), msg); 00107 } 00108 00109 } /* namespace gruel */ 00110 00111 #endif /* INCLUDED_GRUEL_MSG_PASSING_H */