~ubuntu-branches/ubuntu/trusty/gnuradio/trusty-updates

« back to all changes in this revision

Viewing changes to gruel/src/include/gruel/msg_passing.h

  • Committer: Package Import Robot
  • Author(s): A. Maitland Bottoms
  • Date: 2012-02-26 21:26:16 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120226212616-vsfkbi1158xshdql
Tags: 3.5.1-1
* new upstream version, re-packaged from scratch with modern tools
    closes: #642716, #645332, #394849, #616832, #590048, #642580,
    #647018, #557050, #559640, #631863
* CMake build

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- c++ -*- */
 
2
/*
 
3
 * Copyright 2009 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 along
 
18
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
20
 */
 
21
#ifndef INCLUDED_GRUEL_MSG_PASSING_H
 
22
#define INCLUDED_GRUEL_MSG_PASSING_H
 
23
 
 
24
/*!
 
25
 * \brief Include this header to use the message passing features
 
26
 */
 
27
 
 
28
#include <gruel/api.h>
 
29
#include <gruel/pmt.h>
 
30
#include <gruel/msg_accepter.h>
 
31
 
 
32
 
 
33
namespace gruel {
 
34
 
 
35
  /*!
 
36
   * \brief send message to msg_accepter
 
37
   *
 
38
   * \param accepter is the target of the send.
 
39
   * \param msg is the message to send.  It's usually a pmt tuple.
 
40
   *
 
41
   * Sending a message is an asynchronous operation.  The \p send
 
42
   * call will not wait for the message either to arrive at the
 
43
   * destination or to be received.
 
44
   *
 
45
   * \returns msg
 
46
   */
 
47
  static inline pmt::pmt_t
 
48
  send(msg_accepter_sptr accepter, const pmt::pmt_t &msg)
 
49
  {
 
50
    accepter->post(msg);
 
51
    return msg;
 
52
  }
 
53
 
 
54
  /*!
 
55
   * \brief send message to msg_accepter
 
56
   *
 
57
   * \param accepter is the target of the send.
 
58
   * \param msg is the message to send.  It's usually a pmt tuple.
 
59
   *
 
60
   * Sending a message is an asynchronous operation.  The \p send
 
61
   * call will not wait for the message either to arrive at the
 
62
   * destination or to be received.
 
63
   *
 
64
   * \returns msg
 
65
   */
 
66
  static inline pmt::pmt_t
 
67
  send(msg_accepter *accepter, const pmt::pmt_t &msg)
 
68
  {
 
69
    accepter->post(msg);
 
70
    return msg;
 
71
  }
 
72
 
 
73
  /*!
 
74
   * \brief send message to msg_accepter
 
75
   *
 
76
   * \param accepter is the target of the send.
 
77
   * \param msg is the message to send.  It's usually a pmt tuple.
 
78
   *
 
79
   * Sending a message is an asynchronous operation.  The \p send
 
80
   * call will not wait for the message either to arrive at the
 
81
   * destination or to be received.
 
82
   *
 
83
   * \returns msg
 
84
   */
 
85
  static inline pmt::pmt_t
 
86
  send(msg_accepter &accepter, const pmt::pmt_t &msg)
 
87
  {
 
88
    accepter.post(msg);
 
89
    return msg;
 
90
  }
 
91
 
 
92
  /*!
 
93
   * \brief send message to msg_accepter
 
94
   *
 
95
   * \param accepter is the target of the send.  precond: pmt_is_msg_accepter(accepter)
 
96
   * \param msg is the message to send.  It's usually a pmt tuple.
 
97
   *
 
98
   * Sending a message is an asynchronous operation.  The \p send
 
99
   * call will not wait for the message either to arrive at the
 
100
   * destination or to be received.
 
101
   *
 
102
   * \returns msg
 
103
   */
 
104
  static inline pmt::pmt_t
 
105
  send(pmt::pmt_t accepter, const pmt::pmt_t &msg)
 
106
  {
 
107
    return send(pmt_msg_accepter_ref(accepter), msg);
 
108
  }
 
109
 
 
110
} /* namespace gruel */
 
111
 
 
112
#endif /* INCLUDED_GRUEL_MSG_PASSING_H */