48 EventHandler(
const std::string& server,
unsigned port);
50 bool Start() {
return m_imp->Start(); }
51 void Stop() { m_imp->Stop(); }
52 void Reset() { m_imp->Reset(); }
53 std::string GetServer()
const {
return m_imp->GetServer(); }
54 unsigned GetPort()
const {
return m_imp->GetPort(); }
55 bool IsRunning() {
return m_imp->HasStarted(); }
56 bool IsConnected() {
return m_imp->IsConnected(); }
58 unsigned CreateSubscription(
EventSubscriber *sub) {
return m_imp->CreateSubscription(sub); }
59 bool SubscribeForEvent(
unsigned subid, EVENT_t event) {
return m_imp->SubscribeForEvent(subid, event);}
60 void RevokeSubscription(
unsigned subid) { m_imp->RevokeSubscription(subid); }
61 void RevokeAllSubscriptions(
EventSubscriber *sub) { m_imp->RevokeAllSubscriptions(sub); }
63 class EventHandlerThread
65 friend class EventHandler;
67 EventHandlerThread(
const std::string& server,
unsigned port);
68 virtual ~EventHandlerThread();
69 virtual std::string GetServer()
const {
return m_server; }
70 virtual unsigned GetPort()
const {
return m_port; }
71 virtual bool Start() = 0;
72 virtual void Stop() = 0;
73 virtual void Reset() = 0;
74 virtual bool HasStarted() = 0;
75 virtual bool IsConnected() = 0;
77 virtual bool SubscribeForEvent(
unsigned subid, EVENT_t event) = 0;
78 virtual void RevokeSubscription(
unsigned subid) = 0;
86 typedef MYTH_SHARED_PTR<EventHandlerThread> EventHandlerThreadPtr;
89 EventHandlerThreadPtr m_imp;