blob: 06b8ede2ca27ca7e0f637286ac6344c82da385c7 [file] [log] [blame]
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shifc2e13d2017-07-25 02:08:48 +00002/*
Davide Pesavento2c9d2ca2024-01-27 16:36:51 -05003 * Copyright (c) 2014-2024, Regents of the University of California,
Junxiao Shia37405d2015-01-26 10:50:58 -07004 * 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.
Alexander Afanasyev9bcbc7c2014-04-06 19:37:37 -070010 *
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/>.
Junxiao Shi5dd26c32014-07-20 23:15:14 -070024 */
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080025
Junxiao Shi9f5b01d2016-08-05 03:54:28 +000026#ifndef NFD_CORE_COMMON_HPP
27#define NFD_CORE_COMMON_HPP
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080028
Junxiao Shi9f5b01d2016-08-05 03:54:28 +000029#include "core/config.hpp"
Junxiao Shi61c5ef32014-01-24 20:59:30 -070030
Davide Pesavento264af772021-02-09 21:48:24 -050031#ifdef NFD_WITH_TESTS
32#define NFD_VIRTUAL_WITH_TESTS virtual
33#define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED public
34#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE public
35#define NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE protected
36#define NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL override
37#define NFD_FINAL_UNLESS_WITH_TESTS
Junxiao Shi88884492014-02-15 15:57:43 -070038#else
Davide Pesavento264af772021-02-09 21:48:24 -050039#define NFD_VIRTUAL_WITH_TESTS
40#define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED protected
41#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE private
42#define NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE private
43#define NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL final
44#define NFD_FINAL_UNLESS_WITH_TESTS final
Junxiao Shi88884492014-02-15 15:57:43 -070045#endif
46
Junxiao Shi5dd26c32014-07-20 23:15:14 -070047#include <cstddef>
Davide Pesaventod2856a42015-09-19 21:29:50 +020048#include <cstdint>
Davide Pesaventod2856a42015-09-19 21:29:50 +020049#include <memory>
Davide Pesaventob7bfcb92022-05-22 23:55:23 -040050#include <optional>
Davide Pesaventoc0822fa2018-05-10 21:54:10 -040051#include <stdexcept>
Davide Pesaventod2856a42015-09-19 21:29:50 +020052#include <string>
Davide Pesaventoa3a7a4e2022-05-29 16:06:22 -040053#include <string_view>
Davide Pesaventod2856a42015-09-19 21:29:50 +020054#include <utility>
Alexander Afanasyev8552a382014-05-15 20:13:42 -070055#include <vector>
56
Alexander Afanasyev4a771362014-04-24 21:29:33 -070057#include <ndn-cxx/data.hpp>
Junxiao Shi83be1da2017-06-30 13:37:37 +000058#include <ndn-cxx/interest.hpp>
Davide Pesaventod2856a42015-09-19 21:29:50 +020059#include <ndn-cxx/name.hpp>
60#include <ndn-cxx/encoding/block.hpp>
Eric Newberrya98bf932015-09-21 00:58:47 -070061#include <ndn-cxx/lp/nack.hpp>
Davide Pesavento01f8dba2015-09-19 21:11:45 +020062#include <ndn-cxx/util/backports.hpp>
Davide Pesavento19779d82019-02-14 13:40:04 -050063#include <ndn-cxx/util/exception.hpp>
Junxiao Shi1e064172014-12-14 19:37:46 -070064#include <ndn-cxx/util/signal.hpp>
Junxiao Shi727b6102022-01-11 18:40:04 +000065#include <ndn-cxx/util/span.hpp>
Davide Pesavento3dade002019-03-19 11:29:56 -060066#include <ndn-cxx/util/time.hpp>
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080067
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080068#include <boost/assert.hpp>
Davide Pesavento17521592020-05-14 19:01:32 -040069#include <boost/core/noncopyable.hpp>
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080070
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080071namespace nfd {
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080072
Junxiao Shi5dd26c32014-07-20 23:15:14 -070073using std::size_t;
74
Davide Pesaventoab1e8f22014-10-21 22:45:33 +020075using std::shared_ptr;
76using std::unique_ptr;
77using std::weak_ptr;
Davide Pesaventoab1e8f22014-10-21 22:45:33 +020078using std::make_shared;
Davide Pesaventoc0822fa2018-05-10 21:54:10 -040079using std::make_unique;
Davide Pesaventoab1e8f22014-10-21 22:45:33 +020080
Davide Pesaventoe4b22382018-06-10 14:37:24 -040081using namespace std::string_literals;
Davide Pesaventoa3a7a4e2022-05-29 16:06:22 -040082using namespace std::string_view_literals;
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -080083
Davide Pesavento40641272023-03-16 13:31:12 -040084using boost::noncopyable;
Davide Pesaventoec2a6982015-09-18 23:59:17 +020085
Davide Pesavento40641272023-03-16 13:31:12 -040086using ndn::span;
Junxiao Shi83be1da2017-06-30 13:37:37 +000087using ndn::Block;
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080088using ndn::Data;
Junxiao Shi83be1da2017-06-30 13:37:37 +000089using ndn::Interest;
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080090using ndn::Name;
Yanbiao Li698f4fe2015-08-19 16:30:16 -070091using ndn::PartialName;
Davide Pesavento52a18f92014-04-10 00:55:01 +020092
Davide Pesavento15b55052018-01-27 19:09:28 -050093// Not using a namespace alias (namespace tlv = ndn::tlv), because
94// it doesn't allow NFD to add other members to the namespace
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080095namespace tlv {
Junxiao Shi67f11ac2014-10-19 09:29:13 -070096using namespace ndn::tlv;
97} // namespace tlv
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080098
Eric Newberrya98bf932015-09-21 00:58:47 -070099namespace lp = ndn::lp;
Davide Pesavento52a18f92014-04-10 00:55:01 +0200100namespace name = ndn::name;
Davide Pesaventoae430302023-05-11 01:42:46 -0400101namespace signal = ndn::signal;
Davide Pesavento15b55052018-01-27 19:09:28 -0500102namespace time = ndn::time;
Davide Pesavento40641272023-03-16 13:31:12 -0400103
Davide Pesavento191a7a22023-05-17 22:40:43 -0400104using namespace ndn::block_literals;
105using namespace ndn::time_literals;
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -0700106
Alexander Afanasyev18bbf812014-01-29 01:40:23 -0800107} // namespace nfd
Alexander Afanasyevb927a3a2014-01-24 10:41:47 -0800108
Junxiao Shi9f5b01d2016-08-05 03:54:28 +0000109#endif // NFD_CORE_COMMON_HPP