A Discrete-Event Network Simulator
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 
19 #include "mpi-receiver.h"
20 
21 namespace ns3 {
22 
23 TypeId
25 {
26  static TypeId tid = TypeId ("ns3::MpiReceiver")
27  .SetParent<Object> ()
28  .SetGroupName ("Mpi")
29  .AddConstructor <MpiReceiver> ();
30  return tid;
31 }
32 
34 {
35 }
36 
37 void
39 {
40  m_rxCallback = callback;
41 }
42 
43 void
45 {
47  m_rxCallback (p);
48 }
49 
50 void
52 {
53  m_rxCallback = MakeNullCallback<void, Ptr<Packet> >();
54 }
55 
56 } // namespace ns3
Callback template class.
Definition: callback.h:1176
virtual ~MpiReceiver()
Definition: mpi-receiver.cc:33
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1270
#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
static TypeId GetTypeId(void)
Definition: mpi-receiver.cc:24
void Receive(Ptr< Packet > p)
Direct an incoming packet to the device Receive() method.
Definition: mpi-receiver.cc:44
Class to aggregate to a NetDevice if it supports MPI capability.
Definition: mpi-receiver.h:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< void, Ptr< Packet > > m_rxCallback
Definition: mpi-receiver.h:61
void SetReceiveCallback(Callback< void, Ptr< Packet > > callback)
Set the receive callback to get packets to net devices.
Definition: mpi-receiver.cc:38
virtual void DoDispose(void)
Destructor implementation.
Definition: mpi-receiver.cc:51
A base class which provides memory management and object aggregation.
Definition: object.h:87
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904