Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 2 | /** |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 3 | * Copyright (c) 2013-2014 Regents of the University of California. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 6 | * |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 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. |
Jeff Thompson | 571f352 | 2013-07-07 22:39:31 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #ifndef NDN_COMMON_HPP |
| 23 | #define NDN_COMMON_HPP |
| 24 | |
Alexander Afanasyev | 766cea7 | 2014-04-24 19:16:42 -0700 | [diff] [blame] | 25 | #include "ndn-cxx-config.hpp" |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 26 | |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame^] | 27 | #ifdef NDN_CXX_HAVE_TESTS |
| 28 | #define VIRTUAL_WITH_TESTS virtual |
| 29 | #define PUBLIC_WITH_TESTS_ELSE_PROTECTED public |
| 30 | #define PUBLIC_WITH_TESTS_ELSE_PRIVATE public |
| 31 | #define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected |
| 32 | #else |
| 33 | #define VIRTUAL_WITH_TESTS |
| 34 | #define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected |
| 35 | #define PUBLIC_WITH_TESTS_ELSE_PRIVATE private |
| 36 | #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private |
| 37 | #endif |
| 38 | |
Alexander Afanasyev | d409d59 | 2014-01-28 18:36:38 -0800 | [diff] [blame] | 39 | #include <stdint.h> |
Alexander Afanasyev | d409d59 | 2014-01-28 18:36:38 -0800 | [diff] [blame] | 40 | #include <stddef.h> |
Alexander Afanasyev | e2dcdfd | 2014-02-07 15:53:28 -0800 | [diff] [blame] | 41 | #include <unistd.h> |
| 42 | |
Steve DiBenedetto | c145d49 | 2014-03-11 16:35:45 -0600 | [diff] [blame] | 43 | #if defined(__GNUC__) || defined(__clang__) |
| 44 | #define DEPRECATED(func) func __attribute__ ((deprecated)) |
| 45 | #elif defined(_MSC_VER) |
| 46 | #define DEPRECATED(func) __declspec(deprecated) func |
| 47 | #else |
| 48 | #pragma message("DEPRECATED not implemented") |
| 49 | #define DEPRECATED(func) func |
| 50 | #endif |
| 51 | |
Alexander Afanasyev | 49bb1fb | 2014-07-21 12:54:01 -0700 | [diff] [blame] | 52 | namespace ndn { |
| 53 | |
| 54 | const size_t MAX_NDN_PACKET_SIZE = 8800; |
| 55 | |
| 56 | } // namespace ndn |
| 57 | |
Alexander Afanasyev | 766cea7 | 2014-04-24 19:16:42 -0700 | [diff] [blame] | 58 | #ifdef NDN_CXX_HAVE_CXX11 |
Alexander Afanasyev | 472fa02 | 2014-01-07 13:30:49 -0800 | [diff] [blame] | 59 | |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 60 | #if defined(__GNUC__) |
| 61 | # if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L |
Alexander Afanasyev | 766cea7 | 2014-04-24 19:16:42 -0700 | [diff] [blame] | 62 | # error "NDN-CXX library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled" |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 63 | # endif // !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L |
| 64 | #endif // defined(__GNUC__) |
| 65 | |
| 66 | #if defined(__clang__) && __cplusplus < 201103L |
Alexander Afanasyev | 766cea7 | 2014-04-24 19:16:42 -0700 | [diff] [blame] | 67 | # error "NDN-CXX library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled" |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 68 | #endif // defined(__clang__) && (__cplusplus < 201103L) |
| 69 | |
Jeff Thompson | 571f352 | 2013-07-07 22:39:31 -0700 | [diff] [blame] | 70 | #include <memory> |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 71 | #include <functional> |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 72 | |
| 73 | namespace ndn { |
| 74 | |
| 75 | namespace ptr_lib = std; |
Alexander Afanasyev | 8460afb | 2014-02-15 20:31:42 -0800 | [diff] [blame] | 76 | namespace func_lib = std; |
| 77 | |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 78 | using std::shared_ptr; |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 79 | using std::weak_ptr; |
Alexander Afanasyev | 6a05b4b | 2014-07-18 17:23:00 -0700 | [diff] [blame] | 80 | using std::bad_weak_ptr; |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 81 | using std::make_shared; |
| 82 | using std::enable_shared_from_this; |
| 83 | |
Alexander Afanasyev | 1515131 | 2014-02-16 00:53:51 -0800 | [diff] [blame] | 84 | using std::static_pointer_cast; |
| 85 | using std::dynamic_pointer_cast; |
| 86 | using std::const_pointer_cast; |
| 87 | |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 88 | using std::function; |
| 89 | using std::bind; |
Alexander Afanasyev | b67090a | 2014-04-29 22:31:01 -0700 | [diff] [blame] | 90 | using std::placeholders::_1; |
| 91 | using std::placeholders::_2; |
| 92 | using std::placeholders::_3; |
| 93 | using std::placeholders::_4; |
| 94 | using std::placeholders::_5; |
| 95 | using std::placeholders::_6; |
| 96 | using std::placeholders::_7; |
| 97 | using std::placeholders::_8; |
| 98 | using std::placeholders::_9; |
| 99 | |
| 100 | using std::ref; |
| 101 | using std::cref; |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 102 | |
| 103 | } // namespace ndn |
| 104 | |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 105 | |
Alexander Afanasyev | d409d59 | 2014-01-28 18:36:38 -0800 | [diff] [blame] | 106 | #else |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 107 | |
Jeff Thompson | 571f352 | 2013-07-07 22:39:31 -0700 | [diff] [blame] | 108 | #include <boost/shared_ptr.hpp> |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 109 | #include <boost/weak_ptr.hpp> |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 110 | #include <boost/enable_shared_from_this.hpp> |
Jeff Thompson | 571f352 | 2013-07-07 22:39:31 -0700 | [diff] [blame] | 111 | #include <boost/make_shared.hpp> |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 112 | |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 113 | #include <boost/function.hpp> |
| 114 | #include <boost/bind.hpp> |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 115 | |
| 116 | namespace ndn { |
| 117 | |
| 118 | namespace ptr_lib = boost; |
| 119 | namespace func_lib = boost; |
| 120 | |
| 121 | using boost::shared_ptr; |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 122 | using boost::weak_ptr; |
Alexander Afanasyev | 6a05b4b | 2014-07-18 17:23:00 -0700 | [diff] [blame] | 123 | using boost::bad_weak_ptr; |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 124 | using boost::make_shared; |
| 125 | using boost::enable_shared_from_this; |
| 126 | |
Alexander Afanasyev | 1515131 | 2014-02-16 00:53:51 -0800 | [diff] [blame] | 127 | using boost::static_pointer_cast; |
| 128 | using boost::dynamic_pointer_cast; |
| 129 | using boost::const_pointer_cast; |
| 130 | |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 131 | using boost::function; |
| 132 | using boost::bind; |
| 133 | |
Alexander Afanasyev | b67090a | 2014-04-29 22:31:01 -0700 | [diff] [blame] | 134 | using boost::ref; |
| 135 | using boost::cref; |
| 136 | |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 137 | } // namespace ndn |
Alexander Afanasyev | 0541cf4 | 2014-01-02 19:10:37 -0800 | [diff] [blame] | 138 | |
Alexander Afanasyev | 766cea7 | 2014-04-24 19:16:42 -0700 | [diff] [blame] | 139 | #endif // NDN_CXX_HAVE_CXX11 |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 140 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 141 | #include <boost/utility.hpp> |
| 142 | |
Jeff Thompson | 51dd5fd | 2013-07-10 19:27:18 -0700 | [diff] [blame] | 143 | namespace ndn { |
Jeff Thompson | 9a8e82f | 2013-10-17 14:13:43 -0700 | [diff] [blame] | 144 | |
Alexander Afanasyev | 233750e | 2014-02-16 00:50:07 -0800 | [diff] [blame] | 145 | using boost::noncopyable; |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 146 | |
Jeff Thompson | 51dd5fd | 2013-07-10 19:27:18 -0700 | [diff] [blame] | 147 | } |
| 148 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 149 | #endif // NDN_COMMON_HPP |