A Discrete-Event Network Simulator
API
qkd-control-container.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 DOTFEESA www.tk.etf.unsa.ba
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Miralem Mehic <miralem.mehic@ieee.org>
19  */
20 
21 #include "qkd-control-container.h"
22 #include "ns3/node-list.h"
23 #include "ns3/names.h"
24 
25 namespace ns3 {
26 
28 {
29 }
30 
31 void
33 {
34  for (InterfaceVector::const_iterator i = other.m_list.begin (); i != other.m_list.end (); i++)
35  {
36  m_list.push_back (*i);
37  }
38 }
39 
42 {
43  return m_list.begin ();
44 }
45 
48 {
49  return m_list.end ();
50 }
51 
52 uint32_t
54 {
55  return m_list.size ();
56 }
57 
58 void
59 QKDControlContainer::Add (Ptr<QKDControl> qkde, uint32_t interface)
60 {
61  m_list.push_back (std::make_pair (qkde, interface));
62 }
63 void QKDControlContainer::Add (std::pair<Ptr<QKDControl>, uint32_t> a)
64 {
65  Add (a.first, a.second);
66 }
67 
68 std::pair<Ptr<QKDControl>, uint32_t>
69 QKDControlContainer::Get (uint32_t i) const
70 {
71  return m_list[i];
72 }
73 
74 
75 } // namespace ns3
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
holds a vector of std::pair of Ptr<QKDControl> and interface index.
std::vector< std::pair< Ptr< QKDControl >, uint32_t > >::const_iterator Iterator
Container Const Iterator for pairs of QKDControl smart pointer / Interface Index.
InterfaceVector m_list
List of QKD Encryptors and interfaces index.
Iterator Begin(void) const
Get an iterator which refers to the first pair in the container.
uint32_t GetN(void) const
Get the number of nodes in the container.
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
void Add(const QKDControlContainer &other)
Concatenate the entries in the other container with ours.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.