Imported Upstream version 3.0.4
[debian/gnuradio] / gnuradio-core / src / lib / runtime / gr_message.i
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2005 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
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 class gr_message;
24 typedef boost::shared_ptr<gr_message> gr_message_sptr;
25 %template(gr_message_sptr) boost::shared_ptr<gr_message>;
26
27 %rename(message_from_string) gr_make_message_from_string;
28 gr_message_sptr
29 gr_make_message_from_string(const std::string s, long type = 0, double arg1 = 0, double arg2 = 0);
30
31 %rename(message) gr_make_message;
32 gr_message_sptr
33 gr_make_message(long type = 0, double arg1 = 0, double arg2 = 0, size_t length = 0);
34
35 /*!
36  * \brief Message.
37  *
38  * The ideas and method names for adjustable message length were
39  * lifted from the click modular router "Packet" class.
40  */
41 class gr_message {
42   gr_message (long type, double arg1, double arg2, size_t length);
43
44   unsigned char *buf_data() const  { return d_buf_start; }
45   size_t buf_len() const           { return d_buf_end - d_buf_start; }
46
47 public:
48   ~gr_message ();
49
50   long type() const   { return d_type; }
51   double arg1() const { return d_arg1; }
52   double arg2() const { return d_arg2; }
53
54   void set_type(long type)   { d_type = type; }
55   void set_arg1(double arg1) { d_arg1 = arg1; }
56   void set_arg2(double arg2) { d_arg2 = arg2; }
57
58   size_t length() const;
59   std::string to_string() const;
60
61 };
62
63 %rename(message_ncurrently_allocated) gr_message_ncurrently_allocated;
64 long gr_message_ncurrently_allocated();
65