blob: ed2bf191ec788c9448e8303abcd3780660d69136 [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 Afanasyevd409d592014-01-28 18:36:38 -080017#include <stdint.h>
18// TODO: Is stddef.h portable?
19#include <stddef.h>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080020#include <unistd.h>
21
22// Standard headers to precompile
Alexander Afanasyevd409d592014-01-28 18:36:38 -080023
Jeff Thompson51dd5fd2013-07-10 19:27:18 -070024#include <vector>
Alexander Afanasyev19508852014-01-29 01:01:51 -080025#include <list>
26#include <set>
27#include <algorithm>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080028#include <map>
29#include <sstream>
30#include <fstream>
31#include <exception>
32#include <map>
33
34// Other useful headers to precompile
35#include <boost/lexical_cast.hpp>
36#include <boost/asio.hpp>
37#include <boost/date_time/posix_time/posix_time.hpp>
Alexander Afanasyev233750e2014-02-16 00:50:07 -080038#include <boost/utility.hpp>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080039
40#include <boost/iostreams/detail/ios.hpp>
41#include <boost/iostreams/categories.hpp>
42#include <boost/iostreams/stream.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -070043
Steve DiBenedettoc145d492014-03-11 16:35:45 -060044#if defined(__GNUC__) || defined(__clang__)
45#define DEPRECATED(func) func __attribute__ ((deprecated))
46#elif defined(_MSC_VER)
47#define DEPRECATED(func) __declspec(deprecated) func
48#else
49#pragma message("DEPRECATED not implemented")
50#define DEPRECATED(func) func
51#endif
52
Alexander Afanasyev766cea72014-04-24 19:16:42 -070053#ifdef NDN_CXX_HAVE_CXX11
Alexander Afanasyev472fa022014-01-07 13:30:49 -080054
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070055#if defined(__GNUC__)
56# if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070057# 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 -070058# endif // !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
59#endif // defined(__GNUC__)
60
61#if defined(__clang__) && __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(__clang__) && (__cplusplus < 201103L)
64
Alexander Afanasyev472fa022014-01-07 13:30:49 -080065
Jeff Thompson571f3522013-07-07 22:39:31 -070066#include <memory>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080067#include <functional>
Alexander Afanasyev19508852014-01-29 01:01:51 -080068
69namespace ndn {
70
71namespace ptr_lib = std;
Alexander Afanasyev8460afb2014-02-15 20:31:42 -080072namespace func_lib = std;
73
Alexander Afanasyev19508852014-01-29 01:01:51 -080074using std::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070075using std::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;
94
95using std::ref;
96using std::cref;
Alexander Afanasyev19508852014-01-29 01:01:51 -080097
98} // namespace ndn
99
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800100
Alexander Afanasyevd409d592014-01-28 18:36:38 -0800101#else
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800102
Jeff Thompson571f3522013-07-07 22:39:31 -0700103#include <boost/shared_ptr.hpp>
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700104#include <boost/weak_ptr.hpp>
Alexander Afanasyevb790d952014-01-24 12:07:53 -0800105#include <boost/enable_shared_from_this.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -0700106#include <boost/make_shared.hpp>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800107
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800108#include <boost/function.hpp>
109#include <boost/bind.hpp>
Alexander Afanasyev19508852014-01-29 01:01:51 -0800110
111namespace ndn {
112
113namespace ptr_lib = boost;
114namespace func_lib = boost;
115
116using boost::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700117using boost::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800118using boost::make_shared;
119using boost::enable_shared_from_this;
120
Alexander Afanasyev15151312014-02-16 00:53:51 -0800121using boost::static_pointer_cast;
122using boost::dynamic_pointer_cast;
123using boost::const_pointer_cast;
124
Alexander Afanasyev19508852014-01-29 01:01:51 -0800125using boost::function;
126using boost::bind;
127
Alexander Afanasyevb67090a2014-04-29 22:31:01 -0700128using boost::ref;
129using boost::cref;
130
Alexander Afanasyev19508852014-01-29 01:01:51 -0800131} // namespace ndn
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800132
Alexander Afanasyev766cea72014-04-24 19:16:42 -0700133#endif // NDN_CXX_HAVE_CXX11
Jeff Thompsona28eed82013-08-22 16:21:10 -0700134
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700135namespace ndn {
Jeff Thompson9a8e82f2013-10-17 14:13:43 -0700136
Alexander Afanasyev233750e2014-02-16 00:50:07 -0800137using boost::noncopyable;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800138
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700139}
140
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800141#include "util/time.hpp"
142
Jeff Thompson571f3522013-07-07 22:39:31 -0700143#endif