HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Library.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_LIBRARY_H
7 #define MATERIALX_LIBRARY_H
8 
9 /// @file
10 /// Library-wide includes and types. This file should be the first include for
11 /// any public header in the MaterialX library.
12 
13 #include <algorithm>
14 #include <cstdint>
15 #include <cstdlib>
16 #include <functional>
17 #include <memory>
18 #include <set>
19 #include <string>
20 #include <unordered_map>
21 #include <vector>
22 
24 
25 #define MATERIALX_GENERATE_INDEX(major, minor, build) (((major) << 22U) | ((minor) << 12U) | (build))
26 
27 #define MATERIALX_VERSION_INDEX \
28  MATERIALX_GENERATE_INDEX(MATERIALX_MAJOR_VERSION, MATERIALX_MINOR_VERSION, MATERIALX_BUILD_VERSION)
29 
30 /// Platform-specific macros for declaring imported and exported symbols.
31 #if defined(MATERIALX_BUILD_SHARED_LIBS)
32  #if defined(_WIN32)
33  #pragma warning(disable : 4251)
34  #pragma warning(disable : 4275)
35  #pragma warning(disable : 4661)
36  #define MATERIALX_SYMBOL_EXPORT __declspec(dllexport)
37  #define MATERIALX_SYMBOL_IMPORT __declspec(dllimport)
38  #define MATERIALX_EXPORT_EXTERN_TEMPLATE(...) template class __VA_ARGS__
39  #define MATERIALX_IMPORT_EXTERN_TEMPLATE(...) extern template class __VA_ARGS__
40  #else
41  #define MATERIALX_SYMBOL_EXPORT __attribute__((__visibility__("default")))
42  #define MATERIALX_SYMBOL_IMPORT __attribute__((__visibility__("default")))
43  #define MATERIALX_EXPORT_EXTERN_TEMPLATE(...) template class MATERIALX_SYMBOL_EXPORT __VA_ARGS__
44  #define MATERIALX_IMPORT_EXTERN_TEMPLATE(...) extern template class MATERIALX_SYMBOL_IMPORT __VA_ARGS__
45  #endif
46 #else
47  #define MATERIALX_SYMBOL_EXPORT
48  #define MATERIALX_SYMBOL_IMPORT
49  #define MATERIALX_EXPORT_EXTERN_TEMPLATE(...)
50  #define MATERIALX_IMPORT_EXTERN_TEMPLATE(...)
51 #endif
52 
54 
55 using std::string;
56 using std::vector;
57 using std::shared_ptr;
58 using std::weak_ptr;
59 
60 /// A vector of strings.
61 using StringVec = vector<string>;
62 /// An unordered map with strings as both keys and values.
63 using StringMap = std::unordered_map<string, string>;
64 /// A set of strings.
65 using StringSet = std::set<string>;
66 
68 
69 #endif
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
vector< string > StringVec
A vector of strings.
Definition: Library.h:61
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:63
std::set< string > StringSet
A set of strings.
Definition: Library.h:65
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26