blob: bed6c3c46ebdf1697658f3e75e78c3242d7f1e72 [file] [log] [blame]
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
* See COPYING for copyright and distribution information.
*/
#ifndef NDN_COMMON_HPP
#define NDN_COMMON_HPP
#include "ndn-cpp-config.h"
#include <stdint.h>
// TODO: Is stddef.h portable?
#include <stddef.h>
#include <unistd.h>
// Standard headers to precompile
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <map>
#include <sstream>
#include <fstream>
#include <exception>
#include <map>
// Other useful headers to precompile
#include <boost/lexical_cast.hpp>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/iostreams/detail/ios.hpp>
#include <boost/iostreams/categories.hpp>
#include <boost/iostreams/stream.hpp>
#if NDN_CPP_HAVE_CXX11
#if (__cplusplus < 201103L)
#error "NDN-CPP-DEV library is configured and compiled in C++11 mode, but the current compiler is not C++11 enabled"
#endif
#include <memory>
#include <functional>
namespace ndn {
namespace ptr_lib = std;
namespace func_lib = std;
using std::noncopyable;
using std::shared_ptr;
using std::make_shared;
using std::enable_shared_from_this;
using std::function;
using std::bind;
using std::placeholders; // _1, _2, ..
} // namespace ndn
#else
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/make_shared.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
namespace ndn {
namespace ptr_lib = boost;
namespace func_lib = boost;
using boost::noncopyable;
using boost::shared_ptr;
using boost::make_shared;
using boost::enable_shared_from_this;
using boost::function;
using boost::bind;
} // namespace ndn
#endif
namespace ndn {
/**
* A time interval represented as the number of milliseconds.
*/
typedef int64_t Milliseconds;
/**
* The calendar time represented as the number of milliseconds since 1/1/1970.
*/
typedef int64_t MillisecondsSince1970;
/**
* Return the hex representation of the bytes in array.
* @param array The array of bytes.
* @return Hex string.
*/
std::string
toHex(const std::vector<uint8_t>& array);
MillisecondsSince1970
getNow();
}
#endif