+ friend class Connection;
+ friend class ComplexBlackBox;
+
+ /// Sets the parent of the BlackBox
+ void bbSetParent(BlackBox::Pointer p) { bbmParent = p; }
+
+ //==================================================================
+ /// @name Input/output connection/disconnection
+ /// INTERNAL METHODS used by a Connection to connect/disconnect
+ /// itself to the i/o connectors of the box
+ //@{
+
+ /// 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);
+ //@}
+ //==================================================================
+
+ /// Returns true if the box can "react",
+ /// which means execute in response to an input change
+ virtual bool bbCanReact() const;
+
+ /// Returns true iff the box is executing
+ bool bbGetExecuting() const { return bbmExecuting; }
+ /// Sets the bbmExecuting bool returned by bbGetExecuting
+ void bbSetExecuting(bool b) { bbmExecuting = b; }
+
+ protected:
+
+ //==================================================================
+ protected:
+
+
+ //==================================================================
+ /// Black box objects have a special deleter
+ /// which must take care of releasing the descriptor
+ /// **AFTER** the box is deleted
+ /// (Releasing it in the destructor may cause dl close and crash)
+ /// Black box deleter
+ /// 1) Calls the user overloadable bbDelete method
+ /// 2) Releases the box descriptor
+ struct BBTK_EXPORT Deleter : public Object::Deleter
+ {
+ Deleter();
+ int Delete(Object* p);
+ };
+ //==================================================================
+
+ //==================================================================
+ /// Like Object::MakePointer but returns a boost::shared_pointer which uses a BlackBox::Deleter to delete the object instead of the default Object::Deleter
+ template <class U>
+ static boost::shared_ptr<U> MakeBlackBoxPointer(U* s, bool lock = false)
+ {
+ return MakePointer(s,BlackBox::Deleter(),lock);
+ }
+ //==================================================================
+
+ //==================================================================
+ /// Effective deletion method called by the Deleter.
+ /// The default implementation is to issue 'delete this'
+ /// but it can be redefined in inherited classes to handle special deletion mechanisms (e.g. ref counting, private destructors, such as vtk objects deletion with method Delete, etc.).
+ /// \return The number of remaining references on the object after the call (if meaningfull...): used by bbtk to warn a user if another smart pointing system is still holding the object...
+
+//JCP 21-09-20 09 delete this throws and exception change due to compiler version changing and boost version
+ virtual int bbDelete() { delete this;
+ return 0; }
+ //==================================================================
+
+
+ //==================================================================
+ private:
+ //==================================================================
+
+ //==================================================================
+ // ATTRIBUTES
+ /// Is the box initialized ?
+ bool bbmInitialized;
+ /// Is the box executing ?
+ bool bbmExecuting;