NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 
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 <cstring>
56 #include <functional>
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 #if defined(__GNUC__) || defined(__clang__)
66 # define DEPRECATED(func) func __attribute__ ((deprecated))
67 #elif defined(_MSC_VER)
68 # define DEPRECATED(func) __declspec(deprecated) func
69 #else
70 # pragma message("DEPRECATED not implemented")
71 # define DEPRECATED(func) func
72 #endif
73 
74 namespace ndn {
75 
76 using std::shared_ptr;
77 using std::unique_ptr;
78 using std::weak_ptr;
79 using std::bad_weak_ptr;
80 using std::make_shared;
81 using std::enable_shared_from_this;
82 
83 using std::static_pointer_cast;
84 using std::dynamic_pointer_cast;
85 using std::const_pointer_cast;
86 
87 using std::function;
88 using std::bind;
89 using std::ref;
90 using std::cref;
91 
92 } // namespace ndn
93 
94 // Bug 2109 workaround
95 using namespace std::placeholders;
96 #define BOOST_BIND_NO_PLACEHOLDERS
97 #include <boost/is_placeholder.hpp>
98 namespace boost {
99 #define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N) \
100  template<> \
101  struct is_placeholder<typename std::remove_const<decltype(_##N)>::type> \
102  { \
103  enum _vt { \
104  value = N \
105  }; \
106  };
116 #undef NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER
117 } // namespace boost
118 
119 #include <boost/assert.hpp>
120 #include <boost/concept_check.hpp>
121 #include <boost/noncopyable.hpp>
122 #include <boost/throw_exception.hpp>
123 
124 namespace ndn {
125 using boost::noncopyable;
126 } // namespace ndn
127 
128 #include "util/backports.hpp"
129 
130 #endif // NDN_COMMON_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2016 Regents of the University of California.
#define NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(N)
Definition: common.hpp:99