NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
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 
53 #ifdef NDN_CXX_HAVE_CXX_OVERRIDE_FINAL
54 #define NDN_CXX_DECL_OVERRIDE override
55 #define NDN_CXX_DECL_FINAL final
56 #else
57 #define NDN_CXX_DECL_OVERRIDE
58 #define NDN_CXX_DECL_FINAL
59 #endif
60 
61 // require C++11
62 #if __cplusplus < 201103L && !defined(__GXX_EXPERIMENTAL_CXX0X__)
63 # error "ndn-cxx applications must be compiled using the C++11 standard"
64 #endif
65 
66 #include <algorithm>
67 #include <cstddef>
68 #include <cstdint>
69 #include <cstring>
70 #include <functional>
71 #include <limits>
72 #include <memory>
73 #include <stdexcept>
74 #include <string>
75 #include <type_traits>
76 #include <unistd.h>
77 #include <utility>
78 
79 #if defined(__GNUC__) || defined(__clang__)
80 # define DEPRECATED(func) func __attribute__ ((deprecated))
81 #elif defined(_MSC_VER)
82 # define DEPRECATED(func) __declspec(deprecated) func
83 #else
84 # pragma message("DEPRECATED not implemented")
85 # define DEPRECATED(func) func
86 #endif
87 
88 namespace ndn {
89 
90 using std::shared_ptr;
91 using std::unique_ptr;
92 using std::weak_ptr;
93 using std::bad_weak_ptr;
94 using std::make_shared;
95 using std::enable_shared_from_this;
96 
97 using std::static_pointer_cast;
98 using std::dynamic_pointer_cast;
99 using std::const_pointer_cast;
100 
101 using std::function;
102 using std::bind;
103 using std::ref;
104 using std::cref;
105 
106 } // namespace ndn
107 
108 // Bug 2109 workaround
109 using namespace std::placeholders;
110 #define BOOST_BIND_NO_PLACEHOLDERS
111 #include <boost/is_placeholder.hpp>
112 namespace boost {
113 #define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N) \
114  template<> \
115  struct is_placeholder<typename std::remove_const<decltype(_##N)>::type> \
116  { \
117  enum _vt { \
118  value = N \
119  }; \
120  };
130 #undef NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER
131 } // namespace boost
132 
133 #include <boost/assert.hpp>
134 #include <boost/concept_check.hpp>
135 #include <boost/noncopyable.hpp>
136 #include <boost/throw_exception.hpp>
137 
138 namespace ndn {
139 using boost::noncopyable;
140 }
141 
142 #include "util/backports.hpp"
143 
144 #endif // NDN_COMMON_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2015 Regents of the University of California.
#define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N)
Definition: common.hpp:113