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

« back to all changes in this revision

Viewing changes to p2p/EventWrapper.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
#ifndef P2P_EventWrapper_hxx
 
2
#define P2P_EventWrapper_hxx
 
3
 
 
4
#include "p2p/p2p.hxx"
 
5
#include "p2p/Event.hxx"
 
6
#include "p2p/EventConsumer.hxx"
 
7
 
 
8
#include <memory>
 
9
 
 
10
namespace p2p
 
11
{
 
12
 
 
13
template <class T> 
 
14
class EventWrapper : public Event
 
15
{
 
16
   public:
 
17
      EventWrapper(T* t) : mWrapped(t)
 
18
      {}
 
19
      
 
20
      virtual void dispatch(EventConsumer& consumer) 
 
21
      {
 
22
         consumer.consume(*mWrapped);
 
23
      }
 
24
 
 
25
      virtual resip::Data brief() const 
 
26
      {
 
27
         return "Event Wrapper";
 
28
      }
 
29
      
 
30
 
 
31
   private:
 
32
      std::auto_ptr<T> mWrapped;
 
33
};
 
34
 
 
35
template <class T>
 
36
static std::auto_ptr<Event> wrap(T* t) 
 
37
{
 
38
   return std::auto_ptr<Event>(new EventWrapper<T>(t));
 
39
}
 
40
 
 
41
}
 
42
 
 
43
#endif // P2P_Event_hxx