OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
macros.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_MACROS_HPP
2 #define OPENPOSE_CORE_MACROS_HPP
3 
4 #include <memory> // std::shared_ptr
5 #include <ostream>
6 #include <vector>
7 
8 #ifndef _WIN32
9  #define OP_API
10 #elif defined OP_EXPORTS
11  #define OP_API __declspec(dllexport)
12 #else
13  #define OP_API __declspec(dllimport)
14 #endif
15 
16 //Disable some Windows Warnings
17 #ifdef _WIN32
18  #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
19  #pragma warning( disable: 4275 ) // non dll-interface structXXX used as base
20 #endif
21 
22 #define UNUSED(unusedVariable) (void)(unusedVariable)
23 
24 #define DELETE_COPY(className) \
25  className(const className&) = delete; \
26  className& operator=(const className&) = delete
27 
28 // Instantiate a class with all the basic types
29 #define COMPILE_TEMPLATE_BASIC_TYPES_CLASS(className) COMPILE_TEMPLATE_BASIC_TYPES(className, class)
30 #define COMPILE_TEMPLATE_BASIC_TYPES_STRUCT(className) COMPILE_TEMPLATE_BASIC_TYPES(className, struct)
31 #define COMPILE_TEMPLATE_BASIC_TYPES(className, classType) \
32  template classType OP_API className<char>; \
33  template classType OP_API className<signed char>; \
34  template classType OP_API className<short>; \
35  template classType OP_API className<int>; \
36  template classType OP_API className<long>; \
37  template classType OP_API className<long long>; \
38  template classType OP_API className<unsigned char>; \
39  template classType OP_API className<unsigned short>; \
40  template classType OP_API className<unsigned int>; \
41  template classType OP_API className<unsigned long>; \
42  template classType OP_API className<unsigned long long>; \
43  template classType OP_API className<float>; \
44  template classType OP_API className<double>; \
45  template classType OP_API className<long double>
46 
51 #define OVERLOAD_C_OUT(className) \
52  template<typename T> std::ostream &operator<<(std::ostream& ostream, const op::className<T>& obj) \
53  { \
54  ostream << obj.toString(); \
55  return ostream; \
56  }
57 
58 // Instantiate a class with float and double specifications
59 #define COMPILE_TEMPLATE_FLOATING_TYPES_CLASS(className) COMPILE_TEMPLATE_FLOATING_TYPES(className, class)
60 #define COMPILE_TEMPLATE_FLOATING_TYPES_STRUCT(className) COMPILE_TEMPLATE_FLOATING_TYPES(className, struct)
61 #define COMPILE_TEMPLATE_FLOATING_TYPES(className, classType) \
62  char gInstantiationGuard##className; \
63  template classType OP_API className<float>; \
64  template classType OP_API className<double>
65 
66 // PIMPL does not work if function arguments need the 3rd-party class. Alternative:
67 // stackoverflow.com/questions/13978775/how-to-avoid-include-dependency-to-external-library?answertab=active#tab-top
68 struct dim3;
69 namespace caffe
70 {
71  template <typename T> class Blob;
72 }
73 namespace boost
74 {
75  template <typename T> class shared_ptr; // E.g., boost::shared_ptr<caffe::Blob<float>>
76 }
77 
78 #endif // OPENPOSE_CORE_MACROS_HPP
Definition: macros.hpp:75
Definition: macros.hpp:71