NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
time-unit-test-clock.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_TIME_UNIT_TEST_CLOCK_HPP
23
#define NDN_TIME_UNIT_TEST_CLOCK_HPP
24
25
#include "
time-custom-clock.hpp
"
26
27
namespace
ndn
{
28
namespace
time
{
29
30
37
template
<
class
BaseClock>
38
class
UnitTestClockTraits
39
{
40
public
:
41
static
nanoseconds
42
getDefaultStartTime
()
43
{
44
return
nanoseconds::zero();
45
};
46
};
47
54
template
<>
55
class
UnitTestClockTraits
<
system_clock
>
56
{
57
public
:
58
static
nanoseconds
59
getDefaultStartTime
()
60
{
61
return
seconds(1415684132);
62
};
63
};
64
73
template
<
class
BaseClock>
74
class
UnitTestClock
:
public
CustomClock
<BaseClock>
75
{
76
public
:
77
explicit
78
UnitTestClock
(
const
nanoseconds& startTime =
79
UnitTestClockTraits<BaseClock>::getDefaultStartTime
());
80
84
void
85
advance(
const
nanoseconds& duration);
86
90
void
91
setNow(
const
nanoseconds& timeSinceEpoch);
92
93
public
:
// CustomClock<BaseClock>
94
95
virtual
std::string
96
getSince()
const
;
97
98
virtual
typename
BaseClock::time_point
99
getNow()
const
;
100
101
virtual
boost::posix_time::time_duration
102
toPosixDuration(
const
typename
BaseClock::duration& duration)
const
;
103
104
private
:
105
nanoseconds m_currentTime;
106
};
107
108
typedef
UnitTestClock<system_clock>
UnitTestSystemClock
;
109
typedef
UnitTestClock<steady_clock>
UnitTestSteadyClock
;
110
111
}
// namespace time
112
}
// namespace ndn
113
114
#endif // NDN_TIME_UNIT_TEST_CLOCK_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::time::UnitTestSystemClock
UnitTestClock< system_clock > UnitTestSystemClock
Definition:
time-unit-test-clock.hpp:108
ndn::time::CustomClock
Class implementing custom system or steady clock behavior.
Definition:
time-custom-clock.hpp:37
ndn::time
Definition:
time-custom-clock.hpp:28
ndn::time::UnitTestClock
Clock that can be used in unit tests for time-dependent tests independent of wall clock...
Definition:
time-unit-test-clock.hpp:74
ndn::time::system_clock
System clock.
Definition:
time.hpp:69
ndn::time::UnitTestSteadyClock
UnitTestClock< steady_clock > UnitTestSteadyClock
Definition:
time-unit-test-clock.hpp:109
time-custom-clock.hpp
ndn::time::UnitTestClockTraits::getDefaultStartTime
static nanoseconds getDefaultStartTime()
Definition:
time-unit-test-clock.hpp:42
ndn::time::UnitTestClockTraits< system_clock >::getDefaultStartTime
static nanoseconds getDefaultStartTime()
Definition:
time-unit-test-clock.hpp:59
ndn::time::UnitTestClockTraits
Traits for UnitTestClock, defining default behavior for different clocks.
Definition:
time-unit-test-clock.hpp:38
ndnSIM
ndn-cxx
src
util
time-unit-test-clock.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11