NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
common.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2018, Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef NFD_CORE_COMMON_HPP
27 #define NFD_CORE_COMMON_HPP
28 
29 #include "core/config.hpp"
30 
31 #ifdef WITH_TESTS
32 #define VIRTUAL_WITH_TESTS virtual
33 #define PUBLIC_WITH_TESTS_ELSE_PROTECTED public
34 #define PUBLIC_WITH_TESTS_ELSE_PRIVATE public
35 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
36 #define FINAL_UNLESS_WITH_TESTS
37 #else
38 #define VIRTUAL_WITH_TESTS
39 #define PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
40 #define PUBLIC_WITH_TESTS_ELSE_PRIVATE private
41 #define PROTECTED_WITH_TESTS_ELSE_PRIVATE private
42 #define FINAL_UNLESS_WITH_TESTS final
43 #endif
44 
45 #include <cstddef>
46 #include <cstdint>
47 #include <functional>
48 #include <limits>
49 #include <list>
50 #include <map>
51 #include <memory>
52 #include <set>
53 #include <string>
54 #include <unordered_map>
55 #include <unordered_set>
56 #include <utility>
57 #include <vector>
58 
59 #include <ndn-cxx/data.hpp>
60 #include <ndn-cxx/delegation.hpp>
61 #include <ndn-cxx/delegation-list.hpp>
62 #include <ndn-cxx/interest.hpp>
63 #include <ndn-cxx/name.hpp>
64 #include <ndn-cxx/encoding/block.hpp>
65 #include <ndn-cxx/lp/nack.hpp>
66 #include <ndn-cxx/net/face-uri.hpp>
67 #include <ndn-cxx/util/backports.hpp>
68 #include <ndn-cxx/util/signal.hpp>
69 
70 #include <boost/asio.hpp>
71 #include <boost/assert.hpp>
72 #include <boost/lexical_cast.hpp>
73 #include <boost/noncopyable.hpp>
74 #include <boost/property_tree/ptree.hpp>
75 #include <boost/throw_exception.hpp>
76 
77 namespace nfd {
78 
79 using std::size_t;
80 
81 using boost::noncopyable;
82 
83 using std::shared_ptr;
84 using std::unique_ptr;
85 using std::weak_ptr;
86 using std::make_shared;
87 using ndn::make_unique;
88 using std::enable_shared_from_this;
89 
90 using std::static_pointer_cast;
91 using std::dynamic_pointer_cast;
92 using std::const_pointer_cast;
93 
94 using std::bind;
95 using std::cref;
96 using std::ref;
97 
98 using ndn::optional;
99 using ndn::nullopt;
100 using ndn::to_string;
101 
102 using ndn::Block;
103 using ndn::Data;
104 using ndn::Delegation;
105 using ndn::DelegationList;
106 using ndn::FaceUri;
107 using ndn::Interest;
108 using ndn::Name;
109 using ndn::PartialName;
110 
111 // Not using a namespace alias (namespace tlv = ndn::tlv), because
112 // it doesn't allow NFD to add other members to the namespace
113 namespace tlv {
114 using namespace ndn::tlv;
115 } // namespace tlv
116 
117 namespace lp = ndn::lp;
118 namespace name = ndn::name;
119 namespace signal = ndn::util::signal;
120 namespace time = ndn::time;
121 using namespace ndn::time_literals;
122 
123 } // namespace nfd
124 
125 #endif // NFD_CORE_COMMON_HPP
constexpr nullopt_t nullopt
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
represents a delegation
Definition: delegation.hpp:32
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
Name PartialName
Represents an arbitrary sequence of name components.
Definition: name.hpp:38
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
Namespace defining NDN Packet Format related constants and procedures.
Definition: tlv-nfd.hpp:29
represents a list of Delegations
std::string to_string(const V &v)
Definition: backports.hpp:107
unique_ptr< T > make_unique(Args &&... args)
Definition: backports.hpp:96