iFun Engine API  1.0.0-b5770
Great Technology for Great Games
types.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_TYPES_H_
10 #define INCLUDE_FUNAPI_TYPES_H_
11 
12 #include <boost/bind.hpp>
13 #include <boost/function.hpp>
14 #include <boost/make_shared.hpp>
15 #include <boost/shared_ptr.hpp>
16 #include <boost/thread.hpp>
17 #include <boost/uuid/uuid.hpp>
18 #include <boost/uuid/uuid_io.hpp>
19 #include <boost/weak_ptr.hpp>
20 #include <funapi/network/fun_message.pb.h>
21 // windows 플랫폼용 헤더들을 한꺼번에 include 한다.
22 // 일부 정의는 엔진의 정의와 충돌하기 때문에 undef.
23 #include <funapi/win_headers.h>
24 
25 #include <stdint.h>
26 #include <string>
27 #include <vector>
28 
29 #if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L || \
30  (defined(_MSC_VER) && _MSC_VER >= 1900))
31 template <typename T> using Ptr = boost::shared_ptr<T>;
32 template <typename T> using WeakPtr = boost::weak_ptr<T>;
33 #else
34 #error "Not supported compiler version. Please use c++11 or higher."
35 #define Ptr boost::shared_ptr
36 #define WeakPtr boost::weak_ptr
37 #endif
38 
39 
40 // Funapi default namespace.
41 namespace fun {
42 
44 using boost::shared_ptr;
45 
47 using boost::weak_ptr;
48 
50 using boost::bind;
51 
53 using boost::function;
54 
56 typedef boost::uuids::uuid Uuid;
57 
59 typedef std::string string;
60 
62 using ::FunMessage;
63 
68  CONTINUE = 0,
69  STOP,
71  ABORT
73 };
74 
75 
76 template <typename T>
77 struct ArrayDeleter {
78  void operator()(const T *ptr) {
79  delete[] ptr;
80  }
81 };
82 
83 } // namespace fun
84 
85 
89 #define DECLARE_CLASS_PTR(CLS) \
90  static const Ptr<CLS> kNullPtr; \
91  static const WeakPtr<CLS> kNullWeakPtr;
92 
93 
98 #define DEFINE_CLASS_PTR(CLS) \
99  const Ptr<CLS> CLS::kNullPtr; \
100  const WeakPtr<CLS> CLS::kNullWeakPtr;
101 
102 
106 #define DECLARE_EVENT(Event) \
107  typedef fun::function<fun::ChainAction (Ptr<const Event>)> Handler;
108 
109 #ifdef _WIN32
110 #ifndef FUNAPI_DLL_VISIBILITY
111 #define FUNAPI_DLL_VISIBILITY __declspec(dllimport)
112 #endif // FUNAPI_DLL_VISIBILITY
113 #define FUNAPI_DLL_VISIBLE __declspec(dllexport)
114 #else // _WIN32
115 #ifdef FUNAPI_DLL_VISIBILITY
116 #undef FUNAPI_DLL_VISIBILITY
117 #endif // FUNAPI_DLL_VISIBILITY
118 #define FUNAPI_DLL_VISIBILITY
119 #define FUNAPI_DLL_VISIBLE
120 #endif // _WIN32
121 
122 #ifndef _WIN32
123 #define DEPRECATED(func) func __attribute__((deprecated))
124 #else // _WIN32
125 #define DEPRECATED(func) __declspec(deprecated) func
126 #define not !
127 #define and &&
128 #define or ||
129 #endif // _WIN32
130 
131 #define ROLLBACK
132 #define ASSERT_NO_ROLLBACK
133 
134 #endif // INCLUDE_FUNAPI_TYPES_H_
< Stops traversing an operations chain.
Definition: types.h:70
std::string string
String type used throughout Funapi.
Definition: types.h:59
Definition: json.h:18
boost::uuids::uuid Uuid
UUID type used throughout Funapi.
Definition: types.h:56
< Stops traversing and nullify effects.
Definition: types.h:72
ChainAction
Action types to specify behavior in chained operations (i.e.
Definition: types.h:67
Definition: types.h:77
< Keeps traversing an operations chain.
Definition: types.h:69