OdinAI

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List

All Classes Namespaces Functions Variables
Event.h
1 /*******************************************************************************
2 * ________ .___.__ _____ .___
3 * \_____ \ __| _/|__| ____ / _ \ | |
4 * / | \ / __ | | |/ \ / /_\ \| |
5 * / | \/ /_/ | | | | \/ | \ |
6 * \_______ /\____ | |__|___| /\____|__ /___|
7 * \/ \/ \/ \/
8 *
9 * Copyright (c) Emil Sandstø 2012
10 *******************************************************************************/
11 #ifndef ODINAI_EVENT_H_
12 #define ODINAI_EVENT_H_
13
14 #include <string>
15 #include <memory>
16
17 #define DECLARE_EVENT(EventClass) \
18 static std::shared_ptr<EventClass> Create() \
19 { \
20 std::shared_ptr<EventClass> pInstance(new EventClass, [=](EventClass *pEvent) { \
21 pEvent->Release(); \
22 delete pEvent;} \
23 ); \
24 return pInstance; \
25 } \
26
27 namespace OdinAI
28 {
29
33 class Event
34 {
35 public:
36 DECLARE_EVENT(Event);
37
38 virtual ~Event() {}
39
43 virtual void Release() {}
44
48 virtual const char *GetName() const
49 {
50 return "default";
51 }
52 };
53
54 }
55
56 #endif
OdinAI::Event
Definition: Event.h:33
OdinAI::Event::Release
virtual void Release()
Definition: Event.h:43
OdinAI::Event::GetName
virtual const char * GetName() const
Definition: Event.h:48