X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkBlackBox.h;h=17ed4c199ab11ff1b33b0c9fdd9ee8b2d7475fa1;hb=4234999264604da013c2574feef3816c75b3034e;hp=04843d24cb5224655b7a433c0cdb9363228f9e3d;hpb=4ad5b5ee44357ad873bc8c43230defb6d0a79879;p=bbtk.git diff --git a/kernel/src/bbtkBlackBox.h b/kernel/src/bbtkBlackBox.h index 04843d2..17ed4c1 100644 --- a/kernel/src/bbtkBlackBox.h +++ b/kernel/src/bbtkBlackBox.h @@ -1,21 +1,34 @@ -/*========================================================================= - +/*========================================================================= Program: bbtk Module: $RCSfile: bbtkBlackBox.h,v $ Language: C++ - Date: $Date: 2008/04/18 12:59:15 $ - Version: $Revision: 1.6 $ - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See doc/license.txt or - http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - + Date: $Date: 2008/10/17 08:18:12 $ + Version: $Revision: 1.13 $ =========================================================================*/ +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* or in the file LICENSE.txt. +* +* As a counterpart to the access to the source code and rights to copy, +* modify and redistribute granted by the license, users are provided only +* with a limited warranty and the software's author, the holder of the +* economic rights, and the successive licensors have only limited +* liability. +* +* The fact that you are presently reading this means that you have had +* knowledge of the CeCILL-B license and that you accept its terms. +* ------------------------------------------------------------------------ */ + + /** * \file @@ -43,6 +56,7 @@ namespace bbtk struct Void { Void(int = 0) {} }; class Factory; + class Connection; class BBTK_EXPORT BlackBox : public Object { @@ -66,7 +80,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 +96,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 +157,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() @@ -251,6 +250,10 @@ bool reaction = true); virtual void Check(bool recursive = true); + virtual void bbUserOnShow() { } + void bbUserOnShowWidget(std::string nameInput); + + protected: //================================================================== // PROTECTED PART : ACCESSIBLE TO THE BlackBox DEVELOPER @@ -267,6 +270,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 +315,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; //================================================================== @@ -331,8 +355,9 @@ bool reaction = true); /// (called after bbProcess during bbExecute) /// Does nothing here but overloaded in WxBlackBox and WxContainerBlackBox virtual void bbShowWindow(Connection::Pointer caller) { } - + virtual void bbHideWindow() {} + virtual void bbCloseWindow() { } //================================================================== //@} @@ -348,7 +373,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 +388,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 +395,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); @@ -398,7 +420,7 @@ bool reaction = true); /// The name of the package to which it belongs std::string bbmPackageName; - /// 0 : "Pipeline" mode : bbUpdate() only calls Process if Status == MODIFIED (normal pipeline processing) + /// 0 : "Pipeline" mode : bbBackwardUpdate() only calls Process if Status == MODIFIED (normal pipeline processing) /// 1 : "Always" mode : bbUpdate() always calls Process /// 2 : "Reactive" mode : bbSetModifiedStatus() calls bbUpdate() std::string bbmBoxProcessMode; @@ -407,10 +429,6 @@ bool reaction = true); BlackBox::WeakPointer bbmParent; //================================================================== - //================================================================== - // Am I executing (to test pipeline cycles) ? - bool bbmExecuting; - //================================================================== //================================================================== // ATTRIBUTES