]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkBlackBox.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkBlackBox.h
index 93c51ef9d6f19a3f3ba9135774edacd007747174..53e286dfb4dce69f924e733c48e37e019cfc208c 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkBlackBox.h,v $
   Language:  C++
-  Date:      $Date: 2008/12/09 13:45:13 $
-  Version:   $Revision: 1.19 $
+  Date:      $Date: 2008/12/10 09:33:18 $
+  Version:   $Revision: 1.20 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -62,6 +62,10 @@ namespace bbtk
   class Factory;
   class Connection;
   class BlackBoxOutputConnector;
+
+#define BBTK_MAKE_OUTPUT_OBSERVER(OBJECT,METHOD) \
+    boost::bind( METHOD, OBJECT, _1, _2, _3)
 
   class BBTK_EXPORT BlackBox : public Object
   {
@@ -121,17 +125,20 @@ namespace bbtk
     /// Adds the function f to the list of functions to call when 
     /// the output changes.
     /// f is of type ChangeCallbackType which is basically:
-    /// void (*ChangeCallbackType)(BlackBoxOutputConnector*)
+    /// void (*ChangeCallbackType)(bbtk::BlackBox::Pointer, 
+    ///                            const std::string&,
+    ///                            bbtk::IOStatus)
     /// To pass a member function 'f' of an instance 'c' of a class 'C' 
     /// as callback you have to 'bind' it, i.e. call:
-    /// AddChangeObserver ( "Out", boost::bind( &C::f , c, _1 ) );
-    void AddChangeObserver(const std::string& output_name, 
-                          OutputChangeCallbackType f); 
+    /// bbAddOutputObserver ( "Out", boost::bind( &C::f , c, _1, _2, _3 ) );
+    /// The convenience macro BBTK_BIND_OUTPUT_OBSERVER ( c, C::f ) does it for you 
+    void bbAddOutputObserver(const std::string& output_name, 
+                            OutputChangeCallbackType f); 
 
     /// Removes the function f from the list of functions to call when 
     /// the output changes (TO WRITE)
-    void RemoveChangeObserver(const std::string& output_name, 
-                             OutputChangeCallbackType f); 
+    void bbRemoveOutputObserver(const std::string& output_name, 
+                               OutputChangeCallbackType f); 
     
 
     /// Signals that the BlackBox outputs have been modified