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
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
q
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
n
p
r
s
t
u
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
tag-host.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_TAG_HOST_HPP
23
#define NDN_TAG_HOST_HPP
24
25
#include "
common.hpp
"
26
#include "
tag.hpp
"
27
28
#include <map>
29
30
namespace
ndn
{
31
34
class
TagHost
35
{
36
public
:
41
template
<
typename
T>
42
shared_ptr<T>
43
getTag
()
const
;
44
49
template
<
typename
T>
50
void
51
setTag
(shared_ptr<T> tag)
const
;
52
56
template
<
typename
T>
57
void
58
removeTag
()
const
;
59
60
private
:
61
mutable
std::map<size_t, shared_ptr<Tag>> m_tags;
62
};
63
64
65
template
<
typename
T>
66
inline
shared_ptr<T>
67
TagHost::getTag
()
const
68
{
69
static_assert(std::is_base_of<Tag, T>::value,
"T must inherit from Tag"
);
70
71
auto
it = m_tags.find(T::getTypeId());
72
if
(it == m_tags.end()) {
73
return
nullptr
;
74
}
75
return
static_pointer_cast<T>(it->second);
76
}
77
78
template
<
typename
T>
79
inline
void
80
TagHost::setTag
(shared_ptr<T> tag)
const
81
{
82
static_assert(std::is_base_of<Tag, T>::value,
"T must inherit from Tag"
);
83
84
if
(tag ==
nullptr
) {
85
m_tags.erase(T::getTypeId());
86
return
;
87
}
88
89
m_tags[T::getTypeId()] = tag;
90
}
91
92
template
<
typename
T>
93
inline
void
94
TagHost::removeTag
()
const
95
{
96
setTag<T>(
nullptr
);
97
}
98
99
}
// namespace ndn
100
101
#endif // NDN_TAG_HOST_HPP
ndn::TagHost::setTag
void setTag(shared_ptr< T > tag) const
set a tag item
Definition:
tag-host.hpp:80
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::TagHost::getTag
shared_ptr< T > getTag() const
get a tag item
Definition:
tag-host.hpp:67
ndn::TagHost::removeTag
void removeTag() const
remove tag item
Definition:
tag-host.hpp:94
ndn::TagHost
Base class to store tag information (e.g., inside Interest and Data packets)
Definition:
tag-host.hpp:34
common.hpp
import common constructs for ndn-cxx library internal use
tag.hpp
ndnSIM
ndn-cxx
src
tag-host.hpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14