Sleeping Wombat Common Library  0.50.0
swCommonLibrary
TypesDefinitions.h
Go to the documentation of this file.
1 #pragma once
2 
21 #include <cstdint>
22 #include <memory>
23 
24 
25 
26 typedef int8_t int8;
27 typedef uint8_t uint8;
28 typedef int16_t int16;
29 typedef uint16_t uint16;
30 typedef int32_t int32;
31 typedef uint32_t uint32;
32 typedef int64_t int64;
33 typedef uint64_t uint64;
34 
35 typedef size_t Size;
36 
37 typedef ptrdiff_t PtrOffset;
38 
39 typedef double TimeType;
40 
41 
42 namespace rttr
43 {
44  class type;
45 }
46 
47 
48 typedef rttr::type ActorType;
49 
51 template< typename PtrType >
52 using UPtr = std::shared_ptr< PtrType >;
53 
54 template< typename PtrType >
55 using Ptr = std::shared_ptr< PtrType >;
56 
60 template< typename PtrType >
61 using OPtr = std::unique_ptr< PtrType >;
62 
63 template< typename PtrType, typename... Args >
64 Ptr< PtrType > MakePtr ( Args&&... args )
65 {
66  return std::make_shared< PtrType >( args... );
67 }
68 
69 template< typename PtrType, typename... Args >
70 UPtr< PtrType > MakeUPtr ( Args... args )
71 {
72  return std::make_unique< PtrType >( args... );
73 }
74 
75 
76 template< typename PtrType, typename... Args >
77 UPtr< PtrType > MakeOPtr ( Args... args )
78 {
79  return std::make_unique< PtrType >( args... );
80 }
81 
82 
83 #define DEFINE_PTR_TYPE( type ) typedef Ptr< type > type ## Ptr;
84 #define DEFINE_UPTR_TYPE( type ) typedef UPtr< type > type ## UPtr;
85 #define DEFINE_WPTR_TYPE( type ) typedef std::weak_ptr< type > type ## WPtr;
86 #define DEFINE_OPTR_TYPE( type ) typedef OPtr< type > type ## OPtr;
87 
88 
89 #define CLASS_TESTER( type ) __ ## type ## __Tester
90 #define FRIEND_CLASS_TESTER( type ) friend class CLASS_TESTER( type );
Definition: TypesDefinitions.h:42
Definition: UPtr.h:10
std::unique_ptr< PtrType > OPtr
Definition: TypesDefinitions.h:61