Changeset 188 for code/branches/network/src/network/PacketBufferTestExt.cc
- Timestamp:
- Nov 7, 2007, 8:38:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/network/PacketBufferTestExt.cc
r187 r188 1 #include <string> 2 #include <iostream> 3 #include <enet/enet.h> 4 #include <boost/thread/thread.hpp> 1 5 #include "network/PacketBuffer.h" 2 6 #include "network/PacketBuffer.cc" 3 #include <boost/thread/thread.hpp>4 #include <iostream>5 #include <string>6 7 7 8 using namespace network; … … 9 10 10 11 void write(PacketBuffer *test){ 11 PacketEnvelope p;12 ENetPacket *packet; 12 13 if(test->isEmpty()) 13 14 std::cout << "empty buffer" << std::endl; 14 15 for(int i=0; i<10; i++){ 15 p.data=i*i; 16 std::cout << i << ": pushing " << p.data << std::endl; 17 test->push(p); 16 std::string temp = "packet "; 17 packet = enet_packet_create("packet", strlen("packet ")+1, 18 ENET_PACKET_FLAG_RELIABLE); 19 std::cout << i << ": pushing " << packet->data << std::endl; 20 test->push(packet); 18 21 if(i==5) 19 22 usleep(200000); … … 29 32 // only pop if the queue isn't empty 30 33 while(!test->isEmpty()){ 31 int i=test->pop().data; 32 std::cout << "We popped the value " << i << std::endl; 34 std::cout << "We popped the value " << test->pop()->data << std::endl; 33 35 } 34 36 }
Note: See TracChangeset
for help on using the changeset viewer.