A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
mpi-receiver.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 2 as
5
* published by the Free Software Foundation;
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*
16
* Author: George Riley <riley@ece.gatech.edu>
17
*/
18
26
#include "
mpi-receiver.h
"
27
28
namespace
ns3
{
29
30
TypeId
31
MpiReceiver::GetTypeId
(
void
)
32
{
33
static
TypeId
tid =
TypeId
(
"ns3::MpiReceiver"
)
34
.
SetParent
<
Object
> ()
35
.SetGroupName (
"Mpi"
)
36
.AddConstructor <
MpiReceiver
> ();
37
return
tid;
38
}
39
40
MpiReceiver::~MpiReceiver
()
41
{
42
}
43
44
void
45
MpiReceiver::SetReceiveCallback
(
Callback
<
void
,
Ptr<Packet>
> callback)
46
{
47
m_rxCallback
= callback;
48
}
49
50
void
51
MpiReceiver::Receive
(
Ptr<Packet>
p)
52
{
53
NS_ASSERT
(!
m_rxCallback
.
IsNull
());
54
m_rxCallback
(p);
55
}
56
57
void
58
MpiReceiver::DoDispose
(
void
)
59
{
60
m_rxCallback
= MakeNullCallback<void, Ptr<Packet> >();
61
}
62
63
}
// namespace ns3
ns3::Callback
Callback template class.
Definition:
callback.h:1279
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition:
callback.h:1386
ns3::MpiReceiver
Class to aggregate to a NetDevice if it supports MPI capability.
Definition:
mpi-receiver.h:48
ns3::MpiReceiver::m_rxCallback
Callback< void, Ptr< Packet > > m_rxCallback
Callback to send received packets to.
Definition:
mpi-receiver.h:71
ns3::MpiReceiver::~MpiReceiver
virtual ~MpiReceiver()
Definition:
mpi-receiver.cc:40
ns3::MpiReceiver::Receive
void Receive(Ptr< Packet > p)
Direct an incoming packet to the device Receive() method.
Definition:
mpi-receiver.cc:51
ns3::MpiReceiver::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
mpi-receiver.cc:58
ns3::MpiReceiver::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
mpi-receiver.cc:31
ns3::MpiReceiver::SetReceiveCallback
void SetReceiveCallback(Callback< void, Ptr< Packet > > callback)
Set the receive callback to get packets to net devices.
Definition:
mpi-receiver.cc:45
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
ns3::Ptr< Packet >
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
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition:
assert.h:67
mpi-receiver.h
ns3::MpiReciver 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 Tue Feb 6 2024 19:21:25 for ns-3 by
1.9.1