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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
multi-type-container.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#ifndef MULTI_TYPE_CONTAINER_H_
21
#define MULTI_TYPE_CONTAINER_H_
22
24
25
#include <boost/mpl/inherit_linearly.hpp>
26
#include <boost/mpl/inherit.hpp>
27
#include <boost/mpl/at.hpp>
28
29
namespace
ns3 {
30
namespace
ndn {
31
namespace
ndnSIM {
32
namespace
detail {
33
34
template
<
class
T>
35
struct
wrap {
36
T value_;
37
};
38
39
template
<
class
Vector>
40
struct
multi_type_container
41
:
public
boost::mpl::inherit_linearly<Vector, boost::mpl::inherit<wrap<boost::mpl::_2>,
42
boost::mpl::_1>>::type {
43
template
<
int
N>
44
struct
index {
45
typedef
typename
boost::mpl::at_c<Vector, N>::type type;
46
};
47
48
template
<
class
T>
49
T&
50
get
()
51
{
52
return
static_cast<
wrap<T>&
>
(*this).value_;
53
}
54
55
template
<
class
T>
56
const
T&
57
get
()
const
58
{
59
return
static_cast<
const
wrap<T>&
>
(*this).value_;
60
}
61
62
template
<
int
N>
63
typename
boost::mpl::at_c<Vector, N>::type&
64
get
()
65
{
66
typedef
typename
boost::mpl::at_c<Vector, N>::type T;
67
return
static_cast<
wrap<T>&
>
(*this).value_;
68
}
69
70
template
<
int
N>
71
const
typename
boost::mpl::at_c<Vector, N>::type&
72
get
()
const
73
{
74
typedef
typename
boost::mpl::at_c<Vector, N>::type T;
75
return
static_cast<
const
wrap<T>&
>
(*this).value_;
76
}
77
};
78
79
}
// detail
80
}
// ndnSIM
81
}
// ndn
82
}
// ns3
83
85
86
#endif // MULTI_TYPE_CONTAINER_H_
ndnSIM
utils
trie
detail
multi-type-container.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7