A Discrete-Event Network Simulator
API
mpi-receiver.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * Author: George Riley <riley@ece.gatech.edu>
16  */
17 
25 #include "mpi-receiver.h"
26 
27 namespace ns3
28 {
29 
30 TypeId
32 {
33  static TypeId tid = TypeId("ns3::MpiReceiver")
34  .SetParent<Object>()
35  .SetGroupName("Mpi")
36  .AddConstructor<MpiReceiver>();
37  return tid;
38 }
39 
41 {
42 }
43 
44 void
46 {
47  m_rxCallback = callback;
48 }
49 
50 void
52 {
54  m_rxCallback(p);
55 }
56 
57 void
59 {
60  m_rxCallback = MakeNullCallback<void, Ptr<Packet>>();
61 }
62 
63 } // namespace ns3
Callback template class.
Definition: callback.h:438
bool IsNull() const
Check for null implementation.
Definition: callback.h:569
Class to aggregate to a NetDevice if it supports MPI capability.
Definition: mpi-receiver.h:48
Callback< void, Ptr< Packet > > m_rxCallback
Callback to send received packets to.
Definition: mpi-receiver.h:72
void SetReceiveCallback(Callback< void, Ptr< Packet >> callback)
Set the receive callback to get packets to net devices.
Definition: mpi-receiver.cc:45
void Receive(Ptr< Packet > p)
Direct an incoming packet to the device Receive() method.
Definition: mpi-receiver.cc:51
static TypeId GetTypeId()
Register this type.
Definition: mpi-receiver.cc:31
void DoDispose() override
Destructor implementation.
Definition: mpi-receiver.cc:58
~MpiReceiver() override
Definition: mpi-receiver.cc:40
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
ns3::MpiReceiver declaration, provides an interface to aggregate to MPI-compatible NetDevices.
Every class exported by the ns3 library is enclosed in the ns3 namespace.