X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.h;h=eb6f46c60e8e030f9ee6e9daf1578fbbda2df6f7;hb=d8041d1ef54a73acc2306557435f6b04edf60daf;hp=04843d24cb5224655b7a433c0cdb9363228f9e3d;hpb=4ad5b5ee44357ad873bc8c43230defb6d0a79879;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.h b/kernel/src/bbtkBlackBox.h index 04843d2..eb6f46c 100644 --- a/kernel/src/bbtkBlackBox.h +++ b/kernel/src/bbtkBlackBox.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBox.h,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.6 $ + Date: $Date: 2008/05/06 13:45:12 $ + Version: $Revision: 1.9 $ 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 virtual void bbSetOutput( const std::string &name, Data data) = 0; - /// Connects the input to the connection c - virtual void bbConnectInput( const std::string& name, - Connection::Pointer c); - /// Connects the output to the connection c - virtual void bbConnectOutput( const std::string& name, - Connection::Pointer c); - /// Disconnects the input from the connection c - virtual void bbDisconnectInput( const std::string& name, - Connection::Pointer c); - /// Disconnects the output 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 to the connection c + virtual void bbConnectInput( const std::string& name, + Connection* c); + /// Connects the output to the connection c + virtual void bbConnectOutput( const std::string& name, + Connection* c); + /// Disconnects the input from the connection c + virtual void bbDisconnectInput( const std::string& name, + Connection* c); + /// Disconnects the output 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(); @@ -363,9 +370,6 @@ bool reaction = true); virtual void bbCopyIOValues(BlackBox& from); //================================================================== - bool bbGetExecuting() const { return bbmExecuting; } - void bbSetExecuting(bool b) { bbmExecuting = b; } - // Black box objects have a special deleter // which must take care of releasing the descriptor // **AFTER** the box is deleted @@ -373,7 +377,7 @@ bool reaction = true); /// Black box deleter /// 1) Calls the user overloadable bbDelete method /// 2) Releases the box descriptor - struct Deleter : public Object::Deleter + struct BBTK_EXPORT Deleter : public Object::Deleter { Deleter(); void Delete(Object* p); @@ -407,10 +411,6 @@ bool reaction = true); BlackBox::WeakPointer bbmParent; //================================================================== - //================================================================== - // Am I executing (to test pipeline cycles) ? - bool bbmExecuting; - //================================================================== //================================================================== // ATTRIBUTES