blob: f8f42555e9c8acfef584fc2ee11bd79a3c7791b7 [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 Afanasyev766cea72014-04-24 19:16:42 -07003 * Copyright (C) 2013-2014 Regents of the University of California.
Jeff Thompson47eecfc2013-07-07 22:56:46 -07004 * See COPYING for copyright and distribution information.
Jeff Thompson571f3522013-07-07 22:39:31 -07005 */
6
7#ifndef NDN_COMMON_HPP
8#define NDN_COMMON_HPP
9
Alexander Afanasyev766cea72014-04-24 19:16:42 -070010#include "ndn-cxx-config.hpp"
Alexander Afanasyevd409d592014-01-28 18:36:38 -080011#include <stdint.h>
12// TODO: Is stddef.h portable?
13#include <stddef.h>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080014#include <unistd.h>
15
16// Standard headers to precompile
Alexander Afanasyevd409d592014-01-28 18:36:38 -080017
Jeff Thompson51dd5fd2013-07-10 19:27:18 -070018#include <vector>
Alexander Afanasyev19508852014-01-29 01:01:51 -080019#include <list>
20#include <set>
21#include <algorithm>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080022#include <map>
23#include <sstream>
24#include <fstream>
25#include <exception>
26#include <map>
27
28// Other useful headers to precompile
29#include <boost/lexical_cast.hpp>
30#include <boost/asio.hpp>
31#include <boost/date_time/posix_time/posix_time.hpp>
Alexander Afanasyev233750e2014-02-16 00:50:07 -080032#include <boost/utility.hpp>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080033
34#include <boost/iostreams/detail/ios.hpp>
35#include <boost/iostreams/categories.hpp>
36#include <boost/iostreams/stream.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -070037
Steve DiBenedettoc145d492014-03-11 16:35:45 -060038#if defined(__GNUC__) || defined(__clang__)
39#define DEPRECATED(func) func __attribute__ ((deprecated))
40#elif defined(_MSC_VER)
41#define DEPRECATED(func) __declspec(deprecated) func
42#else
43#pragma message("DEPRECATED not implemented")
44#define DEPRECATED(func) func
45#endif
46
Alexander Afanasyev766cea72014-04-24 19:16:42 -070047#ifdef NDN_CXX_HAVE_CXX11
Alexander Afanasyev472fa022014-01-07 13:30:49 -080048
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070049#if defined(__GNUC__)
50# if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070051# 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 -070052# endif // !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
53#endif // defined(__GNUC__)
54
55#if defined(__clang__) && __cplusplus < 201103L
Alexander Afanasyev766cea72014-04-24 19:16:42 -070056# 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 -070057#endif // defined(__clang__) && (__cplusplus < 201103L)
58
Alexander Afanasyev472fa022014-01-07 13:30:49 -080059
Jeff Thompson571f3522013-07-07 22:39:31 -070060#include <memory>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080061#include <functional>
Alexander Afanasyev19508852014-01-29 01:01:51 -080062
63namespace ndn {
64
65namespace ptr_lib = std;
Alexander Afanasyev8460afb2014-02-15 20:31:42 -080066namespace func_lib = std;
67
Alexander Afanasyev19508852014-01-29 01:01:51 -080068using std::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070069using std::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -080070using std::make_shared;
71using std::enable_shared_from_this;
72
Alexander Afanasyev15151312014-02-16 00:53:51 -080073using std::static_pointer_cast;
74using std::dynamic_pointer_cast;
75using std::const_pointer_cast;
76
Alexander Afanasyev19508852014-01-29 01:01:51 -080077using std::function;
78using std::bind;
79using std::placeholders; // _1, _2, ..
80
81} // namespace ndn
82
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080083
Alexander Afanasyevd409d592014-01-28 18:36:38 -080084#else
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080085
Jeff Thompson571f3522013-07-07 22:39:31 -070086#include <boost/shared_ptr.hpp>
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070087#include <boost/weak_ptr.hpp>
Alexander Afanasyevb790d952014-01-24 12:07:53 -080088#include <boost/enable_shared_from_this.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -070089#include <boost/make_shared.hpp>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080090
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080091#include <boost/function.hpp>
92#include <boost/bind.hpp>
Alexander Afanasyev19508852014-01-29 01:01:51 -080093
94namespace ndn {
95
96namespace ptr_lib = boost;
97namespace func_lib = boost;
98
99using boost::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700100using boost::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800101using boost::make_shared;
102using boost::enable_shared_from_this;
103
Alexander Afanasyev15151312014-02-16 00:53:51 -0800104using boost::static_pointer_cast;
105using boost::dynamic_pointer_cast;
106using boost::const_pointer_cast;
107
Alexander Afanasyev19508852014-01-29 01:01:51 -0800108using boost::function;
109using boost::bind;
110
111} // namespace ndn
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800112
Alexander Afanasyev766cea72014-04-24 19:16:42 -0700113#endif // NDN_CXX_HAVE_CXX11
Jeff Thompsona28eed82013-08-22 16:21:10 -0700114
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 Afanasyev809805d2014-02-17 17:20:33 -0800121#include "util/time.hpp"
122
Jeff Thompson571f3522013-07-07 22:39:31 -0700123#endif