port.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2006,2008 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License along
00018  * with this program; if not, write to the Free Software Foundation, Inc.,
00019  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00020  */
00021 #ifndef INCLUDED_MB_PORT_H
00022 #define INCLUDED_MB_PORT_H
00023 
00024 #include <mblock/common.h>
00025 
00026 /*!
00027  * \brief Abstract port characteristics
00028  */
00029 class mb_port : boost::noncopyable
00030 {
00031 public:
00032 
00033   //! port classification
00034   enum port_type_t {
00035     EXTERNAL,   //< Externally visible
00036     RELAY,      //< Externally visible but really connected to a sub-component
00037     INTERNAL    //< Visible to self only
00038   };
00039 
00040 private:
00041 
00042   std::string           d_port_name;
00043   pmt_t                 d_port_symbol;          // the port_name as a pmt symbol
00044   pmt_t                 d_protocol_class;
00045   bool                  d_conjugated;
00046   port_type_t           d_port_type;
00047 
00048 protected:
00049   mb_mblock            *d_mblock;  // mblock we're defined in
00050 
00051   // protected constructor
00052   mb_port(mb_mblock *mblock,
00053           const std::string &port_name,
00054           const std::string &protocol_class_name,
00055           bool conjugated,
00056           mb_port::port_type_t port_type);
00057 
00058   mb_mblock *mblock() const { return d_mblock; }
00059 
00060 public:
00061   std::string   port_name() const { return d_port_name; }
00062   pmt_t         port_symbol() const { return d_port_symbol; }
00063   pmt_t         protocol_class() const { return d_protocol_class; }
00064   bool          conjugated() const { return d_conjugated; }
00065   port_type_t   port_type() const { return d_port_type; }
00066 
00067   pmt_t         incoming_message_set() const;
00068   pmt_t         outgoing_message_set() const;
00069 
00070   virtual ~mb_port();
00071 
00072   /*!
00073    * \brief send a message
00074    *
00075    * \param signal      the event name
00076    * \param data        optional data
00077    * \param metadata    optional metadata
00078    * \param priority    the urgency at which the message is sent
00079    */
00080   virtual void
00081   send(pmt_t signal,
00082        pmt_t data = PMT_F,
00083        pmt_t metadata = PMT_F,
00084        mb_pri_t priority = MB_PRI_DEFAULT) = 0;
00085 
00086   /*
00087    * \brief Invalidate any cached peer resolutions
00088    * \internal
00089    */
00090   virtual void invalidate_cache() = 0;
00091 };
00092 
00093 #endif /* INCLUDED_MB_PORT_H */

Generated on Wed Jul 29 06:24:26 2009 for GNU Radio 3.2.2 C++ API by  doxygen 1.5.9