topical media & game development

talk show tell print

professional-program-21-PacketBuffer-PacketBufferTest.c

? / professional-program-21-PacketBuffer-PacketBufferTest.c


  include <PacketBuffer.h>
  include <iostream>
  using namespace std;
  
  class IPPacket {};
  
  int main(int argc, char** argv)
  {
    PacketBuffer<IPPacket> ipPackets(3);
  
    ipPackets.bufferPacket(IPPacket());
    ipPackets.bufferPacket(IPPacket());
    ipPackets.bufferPacket(IPPacket());
    ipPackets.bufferPacket(IPPacket());
  
    while (true) {
      try {
        IPPacket packet = ipPackets.getNextPacket();
      } catch (out_of_range&) {
        cout << "Processed all packets!" << endl;
        break;
      }
    }
    return (0);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.