AnnUserSpaceSubSystem.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "systemMacro.h"
4 #include <AnnSubsystem.hpp>
5 #include <AnnUserSpaceEvent.hpp>
6 
7 #include <string>
8 #include <iostream>
9 #include <memory>
10 
11 #define AnnUserSystemAs(type) std::dynamic_pointer_cast<type>
12 
13 //Build configuraiton to export symbols insiside
14 #ifdef _WIN32
15 #define AnnUserSubSystemPluginExport __declspec(dllexport)
16 #else
17 #define AnnUserSubSystemPluginExport //This is dealt with in the compiler call, not in the source code
18 #endif
19 
20 //Macro definiton for the plugin "bootstrap" symbol declaration and implementation.
21 //AnnEngine expect to find a C function called "AnnBootPlugin_PLUGIN_NAME" inside the DLL
22 #define AnnUserSubSystemPluginBootReturnType Annwvyn::AnnUserSubSystem*
23 #define AnnUserSubSystemPluginCatNameImpl(a, b) a##b
24 #define AnnUserSubSystemPluginCatName(a, b) AnnUserSubSystemPluginCatNameImpl(a, b)
25 #define AnnBootPluginPrefix AnnBootPlugin_
26 #define AnnUserSubSystemPluginBootName(AnnUserSubSystemPluginClassName) AnnUserSubSystemPluginCatName(AnnBootPluginPrefix, AnnUserSubSystemPluginClassName)
27 #define AnnUserSubSystemPluginBootImpl(AnnUserSubSystemPluginClassName) AnnUserSubSystemPluginBootReturnType AnnUserSubSystemPluginBootName(AnnUserSubSystemPluginClassName)()
28 #define AnnUserSubSystemPluginBootDeclare(AnnUserSubSystemPluginClassName) extern "C" AnnUserSubSystemPluginExport AnnUserSubSystemPluginBootImpl(AnnUserSubSystemPluginClassName)
29 
30 namespace Annwvyn
31 {
32  class AnnEngine;
35  {
36  public:
39  AnnUserSubSystem(const std::string& systemName);
40 
41  protected:
42  friend class AnnEngine;
43 
45  void update() override;
46 
48  bool needUpdate() override;
49 
51  void dispatchEvent(AnnUserSpaceEventPtr e) override;
52 
54  template <class UserSpaceEventType, class... Args>
55  void dispatchEvent(Args&&... args)
56  {
57  dispatchEvent(std::make_shared<UserSpaceEventType>(args...));
58  }
59  };
60 
62 }
file for defining macros used for symbol export regarding the way the OS does things.
Class that can send a user space event to the event manager.
Main engine class. Creating an instance of this class make the engine start.
Definition: AnnEngine.hpp:70
Namespace containing the totality of Annwvyn components.
Definition: AnnGetter.cpp:8
Parent class of all Annwvyn SubSystem.
void dispatchEvent(Args &&... args)
Consruct+distpatch user defined event.
#define AnnDllExport
Definition: systemMacro.h:24
User defined subsystem base class.