blob: b6de7b961dda45453f48f1b830063af21708e24f [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/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07003 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson47eecfc2013-07-07 22:56:46 -07005 * See COPYING for copyright and distribution information.
Jeff Thompson571f3522013-07-07 22:39:31 -07006 */
7
8#ifndef NDN_COMMON_HPP
9#define NDN_COMMON_HPP
10
Alexander Afanasyev1160baa2014-04-10 18:50:29 -070011#include "ndn-cpp-config.hpp"
Alexander Afanasyevd409d592014-01-28 18:36:38 -080012#include <stdint.h>
13// TODO: Is stddef.h portable?
14#include <stddef.h>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080015#include <unistd.h>
16
17// Standard headers to precompile
Alexander Afanasyevd409d592014-01-28 18:36:38 -080018
Jeff Thompson51dd5fd2013-07-10 19:27:18 -070019#include <vector>
Alexander Afanasyev19508852014-01-29 01:01:51 -080020#include <list>
21#include <set>
22#include <algorithm>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080023#include <map>
24#include <sstream>
25#include <fstream>
26#include <exception>
27#include <map>
28
29// Other useful headers to precompile
30#include <boost/lexical_cast.hpp>
31#include <boost/asio.hpp>
32#include <boost/date_time/posix_time/posix_time.hpp>
Alexander Afanasyev233750e2014-02-16 00:50:07 -080033#include <boost/utility.hpp>
Alexander Afanasyeve2dcdfd2014-02-07 15:53:28 -080034
35#include <boost/iostreams/detail/ios.hpp>
36#include <boost/iostreams/categories.hpp>
37#include <boost/iostreams/stream.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -070038
Steve DiBenedettoc145d492014-03-11 16:35:45 -060039#if defined(__GNUC__) || defined(__clang__)
40#define DEPRECATED(func) func __attribute__ ((deprecated))
41#elif defined(_MSC_VER)
42#define DEPRECATED(func) __declspec(deprecated) func
43#else
44#pragma message("DEPRECATED not implemented")
45#define DEPRECATED(func) func
46#endif
47
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070048#ifdef NDN_CPP_HAVE_CXX11
Alexander Afanasyev472fa022014-01-07 13:30:49 -080049
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070050#if defined(__GNUC__)
51# if !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
52# error "NDN-CPP-DEV library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled"
53# endif // !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
54#endif // defined(__GNUC__)
55
56#if defined(__clang__) && __cplusplus < 201103L
57# error "NDN-CPP-DEV library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled"
58#endif // defined(__clang__) && (__cplusplus < 201103L)
59
Alexander Afanasyev472fa022014-01-07 13:30:49 -080060
Jeff Thompson571f3522013-07-07 22:39:31 -070061#include <memory>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080062#include <functional>
Alexander Afanasyev19508852014-01-29 01:01:51 -080063
64namespace ndn {
65
66namespace ptr_lib = std;
Alexander Afanasyev8460afb2014-02-15 20:31:42 -080067namespace func_lib = std;
68
Alexander Afanasyev19508852014-01-29 01:01:51 -080069using std::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070070using std::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -080071using std::make_shared;
72using std::enable_shared_from_this;
73
Alexander Afanasyev15151312014-02-16 00:53:51 -080074using std::static_pointer_cast;
75using std::dynamic_pointer_cast;
76using std::const_pointer_cast;
77
Alexander Afanasyev19508852014-01-29 01:01:51 -080078using std::function;
79using std::bind;
80using std::placeholders; // _1, _2, ..
81
82} // namespace ndn
83
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080084
Alexander Afanasyevd409d592014-01-28 18:36:38 -080085#else
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080086
Jeff Thompson571f3522013-07-07 22:39:31 -070087#include <boost/shared_ptr.hpp>
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -070088#include <boost/weak_ptr.hpp>
Alexander Afanasyevb790d952014-01-24 12:07:53 -080089#include <boost/enable_shared_from_this.hpp>
Jeff Thompson571f3522013-07-07 22:39:31 -070090#include <boost/make_shared.hpp>
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080091
Alexander Afanasyev0541cf42014-01-02 19:10:37 -080092#include <boost/function.hpp>
93#include <boost/bind.hpp>
Alexander Afanasyev19508852014-01-29 01:01:51 -080094
95namespace ndn {
96
97namespace ptr_lib = boost;
98namespace func_lib = boost;
99
100using boost::shared_ptr;
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700101using boost::weak_ptr;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800102using boost::make_shared;
103using boost::enable_shared_from_this;
104
Alexander Afanasyev15151312014-02-16 00:53:51 -0800105using boost::static_pointer_cast;
106using boost::dynamic_pointer_cast;
107using boost::const_pointer_cast;
108
Alexander Afanasyev19508852014-01-29 01:01:51 -0800109using boost::function;
110using boost::bind;
111
112} // namespace ndn
Alexander Afanasyev0541cf42014-01-02 19:10:37 -0800113
Alexander Afanasyevb78bc4d2014-04-09 21:20:52 -0700114#endif // NDN_CPP_HAVE_CXX11
Jeff Thompsona28eed82013-08-22 16:21:10 -0700115
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700116namespace ndn {
Jeff Thompson9a8e82f2013-10-17 14:13:43 -0700117
Alexander Afanasyev233750e2014-02-16 00:50:07 -0800118using boost::noncopyable;
Alexander Afanasyev19508852014-01-29 01:01:51 -0800119
Jeff Thompson51dd5fd2013-07-10 19:27:18 -0700120}
121
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800122#include "util/time.hpp"
123
Jeff Thompson571f3522013-07-07 22:39:31 -0700124#endif