blob: ae69686f226f87ca9afd34c89a8162fd8da488bf [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
Jiewen Tan99135962014-09-20 02:18:53 -070027#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 Afanasyevd409d592014-01-28 18:36:38 -080039#include <stdint.h>
Alexander Afanasyevd409d592014-01-28 18:36:38 -080040#include <stddef.h>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080041#include <unistd.h>
42
Steve DiBenedettoc145d492014-03-11 16:35:45 -060043#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 Afanasyev49bb1fb2014-07-21 12:54:01 -070052namespace ndn {
53
54const size_t MAX_NDN_PACKET_SIZE = 8800;
55
56} // namespace ndn
57
Alexander Afanasyev766cea72014-04-24 19:16:42 -070058#ifdef NDN_CXX_HAVE_CXX11
Alexander Afanasyev472fa022014-01-07 13:30:49 -080059
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070060#if defined(__GNUC__)
61# if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070062# error "NDN-CXX library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled"
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070063# endif // !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
64#endif // defined(__GNUC__)
65
66#if defined(__clang__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070067# error "NDN-CXX library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled"
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070068#endif // defined(__clang__) && (__cplusplus < 201103L)
69
Jeff Thompson571f3522013-07-07 22:39:31 -070070#include <memory>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080071#include <functional>
Alexander Afanasyev19508852014-01-29 01:01:51 -080072
73namespace ndn {
74
75namespace ptr_lib = std;
Alexander Afanasyev8460afb2014-02-15 20:31:42 -080076namespace func_lib = std;
77
Alexander Afanasyev19508852014-01-29 01:01:51 -080078using std::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070079using std::weak_ptr;
Alexander Afanasyev6a05b4b2014-07-18 17:23:00 -070080using std::bad_weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -080081using std::make_shared;
82using std::enable_shared_from_this;
83
Alexander Afanasyev15151312014-02-16 00:53:51 -080084using std::static_pointer_cast;
85using std::dynamic_pointer_cast;
86using std::const_pointer_cast;
87
Alexander Afanasyev19508852014-01-29 01:01:51 -080088using std::function;
89using std::bind;
Alexander Afanasyevb67090a2014-04-29 22:31:01 -070090using std::placeholders::_1;
91using std::placeholders::_2;
92using std::placeholders::_3;
93using std::placeholders::_4;
94using std::placeholders::_5;
95using std::placeholders::_6;
96using std::placeholders::_7;
97using std::placeholders::_8;
98using std::placeholders::_9;
99
100using std::ref;
101using std::cref;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800102
103} // namespace ndn
104
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800105
Alexander Afanasyevd409d592014-01-28 18:36:38 -0800106#else
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800107
Jeff Thompson571f3522013-07-07 22:39:31 -0700108#include <boost/shared_ptr.hpp>
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700109#include <boost/weak_ptr.hpp>
Alexander Afanasyevb790d952014-01-24 12:07:53 -0800110#include <boost/enable_shared_from_this.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -0700111#include <boost/make_shared.hpp>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800112
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800113#include <boost/function.hpp>
114#include <boost/bind.hpp>
Alexander Afanasyev19508852014-01-29 01:01:51 -0800115
116namespace ndn {
117
118namespace ptr_lib = boost;
119namespace func_lib = boost;
120
121using boost::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700122using boost::weak_ptr;
Alexander Afanasyev6a05b4b2014-07-18 17:23:00 -0700123using boost::bad_weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800124using boost::make_shared;
125using boost::enable_shared_from_this;
126
Alexander Afanasyev15151312014-02-16 00:53:51 -0800127using boost::static_pointer_cast;
128using boost::dynamic_pointer_cast;
129using boost::const_pointer_cast;
130
Alexander Afanasyev19508852014-01-29 01:01:51 -0800131using boost::function;
132using boost::bind;
133
Alexander Afanasyevb67090a2014-04-29 22:31:01 -0700134using boost::ref;
135using boost::cref;
136
Alexander Afanasyev19508852014-01-29 01:01:51 -0800137} // namespace ndn
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800138
Alexander Afanasyev766cea72014-04-24 19:16:42 -0700139#endif // NDN_CXX_HAVE_CXX11
Jeff Thompsona28eed82013-08-22 16:21:10 -0700140
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700141#include <boost/utility.hpp>
142
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700143namespace ndn {
Jeff Thompson9a8e82f2013-10-17 14:13:43 -0700144
Alexander Afanasyev233750e2014-02-16 00:50:07 -0800145using boost::noncopyable;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800146
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700147}
148
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700149#endif // NDN_COMMON_HPP