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 | |
Junxiao Shi | 9984850 | 2014-10-13 19:22:22 -0700 | [diff] [blame] | 27 | // ndn-cxx specific macros declared in this and other headers must have NDN_CXX_ prefix |
| 28 | // to avoid conflicts with other projects that include ndn-cxx headers. |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 29 | #ifdef NDN_CXX_HAVE_TESTS |
Junxiao Shi | 9984850 | 2014-10-13 19:22:22 -0700 | [diff] [blame] | 30 | #define NDN_CXX_VIRTUAL_WITH_TESTS virtual |
| 31 | #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED public |
| 32 | #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE public |
| 33 | #define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 34 | #else |
Junxiao Shi | 9984850 | 2014-10-13 19:22:22 -0700 | [diff] [blame] | 35 | #define NDN_CXX_VIRTUAL_WITH_TESTS |
| 36 | #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected |
| 37 | #define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE private |
| 38 | #define NDN_CXX_PROTECTED_WITH_TESTS_ELSE_PRIVATE private |
Jiewen Tan | 9913596 | 2014-09-20 02:18:53 -0700 | [diff] [blame] | 39 | #endif |
| 40 | |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 41 | // require C++11 |
| 42 | #if __cplusplus < 201103L && !defined(__GXX_EXPERIMENTAL_CXX0X__) |
| 43 | # error "ndn-cxx applications must be compiled using the C++11 standard" |
| 44 | #endif |
| 45 | |
| 46 | #include <cstddef> |
| 47 | #include <cstdint> |
| 48 | #include <cstring> |
| 49 | #include <functional> |
| 50 | #include <limits> |
| 51 | #include <memory> |
| 52 | #include <stdexcept> |
| 53 | #include <string> |
Alexander Afanasyev | e2dcdfd | 2014-02-07 15:53:28 -0800 | [diff] [blame] | 54 | #include <unistd.h> |
| 55 | |
Steve DiBenedetto | c145d49 | 2014-03-11 16:35:45 -0600 | [diff] [blame] | 56 | #if defined(__GNUC__) || defined(__clang__) |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 57 | # define DEPRECATED(func) func __attribute__ ((deprecated)) |
Steve DiBenedetto | c145d49 | 2014-03-11 16:35:45 -0600 | [diff] [blame] | 58 | #elif defined(_MSC_VER) |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 59 | # define DEPRECATED(func) __declspec(deprecated) func |
Steve DiBenedetto | c145d49 | 2014-03-11 16:35:45 -0600 | [diff] [blame] | 60 | #else |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 61 | # pragma message("DEPRECATED not implemented") |
| 62 | # define DEPRECATED(func) func |
Steve DiBenedetto | c145d49 | 2014-03-11 16:35:45 -0600 | [diff] [blame] | 63 | #endif |
| 64 | |
Alexander Afanasyev | 49bb1fb | 2014-07-21 12:54:01 -0700 | [diff] [blame] | 65 | namespace ndn { |
| 66 | |
| 67 | const size_t MAX_NDN_PACKET_SIZE = 8800; |
| 68 | |
Junxiao Shi | a034fa3 | 2014-10-31 20:03:51 -0700 | [diff] [blame^] | 69 | /** \brief the namespace contains smart pointers |
| 70 | * \deprecated use std:: directly |
| 71 | */ |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 72 | namespace ptr_lib = std; |
Junxiao Shi | a034fa3 | 2014-10-31 20:03:51 -0700 | [diff] [blame^] | 73 | |
| 74 | /** \brief the namespace contains function and bind |
| 75 | * \deprecated use std:: directly |
| 76 | */ |
Alexander Afanasyev | 8460afb | 2014-02-15 20:31:42 -0800 | [diff] [blame] | 77 | namespace func_lib = std; |
| 78 | |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 79 | using std::shared_ptr; |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 80 | using std::unique_ptr; |
Alexander Afanasyev | b78bc4d | 2014-04-09 21:20:52 -0700 | [diff] [blame] | 81 | using std::weak_ptr; |
Alexander Afanasyev | 6a05b4b | 2014-07-18 17:23:00 -0700 | [diff] [blame] | 82 | using std::bad_weak_ptr; |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 83 | using std::make_shared; |
| 84 | using std::enable_shared_from_this; |
| 85 | |
Alexander Afanasyev | 1515131 | 2014-02-16 00:53:51 -0800 | [diff] [blame] | 86 | using std::static_pointer_cast; |
| 87 | using std::dynamic_pointer_cast; |
| 88 | using std::const_pointer_cast; |
| 89 | |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 90 | using std::function; |
| 91 | using std::bind; |
Alexander Afanasyev | b67090a | 2014-04-29 22:31:01 -0700 | [diff] [blame] | 92 | using std::placeholders::_1; |
| 93 | using std::placeholders::_2; |
| 94 | using std::placeholders::_3; |
| 95 | using std::placeholders::_4; |
| 96 | using std::placeholders::_5; |
| 97 | using std::placeholders::_6; |
| 98 | using std::placeholders::_7; |
| 99 | using std::placeholders::_8; |
| 100 | using std::placeholders::_9; |
Alexander Afanasyev | b67090a | 2014-04-29 22:31:01 -0700 | [diff] [blame] | 101 | using std::ref; |
| 102 | using std::cref; |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 103 | |
| 104 | } // namespace ndn |
| 105 | |
Davide Pesavento | dfe9c6b | 2014-08-25 21:17:10 +0200 | [diff] [blame] | 106 | #include <boost/assert.hpp> |
| 107 | #include <boost/noncopyable.hpp> |
Alexander Afanasyev | 1950885 | 2014-01-29 01:01:51 -0800 | [diff] [blame] | 108 | |
| 109 | namespace ndn { |
Alexander Afanasyev | 233750e | 2014-02-16 00:50:07 -0800 | [diff] [blame] | 110 | using boost::noncopyable; |
Jeff Thompson | 51dd5fd | 2013-07-10 19:27:18 -0700 | [diff] [blame] | 111 | } |
| 112 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 113 | #endif // NDN_COMMON_HPP |