771a63e09411c60d8cf2369110d1b20c993d0ba2
[debian/gnuradio] / mblock / src / lib / mb_protocol_class.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006 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 2, 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_MB_PROTOCOL_CLASS_H
22 #define INCLUDED_MB_PROTOCOL_CLASS_H
23
24 #include <mb_common.h>
25
26 // FIXME maybe this should just be a pmt_t aggregate???
27
28 class mb_protocol_class;
29 typedef boost::shared_ptr<mb_protocol_class> mb_protocol_class_sptr;
30
31 /*!
32  * \brief construct a protocol_class and return boost::shared_ptr
33  *
34  * \param name          the name of the class (symbol)
35  * \param incoming      incoming message set (dict: keys are message types)
36  * \param outgoing      outgoing message set (dict: keys are message types)
37  */
38 mb_protocol_class_sptr 
39 mb_make_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing);
40
41 class mb_protocol_class {
42   pmt_t         d_name;
43   pmt_t         d_incoming;
44   pmt_t         d_outgoing;
45
46   friend mb_protocol_class_sptr
47   mb_make_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing);
48
49   // private constructor
50   mb_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing);
51
52 public:
53   ~mb_protocol_class();
54
55   pmt_t name() const { return d_name; }
56   pmt_t incoming() const { return d_incoming; }
57   pmt_t outgoing() const { return d_outgoing; }
58
59   mb_protocol_class_sptr conj() const;  // return the conjugate of this protocol class
60 };
61
62 #endif /* INCLUDED_MB_PROTOCOL_CLASS_H */