Leviathan  0.8.0.0
Leviathan game engine
IDFactory.h
Go to the documentation of this file.
1 #pragma once
2 // ------------------------------------ //
3 #include "Include.h"
4 #include <atomic>
5 #include <limits.h>
6 #include "../Logger.h"
7 #include "../Common/ThreadSafe.h"
8 
9 namespace Leviathan{
10 
11  class IDFactory : public ThreadSafe{
12  public:
15 
16 
17  static inline int GetID(){
18 
19  return Instance->ProduceID();
20  }
21 
22  static inline int GetSystemID(){
23 
24  return Instance->ProduceSystemID();
25  }
26 
27  DLLEXPORT int ProduceID();
28 
30 
31  DLLEXPORT static IDFactory* Get();
32 
33  private:
34 
35  std::atomic_int SystemID;
36  std::atomic_int GlobalID;
37 
38  DLLEXPORT static IDFactory* Instance;
39  };
40 
41 }
42 
static DLLEXPORT IDFactory * Get()
Definition: IDFactory.cpp:14
Allows the inherited object to be locked.
Definition: ThreadSafe.h:137
static int GetID()
Definition: IDFactory.h:17
DLLEXPORT int ProduceID()
Definition: IDFactory.cpp:19
DLLEXPORT int ProduceSystemID()
Definition: IDFactory.cpp:31
DLLEXPORT ~IDFactory()
Definition: IDFactory.cpp:8
#define DLLEXPORT
Definition: Include.h:84
static int GetSystemID()
Definition: IDFactory.h:22
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12
DLLEXPORT IDFactory()
Definition: IDFactory.cpp:5