NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
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-2021 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_CXX_DETAIL_COMMON_HPP
29 #define NDN_CXX_DETAIL_COMMON_HPP
30 
31 #include "ndn-cxx/detail/config.hpp"
32 
33 // require C++14
34 #if __cplusplus < 201402L
35 #error "ndn-cxx applications must be compiled using the C++14 standard (-std=c++14)"
36 #endif
37 
38 // ndn-cxx specific macros declared in this and other headers must have NDN_CXX_ prefix
39 // to avoid conflicts with other projects that include ndn-cxx headers.
40 #ifdef NDN_CXX_HAVE_TESTS
41 #define NDN_CXX_VIRTUAL_WITH_TESTS virtual
42 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
43 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
44 #define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
45 #else
46 #define NDN_CXX_VIRTUAL_WITH_TESTS
47 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
48 #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE private
49 #define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
50 #endif
51 
52 #include <algorithm>
53 #include <cstddef>
54 #include <cstdint>
55 #include <functional>
56 #include <iosfwd>
57 #include <limits>
58 #include <memory>
59 #include <stdexcept>
60 #include <string>
61 #include <type_traits>
62 #include <utility>
63 
64 namespace ndn {
65 
66 using std::shared_ptr;
67 using std::unique_ptr;
68 using std::weak_ptr;
69 using std::make_shared;
70 using std::make_unique;
71 
72 using std::static_pointer_cast;
73 using std::dynamic_pointer_cast;
74 using std::const_pointer_cast;
75 
76 using std::function;
77 
78 using namespace std::string_literals;
79 
80 } // namespace ndn
81 
82 using namespace std::placeholders;
83 
84 #include <boost/version.hpp>
85 
87 // Bug 2109 workaround
88 #if BOOST_VERSION < 107600
89 #define BOOST_BIND_NO_PLACEHOLDERS
90 #include <boost/is_placeholder.hpp>
91 namespace boost {
92 #define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N) \
93  template<> \
94  struct is_placeholder<std::remove_const_t<decltype(_##N)>> \
95  { \
96  enum _vt { \
97  value = N \
98  }; \
99  };
100 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(1)
101 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(2)
102 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(3)
103 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(4)
104 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(5)
105 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(6)
106 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(7)
107 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(8)
108 NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(9)
109 #undef NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER
110 } // namespace boost
111 #endif // BOOST_VERSION < 107600
112 
114 #include <boost/assert.hpp>
115 #include <boost/concept_check.hpp>
116 #include <boost/core/noncopyable.hpp>
117 
118 namespace ndn {
119 using boost::noncopyable;
120 } // namespace ndn
121 
124 
125 #endif // NDN_CXX_DETAIL_COMMON_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Definition: block.hpp:32