A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
packet-burst.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 */
19
20#ifndef PACKET_BURST_H
21#define PACKET_BURST_H
22
23#include "ns3/object.h"
24
25#include <list>
26#include <stdint.h>
27
28namespace ns3
29{
30
31class Packet;
32
33/**
34 * \brief this class implement a burst as a list of packets
35 */
36class PacketBurst : public Object
37{
38 public:
39 /**
40 * \brief Get the type ID.
41 * \return the object TypeId
42 */
43 static TypeId GetTypeId();
45 ~PacketBurst() override;
46 /**
47 * \return a copy the packetBurst
48 */
49 Ptr<PacketBurst> Copy() const;
50 /**
51 * \brief add a packet to the list of packet
52 * \param packet the packet to add
53 */
54 void AddPacket(Ptr<Packet> packet);
55 /**
56 * \return the list of packet of this burst
57 */
58 std::list<Ptr<Packet>> GetPackets() const;
59 /**
60 * \return the number of packet in the burst
61 */
62 uint32_t GetNPackets() const;
63 /**
64 * \return the size of the burst in byte (the size of all packets)
65 */
66 uint32_t GetSize() const;
67
68 /**
69 * \brief Returns an iterator to the begin of the burst
70 * \return iterator to the burst list start
71 */
72 std::list<Ptr<Packet>>::const_iterator Begin() const;
73 /**
74 * \brief Returns an iterator to the end of the burst
75 * \return iterator to the burst list end
76 */
77 std::list<Ptr<Packet>>::const_iterator End() const;
78
79 /**
80 * TracedCallback signature for Ptr<PacketBurst>
81 *
82 * \param [in] burst The PacketBurst
83 */
84 typedef void (*TracedCallback)(Ptr<const PacketBurst> burst);
85
86 private:
87 void DoDispose() override;
88 std::list<Ptr<Packet>> m_packets; //!< the list of packets in the burst
89};
90} // namespace ns3
91
92#endif /* PACKET_BURST */
A base class which provides memory management and object aggregation.
Definition: object.h:89
this class implement a burst as a list of packets
Definition: packet-burst.h:37
~PacketBurst() override
Definition: packet-burst.cc:50
std::list< Ptr< Packet > >::const_iterator End() const
Returns an iterator to the end of the burst.
static TypeId GetTypeId()
Get the type ID.
Definition: packet-burst.cc:36
std::list< Ptr< Packet > > m_packets
the list of packets in the burst
Definition: packet-burst.h:88
std::list< Ptr< Packet > >::const_iterator Begin() const
Returns an iterator to the begin of the burst.
Ptr< PacketBurst > Copy() const
Definition: packet-burst.cc:67
uint32_t GetNPackets() const
Definition: packet-burst.cc:98
std::list< Ptr< Packet > > GetPackets() const
Definition: packet-burst.cc:91
uint32_t GetSize() const
void DoDispose() override
Destructor implementation.
Definition: packet-burst.cc:60
void AddPacket(Ptr< Packet > packet)
add a packet to the list of packet
Definition: packet-burst.cc:81
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.