commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3500 - gnuradio/branches/developers/eb/mb/mblock/src/


From: eb
Subject: [Commit-gnuradio] r3500 - gnuradio/branches/developers/eb/mb/mblock/src/lib
Date: Thu, 7 Sep 2006 19:50:51 -0600 (MDT)

Author: eb
Date: 2006-09-07 19:50:50 -0600 (Thu, 07 Sep 2006)
New Revision: 3500

Modified:
   gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.cc
   gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.h
   gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.cc
   gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.h
Log:
refactored mb_mblock and mb_mblock_impl

Modified: gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.cc
===================================================================
--- gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.cc      
2006-09-08 00:29:37 UTC (rev 3499)
+++ gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.cc      
2006-09-08 01:50:50 UTC (rev 3500)
@@ -26,17 +26,23 @@
 #include <mb_mblock.h>
 #include <mb_mblock_impl.h>
 #include <mb_protocol_class.h>
+#include <mb_port.h>
 
 mb_mblock::mb_mblock(mb_runtime_sptr runtime)
-  : d_impl(mb_mblock_impl_sptr(new mb_mblock_impl(this))),
+  : d_impl(new mb_mblock_impl()),
     d_runtime(runtime)
 {
-  // FIXME
+  // FIXME more?
 }
 
 mb_mblock::~mb_mblock()
 {
-  // FIXME
+  if (d_impl){
+    delete d_impl;
+    d_impl = 0;
+  }
+
+  // FIXME more?
 }
 
 bool
@@ -59,8 +65,6 @@
 }
 
 ////////////////////////////////////////////////////////////////////////
-//                  delegate to mb_mblock_impl                        //
-////////////////////////////////////////////////////////////////////////
 
 void
 mb_mblock::define_port(pmt_t port_name,
@@ -68,33 +72,53 @@
                       bool conjugated,
                       mb_port_class::port_type_t port_type)
 {
-  d_impl->define_port(port_name, protocol_class_name, conjugated, port_type);
+  if (port_type == mb_port_class::RELAY)
+    throw pmt_notimplemented(
+        "mb_block_impl::define_port: RELAY ports are not implemented",
+       port_name);
+  
+  if (d_impl->lookup_port(port_name))
+    throw pmt_exception(
+        "mb_mblock::define_port: port_name already defined",
+       port_name);
+
+  mb_port_sptr p = mb_port_sptr(new mb_port(port_name, protocol_class_name,
+                                           conjugated, port_type));
+  d_impl->d_ports.push_back(p);
 }
 
 void
 mb_mblock::define_component(const std::string &component_name,
-                           mb_mblock_sptr component)
+                                mb_mblock_sptr component)
 {
-  d_impl->define_component(component_name, component);
+  pmt_t name = pmt_intern(component_name);
+  if (d_impl->lookup_component(name))
+    throw pmt_exception(
+       "mb_mblock::define_component: component_name already defined",
+       name);
+
+  d_impl->d_components.push_back(mb_component(name, component));
 }
 
 bool
 mb_mblock::connect(const mb_endpoint &endpoint_1, const mb_endpoint 
&endpoint_2)
 {
-  return d_impl->connect(endpoint_1, endpoint_2);
+  // FIXME
+  return true;
 }
 
 bool
 mb_mblock::disconnect(const mb_endpoint &endpoint_1, const mb_endpoint 
&endpoint_2)
 {
-  return d_impl->disconnect(endpoint_1, endpoint_2);
+  // FIXME
+  return true;
 }
 
 void
 mb_mblock::send(pmt_t port_name, pmt_t signal,
                pmt_t data, pmt_t metadata, mb_pri_t priority)
 {
-  d_impl->send(port_name, signal, data, metadata, priority);
+  // FIXME
 }
 
 
@@ -103,4 +127,3 @@
 {
   return d_impl->peer_interface();
 }
-

Modified: gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.h
===================================================================
--- gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.h       
2006-09-08 00:29:37 UTC (rev 3499)
+++ gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock.h       
2006-09-08 01:50:50 UTC (rev 3500)
@@ -60,7 +60,7 @@
 class mb_mblock
 {
 private:
-  mb_mblock_impl_sptr          d_impl;         // implementation details
+  mb_mblock_impl              *d_impl;         // implementation details
   mb_runtime_sptr              d_runtime;      // associated runtime
 
   // NOT IMPLEMENTED

Modified: gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.cc
===================================================================
--- gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.cc 
2006-09-08 00:29:37 UTC (rev 3499)
+++ gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.cc 
2006-09-08 01:50:50 UTC (rev 3500)
@@ -25,8 +25,7 @@
 #include <mb_mblock_impl.h>
 #include <mb_port.h>
 
-mb_mblock_impl::mb_mblock_impl(mb_mblock *mb)
-  : d_mblock(mb)
+mb_mblock_impl::mb_mblock_impl()
 {
   // FIXME
 }
@@ -36,61 +35,6 @@
   // FIXME
 }
 
-void
-mb_mblock_impl::define_port(pmt_t port_name,
-                           const std::string &protocol_class_name,
-                           bool conjugated,
-                           mb_port_class::port_type_t port_type)
-{
-  if (port_type == mb_port_class::RELAY)
-    throw pmt_notimplemented(
-        "mb_block_impl::define_port: RELAY ports are not implemented",
-       port_name);
-  
-  if (lookup_port(port_name))
-    throw pmt_exception(
-        "mb_mblock_impl::define_port: port_name already defined",
-       port_name);
-
-  mb_port_sptr p = mb_port_sptr(new mb_port(port_name, protocol_class_name,
-                                           conjugated, port_type));
-  d_ports.push_back(p);
-}
-
-void
-mb_mblock_impl::define_component(const std::string &component_name,
-                                mb_mblock_sptr component)
-{
-  pmt_t name = pmt_intern(component_name);
-  if (lookup_component(name))
-    throw pmt_exception(
-       "mb_mblock_impl::define_component: component_name already defined",
-       name);
-
-  d_components.push_back(mb_component(name, component));
-}
-
-bool
-mb_mblock_impl::connect(const mb_endpoint &endpoint_1, const mb_endpoint 
&endpoint_2)
-{
-  // FIXME
-  return true;
-}
-
-bool
-mb_mblock_impl::disconnect(const mb_endpoint &endpoint_1, const mb_endpoint 
&endpoint_2)
-{
-  // FIXME
-  return true;
-}
-
-void
-mb_mblock_impl::send(pmt_t port_name, pmt_t signal,
-                    pmt_t data, pmt_t metadata, mb_pri_t priority)
-{
-  // FIXME
-}
-
 mb_port_sptr
 mb_mblock_impl::lookup_port(pmt_t port_name)
 {

Modified: gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.h
===================================================================
--- gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.h  
2006-09-08 00:29:37 UTC (rev 3499)
+++ gnuradio/branches/developers/eb/mb/mblock/src/lib/mb_mblock_impl.h  
2006-09-08 01:50:50 UTC (rev 3500)
@@ -23,6 +23,20 @@
 
 #include <mb_mblock.h>
 
+class mb_component
+{
+  pmt_t                        d_name;
+  mb_mblock_sptr       d_component;
+
+public:
+  mb_component(pmt_t name, mb_mblock_sptr component)
+    : d_name(name), d_component(component) {}
+  
+  pmt_t name() const { return d_name; }
+  mb_mblock_sptr component() const { return d_component; }
+};
+
+
 /*!
  * \brief The private implementation details of the mblock system.
  */
@@ -30,20 +44,6 @@
 {
 private:
 
-  class mb_component
-  {
-    pmt_t              d_name;
-    mb_mblock_sptr     d_component;
-
-  public:
-    mb_component(pmt_t name, mb_mblock_sptr component)
-      : d_name(name), d_component(component) {}
-
-    pmt_t name() const { return d_name; }
-    mb_mblock_sptr component() const { return d_component; }
-  };
-
-  mb_mblock                   *d_mblock;       // mblock to which we belong
   std::vector<mb_port_sptr>    d_ports;        // our ports
   std::vector<mb_component>    d_components;   // our components
 
@@ -52,85 +52,10 @@
   mb_mblock_impl(const mb_mblock_impl &rhs);            // no copy constructor
   mb_mblock_impl &operator=(const mb_mblock_impl &rhs);  // no assignment 
operator
 
-  mb_mblock_impl(mb_mblock *mb);
+  mb_mblock_impl();
 
   friend class mb_mblock;
 
-  /*!
-   * \brief Define a port.
-   *
-   * EXTERNAL and RELAY ports are part of our peer interface.
-   * INTERNAL ports are used to talk to sub-components.
-   *
-   * \param port_name The name [symbol] of the port (must be unique within 
this mblock).
-   * \param protocol_class_name        The name of the protocol class 
associated with
-   *                           this port.  It must already be defined.
-   * \param conjugated   Are the incoming and outgoing message sets swapped?
-   * \param port_type    INTERNAL, EXTERNAL or RELAY.
-   */
-  void
-  define_port(pmt_t port_name,
-             const std::string &protocol_class_name,
-             bool conjugated,
-             mb_port_class::port_type_t port_type);
-
-  /*!
-   * \brief Define a subcomponent by name.
-   *
-   * Called within the constructor to tell the system the
-   * names and identities of our sub-component mblocks.
-   *
-   * \param component_name  The name of the sub-component (must be unique with 
this mblock).
-   * \param component       The sub-component instance.
-   */
-  void
-  define_component(const std::string &component_name,
-                  mb_mblock_sptr component);
-
-  /*!
-   * \brief connect endpoint_1 to endpoint_2
-   * \param endpoint_1  one end of the connection
-   * \param endpoint_2  the other end of the connection
-   *
-   * An endpoint is specified by the component's local name (given as
-   * component_name in the call to register_component) and the name of
-   * the port on that component.
-   *
-   * To connect an internal or relay port, use "self" as the component name.
-   */
-  bool
-  connect(const mb_endpoint &endpoint_1, const mb_endpoint &endpoint_2);
-
-  /*!
-   * \brief disconnect endpoint_1 from endpoint_2
-   * \param endpoint_1  one end of the connection
-   * \param endpoint_2  the other end of the connection
-   *
-   * An endpoint is specified by the component's local name (given as
-   * component_name in the call to register_component) and the name of
-   * the port on that component.
-   *
-   * To disconnect an internal or relay port, use "self" as the component name.
-   */
-  bool
-  disconnect(const mb_endpoint &endpoint_1, const mb_endpoint &endpoint_2);
-
-  /*!
-   * \brief send a message
-   *
-   * \param port_name  name of the port via which we send the message
-   * \param signal     the event name
-   * \param data       optional data
-   * \param metadata   optional metadata
-   * \param priority   the urgency at which the message is sent
-   */
-  void
-  send(pmt_t port_name,
-       pmt_t signal,
-       pmt_t data = PMT_NIL,
-       pmt_t metadata = PMT_NIL,
-       mb_pri_t priority = MB_PRI_DEFAULT);
-   
   ////////////////////////////////////////////////////////////////////////
 
   mb_port_sptr
@@ -139,13 +64,11 @@
   mb_mblock_sptr
   lookup_component(pmt_t component_name);
 
+  const std::vector<mb_port_class_sptr>
+  peer_interface() const;
+
 public:
   ~mb_mblock_impl();
-
-  /*!
-   * \brief Return a vector that describes this mblock's peer-interface
-   */
-  const std::vector<mb_port_class_sptr> peer_interface() const;
 };
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]