A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
qkd-encryptor-manager.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 "ns3/qkd-encryptor-manager.h"
22
23
namespace
ns3
{
24
25
NS_LOG_COMPONENT_DEFINE
(
"QKDEncryptorManager"
);
26
27
NS_OBJECT_ENSURE_REGISTERED
(QKDEncryptorManager);
28
29
TypeId
QKDEncryptorManager::GetTypeId
(
void
)
30
{
31
static
TypeId
tid =
TypeId
(
"ns3::QKDEncryptorManager"
)
32
.
SetParent
<
Object
> ()
33
;
34
return
tid;
35
}
36
37
QKDEncryptorManager::QKDEncryptorManager
()
38
{
39
NS_LOG_FUNCTION
(
this
);
40
}
41
42
QKDEncryptorManager::~QKDEncryptorManager
(){
43
}
44
45
uint32_t
46
QKDEncryptorManager::AddQKDEncryptor
(
Ptr<QKDEncryptor>
encryptor)
47
{
48
NS_LOG_FUNCTION
(
this
<< encryptor);
49
uint32_t index =
m_qkdencryptors
.size ();
50
m_qkdencryptors
.push_back (encryptor);
51
//encryptor->SetNode (this);
52
encryptor->SetIndex (index);
53
return
index;
54
}
55
Ptr<QKDEncryptor>
56
QKDEncryptorManager::GetQKDEncryptor
(uint32_t index)
const
57
{
58
NS_LOG_FUNCTION
(
this
<< index);
59
NS_ASSERT_MSG
(index <
m_qkdencryptors
.size (),
"QKDEncryptor index "
<< index <<
60
" is out of range (only have "
<<
m_qkdencryptors
.size () <<
" encryptors)."
);
61
return
m_qkdencryptors
[index];
62
}
63
uint32_t
64
QKDEncryptorManager::GetNQKDEncryptors
(
void
)
const
65
{
66
NS_LOG_FUNCTION
(
this
);
67
return
m_qkdencryptors
.size ();
68
}
69
70
}
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
ns3::QKDEncryptorManager::GetNQKDEncryptors
uint32_t GetNQKDEncryptors(void) const
Get a number of the associated QKDEncryptors.
Definition:
qkd-encryptor-manager.cc:64
ns3::QKDEncryptorManager::~QKDEncryptorManager
virtual ~QKDEncryptorManager()
Destructor.
Definition:
qkd-encryptor-manager.cc:42
ns3::QKDEncryptorManager::AddQKDEncryptor
uint32_t AddQKDEncryptor(Ptr< QKDEncryptor > device)
Associate a QKDEncryptor to this node.
Definition:
qkd-encryptor-manager.cc:46
ns3::QKDEncryptorManager::m_qkdencryptors
std::vector< Ptr< QKDEncryptor > > m_qkdencryptors
QKDEncryptors associated to this node.
Definition:
qkd-encryptor-manager.h:93
ns3::QKDEncryptorManager::GetQKDEncryptor
Ptr< QKDEncryptor > GetQKDEncryptor(uint32_t index) const
Retrieve the index-th QKDEncryptor associated to this node.
Definition:
qkd-encryptor-manager.cc:56
ns3::QKDEncryptorManager::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
qkd-encryptor-manager.cc:29
ns3::QKDEncryptorManager::QKDEncryptorManager
QKDEncryptorManager()
Constructor.
Definition:
qkd-encryptor-manager.cc:37
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:922
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition:
assert.h:88
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:244
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
qkd
model
qkd-encryptor-manager.cc
Generated on Tue Feb 6 2024 19:21:26 for ns-3 by
1.9.1