A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
qkd-control-container.h
Go to the documentation of this file.
1
/*
2
* Copyright(c) 2020 DOTFEESA www.tk.etf.unsa.ba
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*
7
*
8
* Author: Miralem Mehic <miralem.mehic@ieee.org>
9
*/
10
11
#ifndef QKD_CONTROL_CONTAINER_H
12
#define QKD_CONTROL_CONTAINER_H
13
14
#include <stdint.h>
15
#include <vector>
16
#include "ns3/qkd-control.h"
17
18
namespace
ns3
{
19
20
/**
21
* @ingroup QKD
22
*
23
* @brief holds a vector of std::pair of Ptr<QKDControl> and interface index.
24
*
25
* Typically ns-3 QKDControls are installed on nodes using an QKD
26
* helper.
27
*
28
* @see QKDControl
29
*/
30
class
QKDControlContainer
31
{
32
public
:
33
/**
34
* @brief Container Const Iterator for pairs of QKDControl smart pointer / Interface Index.
35
*/
36
typedef
std::vector<std::pair<Ptr<QKDControl>,
uint32_t
> >::const_iterator
Iterator
;
37
38
/**
39
* Create an empty QKDControlContainer.
40
*/
41
QKDControlContainer
();
42
43
/**
44
* Concatenate the entries in the other container with ours.
45
* @param other container
46
*/
47
void
Add
(
const
QKDControlContainer
&
other
);
48
49
/**
50
* @brief Get an iterator which refers to the first pair in the
51
* container.
52
*
53
* Pairs can be retrieved from the container in two ways. First,
54
* directly by an index into the container, and second, using an iterator.
55
* This method is used in the iterator method and is typically used in a
56
* for-loop to run through the pairs
57
*
58
* @code
59
* QKDControlContainer::Iterator i;
60
* for(i = container.Begin(); i != container.End(); ++i)
61
* {
62
* std::pair<Ptr<QKDControl>, uint32_t> pair = *i;
63
* method(pair.first, pair.second); // use the pair
64
* }
65
* @endcode
66
*
67
* @returns an iterator which refers to the first pair in the container.
68
*/
69
Iterator
Begin
()
const
;
70
71
/**
72
* @brief Get an iterator which indicates past-the-last Node in the
73
* container.
74
*
75
* Nodes can be retrieved from the container in two ways. First,
76
* directly by an index into the container, and second, using an iterator.
77
* This method is used in the iterator method and is typically used in a
78
* for-loop to run through the Nodes
79
*
80
* @code
81
* NodeContainer::Iterator i;
82
* for(i = container.Begin(); i != container.End(); ++i)
83
* {
84
* std::pair<Ptr<QKDControl>, uint32_t> pair = *i;
85
* method(pair.first, pair.second); // use the pair
86
* }
87
* @endcode
88
*
89
* @returns an iterator which indicates an ending condition for a loop.
90
*/
91
Iterator
End
()
const
;
92
93
/**
94
* @returns the number of Ptr<QKDControl> and interface pairs stored in this
95
* QKDControlContainer.
96
*
97
* Pairs can be retrieved from the container in two ways. First,
98
* directly by an index into the container, and second, using an iterator.
99
* This method is used in the direct method and is typically used to
100
* define an ending condition in a for-loop that runs through the stored
101
* Nodes
102
*
103
* @code
104
* uint32_t nNodes = container.GetN();
105
* for(uint32_t i = 0 i < nNodes; ++i)
106
* {
107
* std::pair<Ptr<QKDControl>, uint32_t> pair = container.Get(i);
108
* method(pair.first, pair.second); // use the pair
109
* }
110
* @endcode
111
*
112
* @returns the number of Ptr<Node> stored in this container.
113
*/
114
uint32_t
GetN
()
const
;
115
116
/**
117
* Manually add an entry to the container consisting of a previously composed
118
* entry std::pair.
119
*
120
* @param ipInterfacePair the pair of a pointer to Ipv4 object and interface index of the Ipv4Interface to add to the container
121
*/
122
void
Add
(
Ptr<QKDControl>
,
uint32_t
ipInterfacePair
);
123
124
/**
125
* Manually add an entry to the container consisting of a previously composed
126
* entry std::pair.
127
*
128
* @param ipInterfacePair the pair of a pointer to Ipv4 object and interface index of the Ipv4Interface to add to the container
129
*/
130
void
Add
(std::pair<
Ptr<QKDControl>
,
uint32_t
>
ipInterfacePair
);
131
132
/**
133
* Get the std::pair of an Ptr<QKDControl> and interface stored at the location
134
* specified by the index.
135
*
136
* @param i the index of the container entry to retrieve.
137
* @return the std::pair of a Ptr<QKDControl> and an interface index
138
*
139
*/
140
std::pair<Ptr<QKDControl>,
uint32_t
>
Get
(
uint32_t
i
)
const
;
141
142
private
:
143
/**
144
* @brief Container for pairs of QKDControl smart pointer / Interface Index.
145
*/
146
typedef
std::vector<std::pair<Ptr<QKDControl>,
uint32_t
> >
InterfaceVector
;
147
148
/**
149
* @brief List of QKD Encryptors and interfaces index.
150
*/
151
InterfaceVector
m_list
;
152
};
153
154
}
// namespace ns3
155
156
#endif
/* QKD_CONTROL_CONTAINER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:66
ns3::QKDControlContainer
holds a vector of std::pair of Ptr<QKDControl> and interface index.
Definition
qkd-control-container.h:31
ns3::QKDControlContainer::InterfaceVector
std::vector< std::pair< Ptr< QKDControl >, uint32_t > > InterfaceVector
Container for pairs of QKDControl smart pointer / Interface Index.
Definition
qkd-control-container.h:146
ns3::QKDControlContainer::m_list
InterfaceVector m_list
List of QKD Encryptors and interfaces index.
Definition
qkd-control-container.h:151
ns3::QKDControlContainer::Iterator
std::vector< std::pair< Ptr< QKDControl >, uint32_t > >::const_iterator Iterator
Container Const Iterator for pairs of QKDControl smart pointer / Interface Index.
Definition
qkd-control-container.h:36
ns3::QKDControlContainer::QKDControlContainer
QKDControlContainer()
Create an empty QKDControlContainer.
Definition
qkd-control-container.cc:17
ns3::QKDControlContainer::GetN
uint32_t GetN() const
Definition
qkd-control-container.cc:43
ns3::QKDControlContainer::End
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Definition
qkd-control-container.cc:37
ns3::QKDControlContainer::Add
void Add(const QKDControlContainer &other)
Concatenate the entries in the other container with ours.
Definition
qkd-control-container.cc:22
ns3::QKDControlContainer::Get
std::pair< Ptr< QKDControl >, uint32_t > Get(uint32_t i) const
Get the std::pair of an Ptr<QKDControl> and interface stored at the location specified by the index.
Definition
qkd-control-container.cc:59
ns3::QKDControlContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first pair in the container.
Definition
qkd-control-container.cc:31
uint32_t
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
qkd
helper
qkd-control-container.h
Generated on Mon Dec 15 2025 15:22:03 for ns-3 by
1.9.8