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 <cstdlib>
15 #include <functional>
16 #include <memory>
17 #include <set>
18 #include <string>
19 #include <unordered_map>
20 #include <vector>
21 
23 
24 #define MATERIALX_GENERATE_INDEX(major, minor, build) \
25  ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(build)))
26 #define MATERIALX_VERSION_INDEX \
27  MATERIALX_GENERATE_INDEX(MATERIALX_MAJOR_VERSION, MATERIALX_MINOR_VERSION, MATERIALX_BUILD_VERSION)
28 
29 /// Platform-specific macros for declaring imported and exported symbols.
30 #if defined(MATERIALX_BUILD_SHARED_LIBS)
31  #if defined(_WIN32)
32  #pragma warning(disable : 4251)
33  #pragma warning(disable : 4275)
34  #pragma warning(disable : 4661)
35  #define MATERIALX_SYMBOL_EXPORT __declspec(dllexport)
36  #define MATERIALX_SYMBOL_IMPORT __declspec(dllimport)
37  #define MATERIALX_EXPORT_EXTERN_TEMPLATE(...) template class MATERIALX_SYMBOL_EXPORT __VA_ARGS__
38  #define MATERIALX_IMPORT_EXTERN_TEMPLATE(...) extern template class MATERIALX_SYMBOL_IMPORT __VA_ARGS__
39  #else
40  #define MATERIALX_SYMBOL_EXPORT __attribute__((__visibility__("default")))
41  #define MATERIALX_SYMBOL_IMPORT __attribute__((__visibility__("default")))
42  #define MATERIALX_EXPORT_EXTERN_TEMPLATE(...) template class MATERIALX_SYMBOL_EXPORT __VA_ARGS__
43  #define MATERIALX_IMPORT_EXTERN_TEMPLATE(...) extern template class MATERIALX_SYMBOL_IMPORT __VA_ARGS__
44  #endif
45 #else
46  #define MATERIALX_SYMBOL_EXPORT
47  #define MATERIALX_SYMBOL_IMPORT
48  #define MATERIALX_EXPORT_EXTERN_TEMPLATE(...)
49  #define MATERIALX_IMPORT_EXTERN_TEMPLATE(...)
50 #endif
51 
53 
54 using std::string;
55 using std::vector;
56 using std::shared_ptr;
57 using std::weak_ptr;
58 
59 /// A vector of strings.
60 using StringVec = vector<string>;
61 /// An unordered map with strings as both keys and values.
62 using StringMap = std::unordered_map<string, string>;
63 /// A set of strings.
64 using StringSet = std::set<string>;
65 
67 
68 #endif
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
vector< string > StringVec
A vector of strings.
Definition: Library.h:60
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:62
std::set< string > StringSet
A set of strings.
Definition: Library.h:64
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26