Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/network/PacketBufferTest.cc @ 173

Last change on this file since 173 was 173, checked in by scheusso, 16 years ago

created classes PacketBuffer and ConnectionManager
PacketBuffer: (hopefully) threadsafe implementation of a packet buffer
for communication between threads
ConnectionManager: low-level managment of connection; implementation of
multiple threads

File size: 630 bytes
Line 
1#include "network/PacketBuffer.h"
2#include "network/PacketBuffer.cc"
3#include <iostream>
4#include <string>
5
6using namespace network;
7
8int main(int argc, char **argv[]){
9  PacketBuffer test = PacketBuffer();
10  PacketEnvelope p={8, 5};
11  if(test.isEmpty())
12    std::cout << "empty buffer" << std::endl;
13  for(int i=0; i<10; i++){
14    p.data=i*i;
15    std::cout << i << ": pushing " << p.data << std::endl;
16    test.push(p);
17  }
18  std::cout << std::endl << "queue.print()" << std::endl;
19  test.print();
20  while(!test.isEmpty()){
21    int i=test.pop()->data;
22    std::cout << "We popped the value " << i << std::endl;
23  }
24  return 0;
25}
Note: See TracBrowser for help on using the repository browser.