From 0f12441cf801f060c8b0a778016c658db5486607 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 18 Aug 2009 19:12:15 -0700 Subject: [PATCH] Add top-level msg_passing.h include file. Incorporate send.h into msg_passing.h. --- gruel/src/include/gruel/Makefile.am | 2 +- gruel/src/include/gruel/msg_passing.h | 88 +++++++++++++++++++++++++++ gruel/src/include/gruel/send.h | 49 --------------- 3 files changed, 89 insertions(+), 50 deletions(-) create mode 100644 gruel/src/include/gruel/msg_passing.h delete mode 100644 gruel/src/include/gruel/send.h diff --git a/gruel/src/include/gruel/Makefile.am b/gruel/src/include/gruel/Makefile.am index 9f50cb61..9aedc7fd 100644 --- a/gruel/src/include/gruel/Makefile.am +++ b/gruel/src/include/gruel/Makefile.am @@ -31,11 +31,11 @@ gruelinclude_HEADERS = \ msg_accepter.h \ msg_accepter_msgq.h \ msg_queue.h \ + msg_passing.h \ pmt.h \ pmt_pool.h \ pmt_serial_tags.h \ realtime.h \ - send.h \ sys_pri.h \ thread_body_wrapper.h \ thread_group.h \ diff --git a/gruel/src/include/gruel/msg_passing.h b/gruel/src/include/gruel/msg_passing.h new file mode 100644 index 00000000..61105849 --- /dev/null +++ b/gruel/src/include/gruel/msg_passing.h @@ -0,0 +1,88 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#ifndef INCLUDED_GRUEL_MSG_PASSING_H +#define INCLUDED_GRUEL_MSG_PASSING_H + +/*! + * \brief Include this header to use the message passing features + */ + +#include +#include + + +namespace gruel { + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + static inline pmt::pmt_t + send(msg_accepter_sptr accepter, const pmt::pmt_t &msg) + { + return accepter->post(msg); + } + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + static inline pmt::pmt_t + send(msg_accepter &accepter, const pmt::pmt_t &msg) + { + return accepter.post(msg); + } + + /*! + * \brief send message to msg_accepter + * + * \param accepter is the target of the send. precond: pmt_is_msg_accepter(accepter) + * \param msg is the message to send. It's usually a pmt tuple. + * + * Sending a message is an asynchronous operation. The \p send + * call will not wait for the message either to arrive at the + * destination or to be received. + * + * \returns msg + */ + pmt::pmt_t + send(const pmt_t &accepter, const pmt::pmt_t &msg); + + +} /* namespace gruel */ + +#endif /* INCLUDED_GRUEL_MSG_PASSING_H */ diff --git a/gruel/src/include/gruel/send.h b/gruel/src/include/gruel/send.h deleted file mode 100644 index 292017d4..00000000 --- a/gruel/src/include/gruel/send.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_GRUEL_SEND_H -#define INCLUDED_GRUEL_SEND_H - -#include - -namespace gruel { - - - /*! - * \brief send \p msg to \p msg_accepter - * - * Sending a message is an asynchronous operation. The \p send - * call will not wait for the message either to arrive at the - * destination or to be received. - * - * \returns msg - */ - static inline pmt::pmt_t - send(msg_accepter &acc, pmt::pmt_t msg) - { - return acc.post(msg); - } - - - -} /* namespace gruel */ - - -#endif /* INCLUDED_SEND_H */ -- 2.30.2