NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
h
i
k
l
n
o
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
f
i
k
l
n
p
q
r
s
t
u
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Enumerations
+
Enumerator
a
c
d
e
i
k
l
m
n
p
r
s
u
w
+
Related Functions
b
c
d
e
f
g
i
k
l
m
n
o
p
s
v
+
Files
File List
+
File Members
+
All
a
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
+
Functions
c
f
h
m
r
s
u
w
+
Variables
a
c
d
f
g
i
k
l
m
n
p
r
s
t
Typedefs
+
Macros
d
e
f
i
l
m
n
p
r
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
strategy-info-host.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_TABLE_STRATEGY_INFO_HOST_HPP
27
#define NFD_DAEMON_TABLE_STRATEGY_INFO_HOST_HPP
28
29
#include "
fw/strategy-info.hpp
"
30
31
namespace
nfd
{
32
35
class
StrategyInfoHost
36
{
37
public
:
42
template
<
typename
T>
43
T*
44
getStrategyInfo
()
const
45
{
46
static_assert(std::is_base_of<fw::StrategyInfo, T>::value,
47
"T must inherit from StrategyInfo"
);
48
49
auto
it = m_items.find(T::getTypeId());
50
if
(it == m_items.end()) {
51
return
nullptr
;
52
}
53
return
static_cast<
T*
>
(it->second.get());
54
}
55
61
template
<
typename
T,
typename
...A>
62
std::pair<T*, bool>
63
insertStrategyInfo
(A&&... args)
64
{
65
static_assert(std::is_base_of<fw::StrategyInfo, T>::value,
66
"T must inherit from StrategyInfo"
);
67
68
unique_ptr<fw::StrategyInfo>& item = m_items[T::getTypeId()];
69
bool
isNew = (item ==
nullptr
);
70
if
(isNew) {
71
item.reset(
new
T(std::forward<A>(args)...));
72
}
73
return
{
static_cast<
T*
>
(item.get()), isNew};
74
}
75
80
template
<
typename
T>
81
size_t
82
eraseStrategyInfo
()
83
{
84
static_assert(std::is_base_of<fw::StrategyInfo, T>::value,
85
"T must inherit from StrategyInfo"
);
86
87
return
m_items.erase(T::getTypeId());
88
}
89
92
void
93
clearStrategyInfo
();
94
95
private
:
96
std::unordered_map<int, unique_ptr<fw::StrategyInfo>> m_items;
97
};
98
99
}
// namespace nfd
100
101
#endif // NFD_DAEMON_TABLE_STRATEGY_INFO_HOST_HPP
nfd::StrategyInfoHost::eraseStrategyInfo
size_t eraseStrategyInfo()
erase a StrategyInfo item
Definition:
strategy-info-host.hpp:82
nfd::StrategyInfoHost
base class for an entity onto which StrategyInfo items may be placed
Definition:
strategy-info-host.hpp:35
strategy-info.hpp
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::StrategyInfoHost::clearStrategyInfo
void clearStrategyInfo()
clear all StrategyInfo items
Definition:
strategy-info-host.cpp:31
nfd::StrategyInfoHost::insertStrategyInfo
std::pair< T *, bool > insertStrategyInfo(A &&... args)
insert a StrategyInfo item
Definition:
strategy-info-host.hpp:63
nfd::StrategyInfoHost::getStrategyInfo
T * getStrategyInfo() const
get a StrategyInfo item
Definition:
strategy-info-host.hpp:44
ndnSIM
NFD
daemon
table
strategy-info-host.hpp
Generated on Tue Aug 7 2018 16:19:18 for ndnSIM by
1.8.14