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 $
=========================================================================*/
/* ---------------------------------------------------------------------
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
{
/// 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