blob: 05c33194b907503f29b9860156946e0c61417d06 [file] [log] [blame]
Jeff Thompson25b4e612013-10-10 16:03:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Jeff Thompson47eecfc2013-07-07 22:56:46 -07002/**
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07003 * Copyright (c) 2013-2014, Regents of the University of California.
4 * All rights reserved.
5 *
6 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
7 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
8 *
9 * This file licensed under New BSD License. See COPYING for detailed information about
10 * ndn-cxx library copyright, permissions, and redistribution restrictions.
Jeff Thompson571f3522013-07-07 22:39:31 -070011 */
12
13#ifndef NDN_COMMON_HPP
14#define NDN_COMMON_HPP
15
Alexander Afanasyev766cea72014-04-24 19:16:42 -070016#include "ndn-cxx-config.hpp"
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -070017
Alexander Afanasyevd409d592014-01-28 18:36:38 -080018#include <stdint.h>
Alexander Afanasyevd409d592014-01-28 18:36:38 -080019#include <stddef.h>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080020#include <unistd.h>
21
Steve DiBenedettoc145d492014-03-11 16:35:45 -060022#if defined(__GNUC__) || defined(__clang__)
23#define DEPRECATED(func) func __attribute__ ((deprecated))
24#elif defined(_MSC_VER)
25#define DEPRECATED(func) __declspec(deprecated) func
26#else
27#pragma message("DEPRECATED not implemented")
28#define DEPRECATED(func) func
29#endif
30
Alexander Afanasyev766cea72014-04-24 19:16:42 -070031#ifdef NDN_CXX_HAVE_CXX11
Alexander Afanasyev472fa022014-01-07 13:30:49 -080032
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070033#if defined(__GNUC__)
34# if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070035# 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 -070036# endif // !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
37#endif // defined(__GNUC__)
38
39#if defined(__clang__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070040# 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 -070041#endif // defined(__clang__) && (__cplusplus < 201103L)
42
Alexander Afanasyev472fa022014-01-07 13:30:49 -080043
Jeff Thompson571f3522013-07-07 22:39:31 -070044#include <memory>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080045#include <functional>
Alexander Afanasyev19508852014-01-29 01:01:51 -080046
47namespace ndn {
48
49namespace ptr_lib = std;
Alexander Afanasyev8460afb2014-02-15 20:31:42 -080050namespace func_lib = std;
51
Alexander Afanasyev19508852014-01-29 01:01:51 -080052using std::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070053using std::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -080054using std::make_shared;
55using std::enable_shared_from_this;
56
Alexander Afanasyev15151312014-02-16 00:53:51 -080057using std::static_pointer_cast;
58using std::dynamic_pointer_cast;
59using std::const_pointer_cast;
60
Alexander Afanasyev19508852014-01-29 01:01:51 -080061using std::function;
62using std::bind;
Alexander Afanasyevb67090a2014-04-29 22:31:01 -070063using std::placeholders::_1;
64using std::placeholders::_2;
65using std::placeholders::_3;
66using std::placeholders::_4;
67using std::placeholders::_5;
68using std::placeholders::_6;
69using std::placeholders::_7;
70using std::placeholders::_8;
71using std::placeholders::_9;
72
73using std::ref;
74using std::cref;
Alexander Afanasyev19508852014-01-29 01:01:51 -080075
76} // namespace ndn
77
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080078
Alexander Afanasyevd409d592014-01-28 18:36:38 -080079#else
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080080
Jeff Thompson571f3522013-07-07 22:39:31 -070081#include <boost/shared_ptr.hpp>
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070082#include <boost/weak_ptr.hpp>
Alexander Afanasyevb790d952014-01-24 12:07:53 -080083#include <boost/enable_shared_from_this.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -070084#include <boost/make_shared.hpp>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080085
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080086#include <boost/function.hpp>
87#include <boost/bind.hpp>
Alexander Afanasyev19508852014-01-29 01:01:51 -080088
89namespace ndn {
90
91namespace ptr_lib = boost;
92namespace func_lib = boost;
93
94using boost::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070095using boost::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -080096using boost::make_shared;
97using boost::enable_shared_from_this;
98
Alexander Afanasyev15151312014-02-16 00:53:51 -080099using boost::static_pointer_cast;
100using boost::dynamic_pointer_cast;
101using boost::const_pointer_cast;
102
Alexander Afanasyev19508852014-01-29 01:01:51 -0800103using boost::function;
104using boost::bind;
105
Alexander Afanasyevb67090a2014-04-29 22:31:01 -0700106using boost::ref;
107using boost::cref;
108
Alexander Afanasyev19508852014-01-29 01:01:51 -0800109} // namespace ndn
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800110
Alexander Afanasyev766cea72014-04-24 19:16:42 -0700111#endif // NDN_CXX_HAVE_CXX11
Jeff Thompsona28eed82013-08-22 16:21:10 -0700112
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700113#include <boost/utility.hpp>
114
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700115namespace ndn {
Jeff Thompson9a8e82f2013-10-17 14:13:43 -0700116
Alexander Afanasyev233750e2014-02-16 00:50:07 -0800117using boost::noncopyable;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800118
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700119}
120
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700121#endif // NDN_COMMON_HPP