Nymph  v1.5.2
Flow-Based Data Processing Framework
KTSignalWrapper.hh
Go to the documentation of this file.
1 /*
2  * KTSignalWrapper.hh
3  *
4  * Created on: Aug 8, 2012
5  * Author: nsoblath
6  */
7 
8 #ifndef KTSIGNALWRAPPER_HH_
9 #define KTSIGNALWRAPPER_HH_
10 
11 #include <boost/signals2.hpp>
12 #include <boost/utility.hpp>
13 
14 #include <iostream>
15 
16 namespace Nymph
17 {
18  template< typename Signature >
20  {
21  typedef Signature signature;
22  typedef boost::signals2::signal< Signature > signal;
23  typedef typename boost::signals2::signal< Signature >::slot_type slot_type;
24  };
25 
26  class SignalException : public std::logic_error
27  {
28  public:
29  SignalException(std::string const& why);
30  };
31 
32  class KTSignalWrapper : public boost::noncopyable
33  {
34  public:
35  friend class KTSlotWrapper;
36 
37  private:
39  {
40  public:
43  };
44 
45  template< typename XSignature >
46  class KTSpecifiedInternalSignalWrapper : public KTInternalSignalWrapper, public boost::noncopyable
47  {
48  public:
49  KTSpecifiedInternalSignalWrapper(XSignature* signalPtr) : fSignal(signalPtr)
50  {}
52 
53  XSignature* GetSignal() const
54  {
55  return fSignal;
56  }
57  private:
58  XSignature* fSignal; //not owned by this KTSignalWrapper
59  };
60 
61  public:
62  template< typename XSignature >
63  KTSignalWrapper(XSignature* signalPtr);
64  ~KTSignalWrapper();
65 
66  private:
68 
69  KTInternalSignalWrapper* GetInternal() const;
70 
72 
73  };
74 
75  template< typename XSignature >
76  KTSignalWrapper::KTSignalWrapper(XSignature* signalPtr) :
77  fSignalWrapper(NULL)
78  {
80  }
81 
83  {
84  return fSignalWrapper;
85  }
86 
87 } /* namespace Nymph */
88 #endif /* KTSIGNALWRAPPER_HH_ */
boost::signals2::signal< Signature > signal
boost::signals2::signal< Signature >::slot_type slot_type
KTInternalSignalWrapper * GetInternal() const
KTInternalSignalWrapper * fSignalWrapper