blob: d15a8edb187daad9bf1ccd09986d282a98ccc8cf [file] [log] [blame]
Davide Pesaventof91d1df2020-11-25 14:50:41 -05001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013-2020 Regents of the University of California
4 * The University of Memphis
5 *
6 * This file is part of PSync.
7 *
8 * PSync is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU Lesser General Public License as published by the Free Software Foundation, either
10 * version 3 of the License, or (at your option) any later version.
11 *
12 * PSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License along with
17 * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PSYNC_TESTS_IO_FIXTURE_HPP
21#define PSYNC_TESTS_IO_FIXTURE_HPP
22
23#include "tests/clock-fixture.hpp"
24
25#include <boost/asio/io_service.hpp>
26
27namespace ndn {
28namespace tests {
29
30class IoFixture : public ClockFixture
31{
32private:
33 void
34 afterTick() final
35 {
36 if (m_io.stopped()) {
37#if BOOST_VERSION >= 106600
38 m_io.restart();
39#else
40 m_io.reset();
41#endif
42 }
43 m_io.poll();
44 }
45
46protected:
47 boost::asio::io_service m_io;
48};
49
50} // namespace tests
51} // namespace ndn
52
53#endif // PSYNC_TESTS_IO_FIXTURE_HPP