blob: 44a0dd8388b237db66ce4d18dd785b9cf295f1a2 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Jeff Thompson47eecfc2013-07-07 22:56:46 -07002/**
Alexander Afanasyevc169a812014-05-20 20:37:29 -04003 * Copyright (c) 2013-2014 Regents of the University of California.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * 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 Thompson571f3522013-07-07 22:39:31 -070020 */
21
22#ifndef NDN_COMMON_HPP
23#define NDN_COMMON_HPP
24
Alexander Afanasyev766cea72014-04-24 19:16:42 -070025#include "ndn-cxx-config.hpp"
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -070026
Junxiao Shi99848502014-10-13 19:22:22 -070027// 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 Tan99135962014-09-20 02:18:53 -070029#ifdef NDN_CXX_HAVE_TESTS
Junxiao Shi99848502014-10-13 19:22:22 -070030#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 Tan99135962014-09-20 02:18:53 -070034#else
Junxiao Shi99848502014-10-13 19:22:22 -070035#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 Tan99135962014-09-20 02:18:53 -070039#endif
40
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020041// 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 Afanasyeve2dcdfd2014-02-07 15:53:28 -080054#include <unistd.h>
55
Steve DiBenedettoc145d492014-03-11 16:35:45 -060056#if defined(__GNUC__) || defined(__clang__)
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020057# define DEPRECATED(func) func __attribute__ ((deprecated))
Steve DiBenedettoc145d492014-03-11 16:35:45 -060058#elif defined(_MSC_VER)
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020059# define DEPRECATED(func) __declspec(deprecated) func
Steve DiBenedettoc145d492014-03-11 16:35:45 -060060#else
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020061# pragma message("DEPRECATED not implemented")
62# define DEPRECATED(func) func
Steve DiBenedettoc145d492014-03-11 16:35:45 -060063#endif
64
Alexander Afanasyev49bb1fb2014-07-21 12:54:01 -070065namespace ndn {
66
67const size_t MAX_NDN_PACKET_SIZE = 8800;
68
Alexander Afanasyev19508852014-01-29 01:01:51 -080069namespace ptr_lib = std;
Alexander Afanasyev8460afb2014-02-15 20:31:42 -080070namespace func_lib = std;
71
Alexander Afanasyev19508852014-01-29 01:01:51 -080072using std::shared_ptr;
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020073using std::unique_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070074using std::weak_ptr;
Alexander Afanasyev6a05b4b2014-07-18 17:23:00 -070075using std::bad_weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -080076using std::make_shared;
77using std::enable_shared_from_this;
78
Alexander Afanasyev15151312014-02-16 00:53:51 -080079using std::static_pointer_cast;
80using std::dynamic_pointer_cast;
81using std::const_pointer_cast;
82
Alexander Afanasyev19508852014-01-29 01:01:51 -080083using std::function;
84using std::bind;
Alexander Afanasyevb67090a2014-04-29 22:31:01 -070085using std::placeholders::_1;
86using std::placeholders::_2;
87using std::placeholders::_3;
88using std::placeholders::_4;
89using std::placeholders::_5;
90using std::placeholders::_6;
91using std::placeholders::_7;
92using std::placeholders::_8;
93using std::placeholders::_9;
Alexander Afanasyevb67090a2014-04-29 22:31:01 -070094using std::ref;
95using std::cref;
Alexander Afanasyev19508852014-01-29 01:01:51 -080096
97} // namespace ndn
98
Davide Pesaventodfe9c6b2014-08-25 21:17:10 +020099#include <boost/assert.hpp>
100#include <boost/noncopyable.hpp>
Alexander Afanasyev19508852014-01-29 01:01:51 -0800101
102namespace ndn {
Alexander Afanasyev233750e2014-02-16 00:50:07 -0800103using boost::noncopyable;
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700104}
105
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700106#endif // NDN_COMMON_HPP