MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PacketBuffer.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  PacketBuffer.h List for holding inter-tile IO Packets
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
27 #ifndef PACKETBUFFER_H
28 #define PACKETBUFFER_H
29 
30 #include "Fail.h"
31 #include "Packet.h"
32 #include "itype.h"
33 
34 namespace MFM
35 {
36 
40 #define PACKETBUFFER_SIZE 128
41 
46  template <class T>
48  {
49  private :
53  Packet<T> m_buffer[PACKETBUFFER_SIZE];
54 
58  u32 m_heldPackets;
59 
64  const u32 m_packetCapacity;
65 
66  public:
67 
71  PacketBuffer();
72 
80  void PushPacket(Packet<T>& packet);
81 
89 
96  {
97  return m_heldPackets;
98  }
99  };
100 } /* namespace MFM */
101 
102 #include "PacketBuffer.tcc"
103 
104 #endif /*PACKETBUFFER_H*/
Definition: PacketBuffer.h:47
u32 PacketsHeld()
Definition: PacketBuffer.h:95
void PushPacket(Packet< T > &packet)
Definition: PacketBuffer.tcc:11
Definition: Packet.h:71
#define PACKETBUFFER_SIZE
Definition: PacketBuffer.h:40
Packet< T > * PopPacket()
Definition: PacketBuffer.tcc:27
PacketBuffer()
Definition: PacketBuffer.tcc:5