~ubuntu-branches/ubuntu/precise/gnuradio/precise

« back to all changes in this revision

Viewing changes to mblock/src/include/mblock/port.h

  • Committer: Bazaar Package Importer
  • Author(s): Kamal Mostafa
  • Date: 2010-03-13 07:46:01 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100313074601-zjsa893a87bozyh7
Tags: 3.2.2.dfsg-1ubuntu1
* Fix build for Ubuntu lucid (LP: #260406)
  - add binary package dep for libusrp0, libusrp2-0: adduser
  - debian/rules clean: remove pre-built Qt moc files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- c++ -*- */
 
2
/*
 
3
 * Copyright 2006,2008 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_MB_PORT_H
 
22
#define INCLUDED_MB_PORT_H
 
23
 
 
24
#include <mblock/common.h>
 
25
 
 
26
/*!
 
27
 * \brief Abstract port characteristics
 
28
 */
 
29
class mb_port : boost::noncopyable
 
30
{
 
31
public:
 
32
 
 
33
  //! port classification
 
34
  enum port_type_t {
 
35
    EXTERNAL,   //< Externally visible
 
36
    RELAY,      //< Externally visible but really connected to a sub-component
 
37
    INTERNAL    //< Visible to self only
 
38
  };
 
39
 
 
40
private:
 
41
 
 
42
  std::string           d_port_name;
 
43
  pmt_t                 d_port_symbol;          // the port_name as a pmt symbol
 
44
  pmt_t                 d_protocol_class;
 
45
  bool                  d_conjugated;
 
46
  port_type_t           d_port_type;
 
47
 
 
48
protected:
 
49
  mb_mblock            *d_mblock;  // mblock we're defined in
 
50
 
 
51
  // protected constructor
 
52
  mb_port(mb_mblock *mblock,
 
53
          const std::string &port_name,
 
54
          const std::string &protocol_class_name,
 
55
          bool conjugated,
 
56
          mb_port::port_type_t port_type);
 
57
 
 
58
  mb_mblock *mblock() const { return d_mblock; }
 
59
 
 
60
public:
 
61
  std::string   port_name() const { return d_port_name; }
 
62
  pmt_t         port_symbol() const { return d_port_symbol; }
 
63
  pmt_t         protocol_class() const { return d_protocol_class; }
 
64
  bool          conjugated() const { return d_conjugated; }
 
65
  port_type_t   port_type() const { return d_port_type; }
 
66
 
 
67
  pmt_t         incoming_message_set() const;
 
68
  pmt_t         outgoing_message_set() const;
 
69
 
 
70
  virtual ~mb_port();
 
71
 
 
72
  /*!
 
73
   * \brief send a message
 
74
   *
 
75
   * \param signal      the event name
 
76
   * \param data        optional data
 
77
   * \param metadata    optional metadata
 
78
   * \param priority    the urgency at which the message is sent
 
79
   */
 
80
  virtual void
 
81
  send(pmt_t signal,
 
82
       pmt_t data = PMT_F,
 
83
       pmt_t metadata = PMT_F,
 
84
       mb_pri_t priority = MB_PRI_DEFAULT) = 0;
 
85
 
 
86
  /*
 
87
   * \brief Invalidate any cached peer resolutions
 
88
   * \internal
 
89
   */
 
90
  virtual void invalidate_cache() = 0;
 
91
};
 
92
 
 
93
#endif /* INCLUDED_MB_PORT_H */