]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkBlackBox.h
index d5f06710ffda4b87718702077d48b425c4f0edd2..48509a1930ac2e48a768f432e2e85f888611f36d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/04/21 12:43:05 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2008/04/22 14:30:25 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See doc/license.txt or
@@ -43,6 +43,7 @@ namespace bbtk
   struct Void { Void(int = 0) {} };
   
   class Factory;
+  class Connection;
 
   class BBTK_EXPORT BlackBox : public Object
   {
@@ -66,7 +67,6 @@ namespace bbtk
     virtual BlackBox::Pointer bbClone(const std::string& name) = 0;
 
     /// User overloadable destruction method of a black box
-    /// UNUSED FOR THE MOMENT
     virtual void bbUserDelete();
 
     /// Returns the Name of the Type of the BlackBox
@@ -83,8 +83,6 @@ namespace bbtk
     /// Returns the name with the name of the parent prepended if any
     virtual std::string bbGetNameWithParent() const;
     
-    /// Sets the parent of the BlackBox
-    void bbSetParent(BlackBox::Pointer p) { bbmParent = p; }
     /// Returns the parent of the BlackBox, i.e the BlackBox that contains it (0 if none)
     BlackBox::Pointer bbGetParent() const { return bbmParent.lock(); }
 
@@ -146,18 +144,6 @@ bool reaction = true);
     ///  Sets the data of the output called <name>
     virtual void bbSetOutput( const std::string &name, Data data) = 0;
 
-    /// Connects the input <name> to the connection c
-    virtual void bbConnectInput( const std::string& name, 
-                                Connection::Pointer c);
-    /// Connects the output <name> to the connection c
-    virtual void bbConnectOutput( const std::string& name, 
-                                 Connection::Pointer c);
-    /// Disconnects the input <name> from the connection c
-    virtual void bbDisconnectInput( const std::string& name, 
-                                   Connection::Pointer c);
-    /// Disconnects the output <name> from the connection c
-    virtual void bbDisconnectOutput( const std::string& name, 
-                                    Connection::Pointer c);
 
     ///  Returns the input connectors map
     InputConnectorMapType&  bbGetInputConnectorMap() 
@@ -267,6 +253,27 @@ bool reaction = true);
     void bbSetStatus( IOStatus t) { bbmStatus = t; } 
     //==================================================================
     
+  private:
+    friend class Connection;
+    friend class ComplexBlackBox;
+
+    /// Sets the parent of the BlackBox
+    void bbSetParent(BlackBox::Pointer p) { bbmParent = p; }
+    
+
+    /// Connects the input <name> to the connection c
+    virtual void bbConnectInput( const std::string& name, 
+                                Connection* c);
+    /// Connects the output <name> to the connection c
+    virtual void bbConnectOutput( const std::string& name, 
+                                 Connection* c);
+    /// Disconnects the input <name> from the connection c
+    virtual void bbDisconnectInput( const std::string& name, 
+                                   Connection* c);
+    /// Disconnects the output <name> from the connection c
+    virtual void bbDisconnectOutput( const std::string& name, 
+                                    Connection* c);
+
 
  
     /// @name Pipeline processing methods
@@ -291,7 +298,7 @@ bool reaction = true);
     /// - calls bbProcess which is the user callback which does the actual processing
     /// - calls bbUpdateChildren
     /// - calls bbShowWidget which shows the widget associated to the box (if any)
-  public:
+  protected:
     virtual IOStatus bbBackwardUpdate(Connection::Pointer caller) = 0;
     //==================================================================
 
@@ -348,7 +355,7 @@ bool reaction = true);
     /// which means execute in response to an input change 
     virtual bool bbCanReact() const;
     
-    
+  protected:  
     static void bbGlobalAddToExecutionList( BlackBox::Pointer b );
     static void bbGlobalProcessExecutionList();