common.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2017 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
28 #ifndef NDN_COMMON_HPP
29 #define NDN_COMMON_HPP
30 
31 #include "ndn-cxx-config.hpp"
32 
33 // ndn-cxx specific macros declared in this and other headers must have NDN_CXX_ prefix
34 // to avoid conflicts with other projects that include ndn-cxx headers.
35 #ifdef NDN_CXX_HAVE_TESTS
36 #define NDN_CXX_VIRTUAL_WITH_TESTS virtual
37 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
38 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
39 #define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
40 #else
41 #define NDN_CXX_VIRTUAL_WITH_TESTS
42 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
43 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE private
44 #define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
45 #endif
46 
47 // require C++11
48 #if __cplusplus < 201103L && !defined(__GXX_EXPERIMENTAL_CXX0X__)
49 # error "ndn-cxx applications must be compiled using the C++11 standard (-std=c++11)"
50 #endif
51 
52 #include <algorithm>
53 #include <cstddef>
54 #include <cstdint>
55 #include <exception>
56 #include <functional>
57 #include <iosfwd>
58 #include <limits>
59 #include <memory>
60 #include <stdexcept>
61 #include <string>
62 #include <type_traits>
63 #include <unistd.h>
64 #include <utility>
65 
66 namespace ndn {
67 
68 using std::shared_ptr;
69 using std::unique_ptr;
70 using std::weak_ptr;
71 using std::bad_weak_ptr;
72 using std::make_shared;
73 using std::enable_shared_from_this;
74 
75 using std::static_pointer_cast;
76 using std::dynamic_pointer_cast;
77 using std::const_pointer_cast;
78 
79 using std::function;
80 using std::bind;
81 using std::ref;
82 using std::cref;
83 
84 } // namespace ndn
85 
86 using namespace std::placeholders;
87 
89 // Bug 2109 workaround
90 #define BOOST_BIND_NO_PLACEHOLDERS
91 #include <boost/is_placeholder.hpp>
92 namespace boost {
93 #define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N) \
94  template<> \
95  struct is_placeholder<typename std::remove_const<decltype(_##N)>::type> \
96  { \
97  enum _vt { \
98  value = N \
99  }; \
100  };
101 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(1)
102 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(2)
103 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(3)
104 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(4)
105 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(5)
106 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(6)
107 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(7)
108 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(8)
109 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(9)
110 #undef NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER
111 } // namespace boost
113 
114 #include <boost/assert.hpp>
115 #include <boost/concept_check.hpp>
116 #include <boost/noncopyable.hpp>
117 #include <boost/throw_exception.hpp>
118 
119 namespace ndn {
120 using boost::noncopyable;
121 } // namespace ndn
122 
123 #include "util/backports.hpp"
124 
125 #endif // NDN_COMMON_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:66
Definition: block.hpp:31