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
mpi-receiver.cc
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: GPL-2.0-only
3
*
4
* Author: George Riley <riley@ece.gatech.edu>
5
*/
6
7
/**
8
* \file
9
* \ingroup mpi
10
* ns3::MpiReceiver implementation,
11
* provides an interface to aggregate to MPI-compatible NetDevices.
12
*/
13
14
#include "
mpi-receiver.h
"
15
16
namespace
ns3
17
{
18
19
TypeId
20
MpiReceiver::GetTypeId
()
21
{
22
static
TypeId
tid =
TypeId
(
"ns3::MpiReceiver"
)
23
.
SetParent
<
Object
>()
24
.SetGroupName(
"Mpi"
)
25
.AddConstructor<
MpiReceiver
>();
26
return
tid;
27
}
28
29
MpiReceiver::~MpiReceiver
()
30
{
31
}
32
33
void
34
MpiReceiver::SetReceiveCallback
(
Callback
<
void
,
Ptr<Packet>
> callback)
35
{
36
m_rxCallback
= callback;
37
}
38
39
void
40
MpiReceiver::Receive
(
Ptr<Packet>
p)
41
{
42
NS_ASSERT
(!
m_rxCallback
.
IsNull
());
43
m_rxCallback
(p);
44
}
45
46
void
47
MpiReceiver::DoDispose
()
48
{
49
m_rxCallback
=
MakeNullCallback<void, Ptr<Packet>
>();
50
}
51
52
}
// namespace ns3
ns3::Callback
Callback template class.
Definition
callback.h:422
ns3::Callback::IsNull
bool IsNull() const
Check for null implementation.
Definition
callback.h:555
ns3::MpiReceiver
Class to aggregate to a NetDevice if it supports MPI capability.
Definition
mpi-receiver.h:37
ns3::MpiReceiver::m_rxCallback
Callback< void, Ptr< Packet > > m_rxCallback
Callback to send received packets to.
Definition
mpi-receiver.h:61
ns3::MpiReceiver::Receive
void Receive(Ptr< Packet > p)
Direct an incoming packet to the device Receive() method.
Definition
mpi-receiver.cc:40
ns3::MpiReceiver::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
mpi-receiver.cc:20
ns3::MpiReceiver::DoDispose
void DoDispose() override
Destructor implementation.
Definition
mpi-receiver.cc:47
ns3::MpiReceiver::~MpiReceiver
~MpiReceiver() override
Definition
mpi-receiver.cc:29
ns3::MpiReceiver::SetReceiveCallback
void SetReceiveCallback(Callback< void, Ptr< Packet > > callback)
Set the receive callback to get packets to net devices.
Definition
mpi-receiver.cc:34
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition
assert.h:55
ns3::MakeNullCallback
Callback< R, Args... > MakeNullCallback()
Definition
callback.h:727
mpi-receiver.h
ns3::MpiReceiver declaration, provides an interface to aggregate to MPI-compatible NetDevices.
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mpi
model
mpi-receiver.cc
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0