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 <cstddef>
67 #include <cstdint>
68 #include <cstring>
69 #include <functional>
70 #include <limits>
71 #include <memory>
72 #include <stdexcept>
73 #include <string>
74 #include <type_traits>
75 #include <unistd.h>
76 
77 #if defined(__GNUC__) || defined(__clang__)
78 # define DEPRECATED(func) func __attribute__ ((deprecated))
79 #elif defined(_MSC_VER)
80 # define DEPRECATED(func) __declspec(deprecated) func
81 #else
82 # pragma message("DEPRECATED not implemented")
83 # define DEPRECATED(func) func
84 #endif
85 
86 namespace ndn {
87 
88 using std::shared_ptr;
89 using std::unique_ptr;
90 using std::weak_ptr;
91 using std::bad_weak_ptr;
92 using std::make_shared;
93 using std::enable_shared_from_this;
94 
95 using std::static_pointer_cast;
96 using std::dynamic_pointer_cast;
97 using std::const_pointer_cast;
98 
99 using std::function;
100 using std::bind;
101 using std::ref;
102 using std::cref;
103 
104 } // namespace ndn
105 
106 // Bug 2109 workaround
107 using namespace std::placeholders;
108 #define BOOST_BIND_NO_PLACEHOLDERS
109 #include <boost/is_placeholder.hpp>
110 namespace boost {
111 #define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N) \
112  template<> \
113  struct is_placeholder<typename std::remove_const<decltype(_##N)>::type> \
114  { \
115  enum _vt { \
116  value = N \
117  }; \
118  };
128 #undef NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER
129 } // namespace boost
130 
131 #include <boost/assert.hpp>
132 #include <boost/concept_check.hpp>
133 #include <boost/noncopyable.hpp>
134 #include <boost/throw_exception.hpp>
135 
136 namespace ndn {
137 using boost::noncopyable;
138 }
139 
140 #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:111