Nebula
Loading...
Searching...
No Matches
handler.h
Go to the documentation of this file.
1#pragma once
2//-----------------------------------------------------------------------------
13#include "core/refcounted.h"
14#include "messaging/message.h"
15
16//-----------------------------------------------------------------------------
17namespace Messaging
18{
20{
22public:
24 Handler();
26 virtual ~Handler();
28 virtual void Open();
30 virtual void Close();
32 bool IsOpen() const;
34 virtual bool HandleMessage(const Ptr<Message>& msg);
36 virtual void DoWork();
37protected:
38 bool isOpen;
39};
40
41//-----------------------------------------------------------------------------
44inline bool
46{
47 return this->isOpen;
48}
49
50} // namespace Messaging
51//-----------------------------------------------------------------------------
52
53
The common base class of Nebula.
Definition refcounted.h:38
Message handlers are used to process a message.
Definition handler.h:20
__DeclareClass(Handler)
virtual void Close()
called once before shutdown
Definition handler.cc:48
virtual void DoWork()
optional "per-frame" DoWork method for continuous handlers
Definition handler.cc:74
virtual ~Handler()
destructor
Definition handler.cc:25
virtual bool HandleMessage(const Ptr< Message > &msg)
handle a message, return true if handled
Definition handler.cc:60
Handler()
constructor
Definition handler.cc:16
bool isOpen
Definition handler.h:38
virtual void Open()
called once on startup
Definition handler.cc:36
bool IsOpen() const
return true if open
Definition handler.h:45
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition asyncport.cc:10