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
functor-hook.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20
#ifndef FUNCTOR_HOOK_H_
21
#define FUNCTOR_HOOK_H_
22
24
25
#include <boost/intrusive/parent_from_member.hpp>
26
27
namespace
ns3 {
28
namespace
ndn {
29
namespace
ndnSIM {
30
namespace
detail {
31
32
template
<
class
BaseHook,
class
ValueType,
int
N>
33
struct
FunctorHook {
34
typedef
typename
BaseHook::template index<N>::type hook_type;
35
typedef
hook_type* hook_ptr;
36
typedef
const
hook_type* const_hook_ptr;
37
38
typedef
ValueType value_type;
39
typedef
value_type* pointer;
40
typedef
const
value_type* const_pointer;
41
42
// Required static functions
43
static
hook_ptr
44
to_hook_ptr(value_type& value)
45
{
46
return
&value.policy_hook_.template get<N>();
47
}
48
49
static
const_hook_ptr
50
to_hook_ptr(
const
value_type& value)
51
{
52
return
&value.policy_hook_.template get<N>();
53
}
54
55
static
pointer
56
to_value_ptr(hook_ptr n)
57
{
58
return
boost::intrusive::get_parent_from_member<value_type>(
59
static_cast<
BaseHook*
>
(
60
boost::intrusive::get_parent_from_member<wrap<hook_type>>(n, &wrap<hook_type>::value_)),
61
&value_type::policy_hook_);
62
}
63
static
const_pointer
64
to_value_ptr(const_hook_ptr n)
65
{
66
return
boost::intrusive::get_parent_from_member<value_type>(
67
static_cast<
const
BaseHook*
>
(
68
boost::intrusive::get_parent_from_member<wrap<hook_type>>(n, &wrap<hook_type>::value_)),
69
&value_type::policy_hook_);
70
}
71
};
72
73
}
// detail
74
}
// ndnSIM
75
}
// ndn
76
}
// ns3
77
79
80
#endif // FUNCTOR_HOOK_H_
ndnSIM
utils
trie
detail
functor-hook.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7