~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to tfm/BindPointerAction.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined BindPointerAction_hxx
 
2
#define BindPointerAction_hxx
 
3
 
 
4
#include "rutil/Data.hxx"
 
5
#include <boost/function.hpp>
 
6
#include "tfm/ActionBase.hxx"
 
7
#include <XsLib/h/CXsRefPtr.h>
 
8
 
 
9
class TestEndPoint;
 
10
 
 
11
template<class T, class E>
 
12
class BindPointerAction : public ActionBase
 
13
{
 
14
   public:
 
15
      explicit BindPointerAction(TestEndPoint* tua, resip::Data action, T& ptr) : 
 
16
         mTestEndPoint(tua),
 
17
         mActionName(action),
 
18
         mPtr(ptr)
 
19
         {}
 
20
      virtual ~BindPointerAction() {}
 
21
 
 
22
      virtual void operator()(boost::shared_ptr<Event> event)
 
23
      {
 
24
         boost::shared_ptr<E> e
 
25
            = boost::dynamic_pointer_cast<E, Event>(event);
 
26
 
 
27
         assert(e.get());
 
28
 
 
29
         mPtr->bind(e);
 
30
      }
 
31
 
 
32
      virtual void operator()() { assert(0); }
 
33
 
 
34
      virtual resip::Data toString() const { return mActionName; }
 
35
 
 
36
   protected:
 
37
      TestEndPoint* mTestEndPoint;
 
38
      resip:: Data mActionName;
 
39
      T& mPtr;
 
40
};
 
41
#endif