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-2018 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_DETAIL_COMMON_HPP
29 #define NDN_DETAIL_COMMON_HPP
30 
31 #include "ndn-cxx/detail/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++14
48 #if __cplusplus < 201402L
49 #error "ndn-cxx applications must be compiled using the C++14 standard (-std=c++14)"
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 <unistd.h>
63 #include <utility>
64 
65 namespace ndn {
66 
67 using std::shared_ptr;
68 using std::unique_ptr;
69 using std::weak_ptr;
70 using std::make_shared;
71 using std::make_unique;
72 
73 using std::static_pointer_cast;
74 using std::dynamic_pointer_cast;
75 using std::const_pointer_cast;
76 
77 using std::function;
78 using std::bind;
79 using std::ref;
80 using std::cref;
81 
82 using namespace std::string_literals;
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<std::remove_const_t<decltype(_##N)>> \
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 
124 
125 #endif // NDN_DETAIL_COMMON_HPP
Copyright (c) 2011-2015 Regents of the University of California.