OpFlex Framework  1.7.0
OFTypes.h
1 /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
6 /*
7  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
8  *
9  * This program and the accompanying materials are made available under the
10  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11  * and is available at http://www.eclipse.org/legal/epl-v10.html
12  */
13 
14 #pragma once
15 #ifndef OPFLEX_CORE_TYPES_H
16 #define OPFLEX_CORE_TYPES_H
17 
18 #if __cplusplus > 199711L && !defined(OF_NO_STD_CXX11)
19 #define OF_USE_STD_CXX11
20 #endif
21 
22 #ifdef OF_USE_STD_CXX11
23 #include <unordered_set>
24 #include <unordered_map>
25 #include <memory>
26 #else
27 // Boost types are required for C++03, while we use standard library
28 // types for C++11 or later.
29 #include <boost/unordered_set.hpp>
30 #include <boost/unordered_map.hpp>
31 #include <boost/shared_ptr.hpp>
32 #include <boost/make_shared.hpp>
33 #endif
34 
40 namespace opflex {
41 namespace ofcore {
42 
43 #ifdef OF_USE_STD_CXX11
44 
48 #define OF_UNORDERED_SET std::unordered_set
49 
53 #define OF_UNORDERED_MAP std::unordered_map
54 
58 #define OF_SHARED_PTR std::shared_ptr
59 
63 #define OF_MAKE_SHARED std::make_shared
64 
65 #else /* OF_USE_STD_CXX11 */
66 
70 #define OF_UNORDERED_SET boost::unordered_set
71 
75 #define OF_UNORDERED_MAP boost::unordered_map
76 
80 #define OF_SHARED_PTR boost::shared_ptr
81 
85 #define OF_MAKE_SHARED boost::make_shared
86 
87 #endif /* OF_USE_STD_CXX11 */
88 
89 } /* namespace ofcore */
90 } /* namespace opflex */
91 
94 #endif /* OPFLEX_CORE_TYPES_H */