CLAM-Development  1.4.0
OutControlBase.hxx
Go to the documentation of this file.
1 #ifndef BaseOutControl_hxx
2 #define BaseOutControl_hxx
3 
4 #include <string>
5 #include <list>
6 #include <typeinfo>
7 #include <CLAM/Assert.hxx>
8 #include <CLAM/InControlBase.hxx>
9 
10 
11 namespace CLAM {
12  class Processing;
13  class InControlBase;
21  {
22  std::string mName;
23  Processing * mProcessing;
24  protected:
25  typedef std::list<InControlBase*> Peers;
29  OutControlBase(const OutControlBase & toBeCopied ) {}
30  public:
36  OutControlBase(const std::string &name, Processing * proc = 0);
42  virtual ~OutControlBase();
44  const std::string& GetName() const { return mName; }
46  Processing * GetProcessing() const { return mProcessing; }
48  bool IsConnected() { return not mLinks.empty(); }
51  {
52  Peers::iterator it;
53  for (it=mLinks.begin(); it!=mLinks.end(); it++)
54  if ((*it) == &in) return true;
55  return false;
56  }
57  virtual const std::type_info& GetTypeId() const = 0;
64  virtual bool IsLinkable(const InControlBase& in) = 0;
70  {
72  "Connecting controls which are not linkable (different types?). "
73  "You can use IsLinkable before connecting to ensure that they are compatible.");
74  mLinks.push_back(&in);
76  }
82  {
84  "Removing a control connection that doesn't exist."
85  "You can check that with IsConnectedTo to ensure that this condition is meet.");
86  mLinks.remove( &in );
88  }
89  Peers::iterator BeginInControlsConnected();
90  Peers::iterator EndInControlsConnected();
91  };
92 } // END NAMESPACE CLAM
93 #endif // BaseOutControl_hxx