[Orxonox-commit 4136] r8807 - in code/branches/output/src/libraries: network network/packet network/synchronisable util/output

landauf at orxonox.net landauf at orxonox.net
Sun Jul 31 21:09:24 CEST 2011


Author: landauf
Date: 2011-07-31 21:09:23 +0200 (Sun, 31 Jul 2011)
New Revision: 8807

Modified:
   code/branches/output/src/libraries/network/ChatListener.cc
   code/branches/output/src/libraries/network/Client.cc
   code/branches/output/src/libraries/network/ClientConnection.cc
   code/branches/output/src/libraries/network/Connection.cc
   code/branches/output/src/libraries/network/GamestateManager.cc
   code/branches/output/src/libraries/network/LANDiscoverable.cc
   code/branches/output/src/libraries/network/LANDiscovery.cc
   code/branches/output/src/libraries/network/MasterServer.cc
   code/branches/output/src/libraries/network/MasterServerComm.cc
   code/branches/output/src/libraries/network/PeerList.cc
   code/branches/output/src/libraries/network/Server.cc
   code/branches/output/src/libraries/network/ServerConnection.cc
   code/branches/output/src/libraries/network/TrafficControl.cc
   code/branches/output/src/libraries/network/WANDiscoverable.cc
   code/branches/output/src/libraries/network/WANDiscovery.cc
   code/branches/output/src/libraries/network/packet/Acknowledgement.cc
   code/branches/output/src/libraries/network/packet/ClassID.cc
   code/branches/output/src/libraries/network/packet/DeleteObjects.cc
   code/branches/output/src/libraries/network/packet/FunctionIDs.cc
   code/branches/output/src/libraries/network/packet/Gamestate.cc
   code/branches/output/src/libraries/network/packet/Packet.cc
   code/branches/output/src/libraries/network/packet/Welcome.cc
   code/branches/output/src/libraries/network/synchronisable/Synchronisable.cc
   code/branches/output/src/libraries/network/synchronisable/Synchronisable.h
   code/branches/output/src/libraries/network/synchronisable/SynchronisableVariable.h
   code/branches/output/src/libraries/util/output/OutputDefinitions.h
Log:
Replaced COUT with orxout in network library. Tried to set levels and contexts in a more or less useful way, but not really optimized. Used contexts network, packets, and master_server.
Please use endl instead of \n in the future (@smerkli) ;)

Modified: code/branches/output/src/libraries/network/ChatListener.cc
===================================================================
--- code/branches/output/src/libraries/network/ChatListener.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/ChatListener.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -39,7 +39,7 @@
     //void ChatListener::incomingChat( const std::string& message,
       //unsigned int senderID )
     //{
-      //COUT(0) << "Chat: \"" << message << "\"\n";
+      //orxout(message) << "Chat: \"" << message << "\"" << endl;
 
 
     //}

Modified: code/branches/output/src/libraries/network/Client.cc
===================================================================
--- code/branches/output/src/libraries/network/Client.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/Client.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -117,13 +117,13 @@
 
   bool Client::processChat(const std::string& message, unsigned int playerID)
   {
-//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
+//    orxout(message) << "Player " << playerID << ": " << message << endl;
     return true;
   }
 
   void Client::printRTT()
   {
-    COUT(0) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl;
+    orxout(message) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl;
   }
 
   /**
@@ -149,10 +149,9 @@
     if(timeSinceLastUpdate_>=NETWORK_PERIOD)
     {
       timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD;
-      //     COUT(3) << '.';
       if ( isConnected() && isSynched_ )
       {
-        COUT(4) << "popping partial gamestate: " << std::endl;
+        orxout(verbose, context::network) << "popping partial gamestate: " << endl;
 //         packet::Gamestate *gs = GamestateClient::getGamestate();
         if( GamestateManager::update() )
         {
@@ -165,9 +164,9 @@
         }
         //assert(gs); <--- there might be the case that no data has to be sent, so its commented out now
 //         if(gs){
-//           COUT(4) << "client tick: sending gs " << gs << std::endl;
+//           orxout(verbose, context::network) << "client tick: sending gs " << gs << endl;
 //           if( !gs->send() )
-//             COUT(2) << "Problem adding partial gamestate to queue" << std::endl;
+//             orxout(internal_warning, context::network) << "Problem adding partial gamestate to queue" << endl;
 //         // gs gets automatically deleted by enet callback
 //         }
         FunctionCallManager::sendCalls(static_cast<Host*>(this));

Modified: code/branches/output/src/libraries/network/ClientConnection.cc
===================================================================
--- code/branches/output/src/libraries/network/ClientConnection.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/ClientConnection.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -59,7 +59,7 @@
 
   void ClientConnection::setServerAddress( const std::string& serverAddress ) {
     if (enet_address_set_host (this->serverAddress_, serverAddress.c_str()) < 0)
-        COUT(1) << "Error: Could not resolve \"" << serverAddress << "\"." << std::endl;
+        orxout(internal_error, context::network) << "Could not resolve \"" << serverAddress << "\"." << endl;
   }
 
   void ClientConnection::setPort( unsigned int port ) {
@@ -75,7 +75,7 @@
     
     if ( this->host_ == NULL )
     {
-      COUT(1) << "ClientConnection: host_ == NULL" << std::endl;
+      orxout(internal_error, context::network) << "ClientConnection: host_ == NULL" << endl;
       // error handling
       return false;
     }
@@ -85,16 +85,16 @@
     
     assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL );
     if (this->host_->socket4 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv4 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv4 Socket failed." << endl;
     else if (this->host_->socket6 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv6 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv6 Socket failed." << endl;
     else
-        COUT(3) << "Info: Using IPv4 and IPv6 Sockets." << std::endl;
+        orxout(internal_info, context::network) << "Using IPv4 and IPv6 Sockets." << endl;
 
     this->server_ = enet_host_connect(this->host_, serverAddress_, NETWORK_CHANNEL_COUNT, 0);
     if ( this->server_==NULL )
     {
-      COUT(1) << "ClientConnection: server_ == NULL" << std::endl;
+      orxout(internal_error, context::network) << "ClientConnection: server_ == NULL" << endl;
       // error handling
       return false;
     }
@@ -112,7 +112,7 @@
         return true;
       }
     }
-    COUT(1) << "Could not connect to server" << endl;
+    orxout(user_error, context::network) << "Could not connect to server" << endl;
     return false;
   }
 
@@ -139,7 +139,7 @@
             enet_packet_destroy(event.packet);
             break;
           case ENET_EVENT_TYPE_DISCONNECT:
-            COUT(4) << "received disconnect confirmation from server" << endl;
+            orxout(verbose, context::network) << "received disconnect confirmation from server" << endl;
             this->connectionClosed();
             return true;
         }
@@ -166,7 +166,7 @@
   void ClientConnection::removePeer(uint32_t peerID)
   {
     this->established_=false;
-    COUT(1) << "Received disconnect Packet from Server!" << endl;
+    orxout(internal_error, context::network) << "Received disconnect Packet from Server!" << endl;
         // server closed the connection
     this->stopCommunicationThread();
     this->connectionClosed();

Modified: code/branches/output/src/libraries/network/Connection.cc
===================================================================
--- code/branches/output/src/libraries/network/Connection.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/Connection.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -143,7 +143,7 @@
       this->outgoingEventsMutex_->unlock();
       while( outgoingEventsCount > 0 )
       {
-//         COUT(0) << "outgoing event" << endl;
+//         orxout(verbose, context::network) << "outgoing event" << endl;
         this->outgoingEventsMutex_->lock();
         outgoingEvent outEvent = this->outgoingEvents_.front();
         this->outgoingEvents_.pop_front();

Modified: code/branches/output/src/libraries/network/GamestateManager.cc
===================================================================
--- code/branches/output/src/libraries/network/GamestateManager.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/GamestateManager.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -127,12 +127,12 @@
     packet::Acknowledgement *ack = new packet::Acknowledgement(gamestateID, peerID);
     if( !this->sendPacket(ack))
     {
-      COUT(3) << "could not ack gamestate: " << gamestateID << std::endl;
+      orxout(internal_warning, context::network) << "could not ack gamestate: " << gamestateID << endl;
       return false;
     }
     else
     {
-      COUT(5) << "acked a gamestate: " << gamestateID << std::endl;
+      orxout(verbose_more, context::network) << "acked a gamestate: " << gamestateID << endl;
       return true;
     }
   }
@@ -181,11 +181,11 @@
     {
       if( !peerIt->second.isSynched )
       {
-        COUT(5) << "Server: not sending gamestate" << std::endl;
+        orxout(verbose_more, context::network) << "Server: not sending gamestate" << endl;
         continue;
       }
-      COUT(5) << "client id: " << peerIt->first << std::endl;
-      COUT(5) << "Server: doing gamestate gamestate preparation" << std::endl;
+      orxout(verbose_more, context::network) << "client id: " << peerIt->first << endl;
+      orxout(verbose_more, context::network) << "Server: doing gamestate gamestate preparation" << endl;
       int peerID = peerIt->first; //get client id
 
       unsigned int lastAckedGamestateID = peerIt->second.lastAckedGamestateID;
@@ -255,12 +255,12 @@
 
 //     OrxVerify(gs->compressData(), "");
     clock.capture();
-    COUT(5) << "diff and compress time: " << clock.getDeltaTime() << endl;
-//     COUT(5) << "sending gamestate with id " << gs->getID();
+    orxout(verbose_more, context::network) << "diff and compress time: " << clock.getDeltaTime() << endl;
+//     orxout(verbose_more, context::network) << "sending gamestate with id " << gs->getID();
 //     if(gamestate->isDiffed())
-//       COUT(5) << " and baseid " << gs->getBaseID() << endl;
+//       orxout(verbose_more, context::network) << " and baseid " << gs->getBaseID() << endl;
 //     else
-//       COUT(5) << endl;
+//       orxout(verbose_more, context::network) << endl;
     gs->setPeerID(peerID);
     destgamestate = gs;
   }
@@ -290,7 +290,7 @@
 //    assert(curid==GAMESTATEID_INITIAL || curid<=gamestateID); // this line is commented out because acknowledgements are unreliable and may arrive in distorted order
     if( gamestateID <= curid && curid != GAMESTATEID_INITIAL )
         return true;
-COUT(4) << "acking gamestate " << gamestateID << " for peerID: " << peerID << " curid: " << curid << std::endl;
+orxout(verbose, context::network) << "acking gamestate " << gamestateID << " for peerID: " << peerID << " curid: " << curid << endl;
     std::map<uint32_t, packet::Gamestate*>::iterator it2;
     for( it2=it->second.gamestates.begin(); it2!=it->second.gamestates.end(); )
     {

Modified: code/branches/output/src/libraries/network/LANDiscoverable.cc
===================================================================
--- code/branches/output/src/libraries/network/LANDiscoverable.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/LANDiscoverable.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -70,7 +70,7 @@
       assert( this->host_ == 0 );
       this->host_ = enet_host_create( &bindAddress, 10, 0, 0, 0 );
       if ( this->host_ == NULL )
-          COUT(1) << "LANDiscoverable: host_ == NULL" << std::endl;
+          orxout(internal_error, context::network) << "LANDiscoverable: host_ == NULL" << endl;
     }
     else
     {
@@ -93,7 +93,7 @@
       switch(event.type)
       {
         case ENET_EVENT_TYPE_CONNECT:
-            COUT(4) << "Received LAN discovery connect from client " << event.peer->host->receivedAddress << std::endl;
+            orxout(verbose, context::network) << "Received LAN discovery connect from client " << event.peer->host->receivedAddress << endl;
             break;
         case ENET_EVENT_TYPE_DISCONNECT:
         case ENET_EVENT_TYPE_NONE:
@@ -101,7 +101,7 @@
         case ENET_EVENT_TYPE_RECEIVE:
           if( strcmp( LAN_DISCOVERY_MESSAGE, (char*)event.packet->data ) == 0 )      // check for a suitable orxonox client
           {
-            COUT(3) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << std::endl;
+            orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl;
             packet::ServerInformation info;
             info.setServerName("Orxonox Server");
             info.send(event.peer);

Modified: code/branches/output/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/branches/output/src/libraries/network/LANDiscovery.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/LANDiscovery.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -43,7 +43,7 @@
   {
     this->host_ = enet_host_create(NULL, 10, 0, 0, 0 );
     if ( this->host_ == NULL )
-        COUT(1) << "LANDiscovery: host_ == NULL" << std::endl;
+        orxout(internal_error, context::network) << "LANDiscovery: host_ == NULL" << endl;
   }
 
   LANDiscovery::~LANDiscovery()
@@ -65,13 +65,13 @@
     address.host = ENET_HOST_BROADCAST;
     peer = enet_host_connect(this->host_, &address, 0, 0);
     if (peer == NULL)
-        COUT(1) << "Error: Could not send LAN discovery to IPv4 Broadcast." << std::endl;
+        orxout(internal_error, context::network) << "Could not send LAN discovery to IPv4 Broadcast." << endl;
 
     /* IPv6 */
     enet_address_set_host(&address, "ff02::1"); // TODO: use a multicast group
     peer = enet_host_connect(this->host_, &address, 0, 0);
     if (peer == NULL)
-        COUT(1) << "Error: Could not send LAN discovery to IPv6 Multicast." << std::endl;
+        orxout(internal_error, context::network) << "Could not send LAN discovery to IPv6 Multicast." << endl;
 
     ENetEvent event;
     while( enet_host_service(this->host_, &event, 1000 ) )
@@ -80,7 +80,7 @@
       {
         case ENET_EVENT_TYPE_CONNECT:
         {
-          COUT(4) << "Received LAN discovery connect from server " << event.peer->host->receivedAddress << std::endl;
+          orxout(verbose, context::network) << "Received LAN discovery connect from server " << event.peer->host->receivedAddress << endl;
           ENetPacket* packet = enet_packet_create(LAN_DISCOVERY_MESSAGE, strlen(LAN_DISCOVERY_MESSAGE)+1, ENET_PACKET_FLAG_RELIABLE);
           enet_peer_send(event.peer, 0, packet);
           break;
@@ -88,7 +88,7 @@
         case ENET_EVENT_TYPE_RECEIVE:
           {
             packet::ServerInformation info(&event);
-            COUT(3) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
+            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
             std::vector<packet::ServerInformation>::iterator it;
             for( it=this->servers_.begin(); it!=this->servers_.end(); ++it )
             {

Modified: code/branches/output/src/libraries/network/MasterServer.cc
===================================================================
--- code/branches/output/src/libraries/network/MasterServer.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/MasterServer.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -37,14 +37,15 @@
   static void 
   helper_output_debug( ENetEvent *event, char *addrconv )
   {
-    COUT(4) << "A packet of length" 
+    orxout(verbose, context::master_server)
+      << "A packet of length" 
       << event->packet->dataLength
       << " containing "
       << (const char*)event->packet->data
       << " was received from "
       << addrconv 
       << " on channel "
-      << event->channelID << "\n";
+      << event->channelID << endl;
   }
 
   void
@@ -65,7 +66,7 @@
       char *tosend = (char *)calloc( (*i).getServerIP().length() 
           + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
       if( !tosend ) 
-      { COUT(2) << "Masterserver.cc: Memory allocation failed.\n";
+      { orxout(internal_warning, context::master_server) << "Masterserver.cc: Memory allocation failed." << endl;
         continue;
       } 
       sprintf( tosend, "%s %s", MSPROTO_SERVERLIST_ITEM, 
@@ -107,7 +108,7 @@
   MasterServer::eventConnect( ENetEvent *event )
   { /* check for bad parameters */
     if( !event )
-    { COUT(2) << "MasterServer::eventConnect: No event given.\n" ;
+    { orxout(internal_warning, context::master_server) << "MasterServer::eventConnect: No event given." << endl;
       return -1;
     }
 
@@ -116,10 +117,10 @@
     enet_address_get_host_ip( &(event->peer->address), addrconv, 49 );
 
     /* output debug info */
-    COUT(4) << "A new client connected from " 
+    orxout(verbose, context::master_server) << "A new client connected from " 
       << addrconv 
       << " on port " 
-      << event->peer->address.port << "\n";
+      << event->peer->address.port << endl;
 
     /* store string form of address here */
     event->peer->data = addrconv; 
@@ -133,12 +134,12 @@
   MasterServer::eventDisconnect( ENetEvent *event )
   { /* check for bad parameters */
     if( !event )
-    { COUT(2) << "No event given.\n";
+    { orxout(internal_warning, context::master_server) << "No event given." << endl;
       return -1;
     }
 
     /* output that the disconnect happened */
-    COUT(4) << (char*)event->peer->data << " disconnected.\n";
+    orxout(verbose, context::master_server) << (char*)event->peer->data << " disconnected." << endl;
 
     /* create string from peer data */
     std::string name = std::string( (char*)event->peer->data );
@@ -158,7 +159,7 @@
   MasterServer::eventData( ENetEvent *event )
   { /* validate packet */
     if( !event || !(event->packet) || !(event->peer) )
-    { COUT(2) << "No complete event given.\n";
+    { orxout(internal_warning, context::master_server) << "No complete event given." << endl;
       return -1;
     }
      
@@ -181,8 +182,8 @@
         mainlist.addServer( packet::ServerInformation( event ) );
         
         /* tell people we did so */
-        COUT(2) << "Added new server to list: " << 
-          packet::ServerInformation( event ).getServerIP() << "\n";
+        orxout(internal_info, context::master_server) << "Added new server to list: " << 
+          packet::ServerInformation( event ).getServerIP() << endl;
       }
 
       else if( !strncmp( (char *)event->packet->data
@@ -196,7 +197,7 @@
         this->mainlist.delServerByAddress( name );
 
         /* tell the user */
-        COUT(2) << "Removed server " << name << " from list.\n";
+        orxout(internal_info, context::master_server) << "Removed server " << name << " from list." << endl;
       }
 
       /* TODO add hook for disconnect here */
@@ -229,7 +230,7 @@
     ENetEvent *event = (ENetEvent *)calloc(sizeof(ENetEvent), sizeof(char));
     if( event == NULL )
     { 
-      COUT(1) << "Could not create ENetEvent structure, exiting.\n";
+      orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl;
       exit( EXIT_FAILURE );
     }
 
@@ -262,7 +263,7 @@
   {
     /***** INITIALIZE NETWORKING *****/
     if( enet_initialize () != 0)
-    { COUT(1) << "An error occurred while initializing ENet.\n";
+    { orxout(user_error, context::master_server) << "An error occurred while initializing ENet." << endl;
       exit( EXIT_FAILURE );
     }
 
@@ -284,8 +285,8 @@
 
     /* see if creation worked */
     if( !this->server )
-    { COUT(1) << 
-        "An error occurred while trying to create an ENet server host.\n";
+    { orxout(user_error, context::master_server) << 
+        "An error occurred while trying to create an ENet server host." << endl;
       exit( EXIT_FAILURE );
     }
 
@@ -293,7 +294,7 @@
     this->peers = new PeerList();
 
     /* tell people we're now initialized */
-    COUT(0) << "MasterServer initialized, waiting for connections.\n";
+    orxout(internal_status, context::master_server) << "MasterServer initialized, waiting for connections." << endl;
   }
 
   /* destructor */

Modified: code/branches/output/src/libraries/network/MasterServerComm.cc
===================================================================
--- code/branches/output/src/libraries/network/MasterServerComm.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/MasterServerComm.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -43,7 +43,7 @@
   {
     /* initialize Enet */
     if( enet_initialize () != 0 )
-    { COUT(1) << "An error occurred while initializing ENet.\n";
+    { orxout(internal_error, context::master_server) << "An error occurred while initializing ENet." << endl;
       return 1;
     }
 
@@ -60,8 +60,8 @@
 
     /* see if it worked */
     if (this->client == NULL)
-    { COUT(1) << "An error occurred while trying to create an " 
-        << "ENet client host.\n";
+    { orxout(internal_error, context::master_server) << "An error occurred while trying to create an " 
+        << "ENet client host." << endl;
       return 1;
     }
 
@@ -84,19 +84,19 @@
     this->peer = enet_host_connect(this->client, &this->address, 2, 0);    
 
     if( this->peer == NULL )
-    { COUT(2) << "ERROR: No available peers for initiating an ENet"
-        << " connection.\n";
+    { orxout(internal_error, context::master_server) << "No available peers for initiating an ENet"
+        << " connection." << endl;
       return -1;
     }
 
     /* Wait up to 2 seconds for the connection attempt to succeed. */
     if (enet_host_service (this->client, &this->event, 500) > 0 &&
         this->event.type == ENET_EVENT_TYPE_CONNECT )
-      COUT(3) << "Connection to master server succeeded.\n";
+      orxout(internal_info, context::master_server) << "Connection to master server succeeded." << endl;
     else
     {
       enet_peer_reset (this->peer);
-      COUT(2) << "ERROR: connection to " << address << " failed.\n";
+      orxout(internal_warning, context::master_server) << "Connection to " << address << " failed." << endl;
       return -1;
     }
 
@@ -127,7 +127,7 @@
           break;
 
         case ENET_EVENT_TYPE_DISCONNECT:
-          COUT(4) << "Disconnect from master server successful.\n"; 
+          orxout(verbose, context::master_server) << "Disconnect from master server successful." << endl; 
           return 0;
         default: break;
       }
@@ -153,7 +153,7 @@
   { 
     /* see whether anything happened */
     /* WORK MARK REMOVE THIS OUTPUT */
-    COUT(2) << "polling masterserver...\n";
+    orxout(verbose, context::master_server) << "polling masterserver..." << endl;
 
     /* address buffer */
     char *addrconv = NULL;
@@ -175,7 +175,7 @@
         case ENET_EVENT_TYPE_RECEIVE: 
           addrconv = (char *) calloc( 50, 1 );
           if( !addrconv ) 
-          { COUT(2) << "MasterServerComm.cc: Could not allocate memory!\n";
+          { orxout(internal_warning, context::master_server) << "MasterServerComm.cc: Could not allocate memory!" << endl;
             break;
           }
 
@@ -184,7 +184,7 @@
             addrconv, 49 );
 
           /* DEBUG */
-          COUT(3) << "MasterServer Debug: A packet of length " 
+          orxout(verbose, context::master_server) << "MasterServer Debug: A packet of length " 
             << this->event.packet->dataLength 
             << " containing " << this->event.packet->data
             << " was received from " << addrconv 

Modified: code/branches/output/src/libraries/network/PeerList.cc
===================================================================
--- code/branches/output/src/libraries/network/PeerList.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/PeerList.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -39,7 +39,7 @@
   PeerList::addPeer( ENetPeer *toadd )
   { /* error correction */
     if( toadd == NULL ) 
-    { fprintf( stderr, "PeerList::addPeer: empty peer given.\n" );
+    { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl;
       return -1;
     }
 

Modified: code/branches/output/src/libraries/network/Server.cc
===================================================================
--- code/branches/output/src/libraries/network/Server.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/Server.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -113,7 +113,7 @@
   void Server::open()
   {
     Host::setActive(true);
-    COUT(4) << "opening server" << endl;
+    orxout(verbose, context::network) << "opening server" << endl;
     this->openListener();
     
     /* make discoverable on LAN */
@@ -136,14 +136,14 @@
   void Server::close()
   {
     Host::setActive(false);
-    COUT(4) << "closing server" << endl;
+    orxout(verbose, context::network) << "closing server" << endl;
     this->disconnectClients();
     this->closeListener();
 
     /* tell master server we're closing */
-    COUT(2) << "disconnecting." << endl;
+    orxout(internal_info, context::network) << "disconnecting." << endl;
     WANDiscoverable::setActivity(false);    
-    COUT(2) << "disconnecting done" << endl;
+    orxout(internal_info, context::network) << "disconnecting done" << endl;
 
     LANDiscoverable::setActivity(false);
     return;
@@ -157,10 +157,10 @@
     chat = new packet::Chat(message, playerID);
     chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
     chat->send( static_cast<Host*>(this) );
-//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
+//         orxout(internal_warning, context::network) << "could not send Chat message to client ID: " << temp->getID() << endl;
 //       temp = temp->next();
 //     }
-//    COUT(1) << "Player " << playerID << ": " << message << std::endl;
+//    orxout(message) << "Player " << playerID << ": " << message << endl;
     return true;
   }
 
@@ -245,7 +245,7 @@
   void Server::printRTT()
   {
 //     for( ClientInformation* temp=ClientInformation::getBegin(); temp!=0; temp=temp->next() )
-//       COUT(0) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
+//       orxout(message) << "Round trip time to client with ID: " << temp->getID() << " is " << temp->getRTT() << " ms" << endl;
   }
 
   /**
@@ -267,13 +267,13 @@
       //no client connected
       return;
     GamestateManager::update();
-//     COUT(5) << "Server: one gamestate update complete, goig to sendGameState" << std::endl;
-    //std::cout << "updated gamestate, sending it" << std::endl;
+//     orxout(verbose_more, context::network) << "Server: one gamestate update complete, goig to sendGameState" << endl;
+    //orxout(verbose_more, context::network) << "updated gamestate, sending it" << endl;
     //if(clients->getGamestateID()!=GAMESTATEID_INITIAL)
     sendGameStates();
     sendObjectDeletes();
-//     COUT(5) << "Server: one sendGameState turn complete, repeat in next tick" << std::endl;
-    //std::cout << "sent gamestate" << std::endl;
+//     orxout(verbose_more, context::network) << "Server: one sendGameState turn complete, repeat in next tick" << endl;
+    //orxout(verbose_more, context::network) << "sent gamestate" << endl;
   }
 
   /**
@@ -304,11 +304,11 @@
       delete del;
       return true;  //everything ok (no deletes this tick)
     }
-//     COUT(3) << "sending DeleteObjects" << std::endl;
+//     orxout(verbose, context::network) << "sending DeleteObjects" << endl;
 //     while(temp != NULL){
 //       if( !(temp->getSynched()) )
 //       {
-//         COUT(5) << "Server: not sending gamestate" << std::endl;
+//         orxout(verbose_more, context::network) << "Server: not sending gamestate" << endl;
 //         temp=temp->next();
 //         continue;
 //       }
@@ -317,7 +317,7 @@
 //       assert(cd);
     del->setPeerID(NETWORK_PEER_ID_BROADCAST);
     if ( !del->send( static_cast<Host*>(this) ) )
-      COUT(3) << "Server: could not broadcast deleteObjects packet" << std::endl;
+      orxout(internal_warning, context::network) << "Server: could not broadcast deleteObjects packet" << endl;
 //       temp=temp->next();
       // gs gets automatically deleted by enet callback
 //     }
@@ -330,11 +330,11 @@
   {
 //     static unsigned int newid=1;
 // 
-//     COUT(2) << "Server: adding client" << std::endl;
+//     orxout(internal_info, context::network) << "Server: adding client" << endl;
 //     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
 //     if(!temp)
 //     {
-//       COUT(2) << "Server: could not add client" << std::endl;
+//       orxout(internal_warning, context::network) << "Server: could not add client" << endl;
 //     }
 //     temp->setID(newid);
 //     temp->setPeer(event->peer);
@@ -346,13 +346,13 @@
 
 //     ++newid;
 
-    COUT(3) << "Server: added client id: " << peerID << std::endl;
+    orxout(internal_info, context::network) << "Server: added client id: " << peerID << endl;
     createClient(peerID);
 }
 
   void Server::removePeer(uint32_t peerID)
   {
-    COUT(4) << "removing client from list" << std::endl;
+    orxout(verbose, context::network) << "removing client from list" << endl;
 //     ClientInformation *client = ClientInformation::findClient(&event->peer->address);
 //     if(!client)
 //       return;
@@ -394,10 +394,10 @@
 //     ClientInformation *temp = ClientInformation::findClient(clientID);
 //     if(!temp)
 //     {
-//       COUT(2) << "Server. could not create client with id: " << clientID << std::endl;
+//       orxout(internal_error, context::network) << "Server. could not create client with id: " << clientID << endl;
 //       return false;
 //     }
-//     COUT(4) << "Con.Man: creating client id: " << temp->getID() << std::endl;
+//     orxout(verbose, context::network) << "Con.Man: creating client id: " << temp->getID() << endl;
 
     // synchronise class ids
     syncClassid(clientID);
@@ -411,7 +411,7 @@
 //     temp->setSynched(true);
     GamestateManager::setSynched(clientID);
     
-    COUT(4) << "sending welcome" << std::endl;
+    orxout(verbose, context::network) << "sending welcome" << endl;
     packet::Welcome *w = new packet::Welcome(clientID);
     w->setPeerID(clientID);
     b = w->send( static_cast<Host*>(this) );
@@ -456,10 +456,10 @@
       chat = new packet::Chat(message, clientID);
       chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
       chat->send( static_cast<Host*>(this) );
-//         COUT(3) << "could not send Chat message to client ID: " << temp->getID() << std::endl;
+//         orxout(internal_warning, context::network) << "could not send Chat message to client ID: " << temp->getID() << endl;
 //       temp = temp->next();
     }
-//    COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl;
+//    orxout(message) << "Player " << Host::getPlayerID() << ": " << message << endl;
     for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
       it->incomingChat(message, clientID);
 
@@ -475,7 +475,7 @@
       failures++;
     }
     assert(failures<10);
-    COUT(4) << "syncClassid:\tall synchClassID packets have been sent" << std::endl;
+    orxout(verbose, context::network) << "syncClassid:\tall synchClassID packets have been sent" << endl;
   }
 
 }

Modified: code/branches/output/src/libraries/network/ServerConnection.cc
===================================================================
--- code/branches/output/src/libraries/network/ServerConnection.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/ServerConnection.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -60,7 +60,7 @@
   void ServerConnection::setBindAddress( const std::string& bindAddress )
   {
     if (enet_address_set_host (this->bindAddress_, bindAddress.c_str()) < 0)
-        COUT(1) << "Error: Could not resolve \"" << bindAddress << "\"." << std::endl;
+        orxout(internal_error, context::network) << "Could not resolve \"" << bindAddress << "\"." << endl;
   }
 
   void ServerConnection::setPort( unsigned int port ) {
@@ -74,7 +74,7 @@
     
     if ( this->host_ == NULL )
     {
-        COUT(1) << "ServerConnection: host_ == NULL" << std::endl;
+        orxout(internal_error, context::network) << "ServerConnection: host_ == NULL" << endl;
         return false;
     }
     
@@ -82,11 +82,11 @@
     this->enableCompression();
     assert( this->host_->socket4 != ENET_SOCKET_NULL || this->host_->socket6 != ENET_SOCKET_NULL );
     if (this->host_->socket4 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv4 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv4 Socket failed." << endl;
     else if (this->host_->socket6 == ENET_SOCKET_NULL)
-        COUT(2) << "Warning: IPv6 Socket failed." << std::endl;
+        orxout(internal_warning, context::network) << "IPv6 Socket failed." << endl;
     else
-        COUT(3) << "Info: Using IPv4 and IPv6 Sockets." << std::endl;
+        orxout(internal_info, context::network) << "Using IPv4 and IPv6 Sockets." << endl;
     
     // start communication thread
     Connection::startCommunicationThread();
@@ -113,7 +113,7 @@
     {
 //       ClientInformation *temp = ClientInformation::findClient(clientID);
 //       if(!temp){
-//         COUT(3) << "C.Man: addPacket findClient failed" << std::endl;
+//         orxout(internal_warning, context::network) << "C.Man: addPacket findClient failed" << endl;
 //       }
       Connection::addPacket(packet, clientID, channelID);
     }

Modified: code/branches/output/src/libraries/network/TrafficControl.cc
===================================================================
--- code/branches/output/src/libraries/network/TrafficControl.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/TrafficControl.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -286,9 +286,9 @@
   void TrafficControl::printList(std::list<obj>& list, unsigned int clientID)
   {
     std::list<obj>::iterator it;
-    COUT(0) << "=========== Objectlist ===========" << endl;
+    orxout(debug_output, context::network) << "=========== Objectlist ===========" << endl;
     for( it=list.begin(); it!=list.end(); it++)
-      COUT(0) << "ObjectID: " << it->objID << " creatorID: " << it->objCreatorID << " Priority: " << clientListPerm_[clientID][it->objID].objValuePerm + clientListPerm_[clientID][it->objID].objValueSched << " size: " << it->objSize << endl;
+      orxout(debug_output, context::network) << "ObjectID: " << it->objID << " creatorID: " << it->objCreatorID << " Priority: " << clientListPerm_[clientID][it->objID].objValuePerm + clientListPerm_[clientID][it->objID].objValueSched << " size: " << it->objSize << endl;
   }
 
   void TrafficControl::fixCreatorDependencies(std::list<obj>::iterator it1, std::list<obj>& list, unsigned int clientID)

Modified: code/branches/output/src/libraries/network/WANDiscoverable.cc
===================================================================
--- code/branches/output/src/libraries/network/WANDiscoverable.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/WANDiscoverable.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -43,7 +43,7 @@
   WANDiscoverable::WANDiscoverable(): bActive_(false)
   {
     /* debugging output */
-    COUT(4) << "Creating WANDiscoverable.\n";
+    orxout(verbose, context::master_server) << "Creating WANDiscoverable." << endl;
   
     /* register object in orxonox */
     RegisterObject(WANDiscoverable);
@@ -90,20 +90,20 @@
     /* initialize it and see if it worked */
     if( msc.initialize() )
     {
-      COUT(2) << "Error: could not initialize master server communications!\n";
+      orxout(internal_error, context::master_server) << "Could not initialize master server communications!" << endl;
       return false;
     }
     
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
     {
-      COUT(2) << "Error: could not connect to master server at " 
-                 << this->msaddress << std::endl;
+      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+                 << this->msaddress << endl;
       return false;
     }
                  
     /* debugging output */
-    COUT(4) << "Initialization of WANDiscoverable complete.\n";
+    orxout(verbose, context::master_server) << "Initialization of WANDiscoverable complete." << endl;
     
     
     // Now register the server at the master server

Modified: code/branches/output/src/libraries/network/WANDiscovery.cc
===================================================================
--- code/branches/output/src/libraries/network/WANDiscovery.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/WANDiscovery.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -44,7 +44,7 @@
   WANDiscovery::WANDiscovery()
   {
     /* debugging output */
-    COUT(4) << "Creating WANDiscovery.\n";
+    orxout(verbose, context::master_server) << "Creating WANDiscovery." << endl;
   
     /* register object in orxonox */
     RegisterObject(WANDiscovery);
@@ -54,15 +54,15 @@
 
     /* initialize it and see if it worked */
     if( msc.initialize() )
-      COUT(2) << "Error: could not initialize master server communications!\n";
+      orxout(internal_error, context::master_server) << "Could not initialize master server communications!" << endl;
 
     /* connect and see if it worked */
     if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
-      COUT(2) << "Error: could not connect to master server at " 
-        << this->msaddress << std::endl;
+      orxout(internal_error, context::master_server) << "Could not connect to master server at " 
+        << this->msaddress << endl;
 
     /* debugging output */
-    COUT(4) << "Initialization of WANDiscovery complete.\n";
+    orxout(verbose, context::master_server) << "Initialization of WANDiscovery complete." << endl;
   }
 
   void WANDiscovery::setConfigValues()
@@ -84,7 +84,7 @@
   { 
     /* error recognition */
     if( !ev || !ev->packet || !ev->packet->data )
-    { COUT(2) << "Bad arguments received in WANDiscovery's reply handler.\n";
+    { orxout(internal_warning, context::master_server) << "Bad arguments received in WANDiscovery's reply handler." << endl;
       return 0;
     }
 

Modified: code/branches/output/src/libraries/network/packet/Acknowledgement.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/Acknowledgement.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/Acknowledgement.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -63,7 +63,7 @@
 }
 
 bool Acknowledgement::process(orxonox::Host* host){
-  COUT(5) << "processing ACK with ID: " << getAckID() << endl;
+  orxout(verbose_more, context::packets) << "processing ACK with ID: " << getAckID() << endl;
   bool b = host->ackGamestate(getAckID(), peerID_);
   delete this;
   return b;

Modified: code/branches/output/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/ClassID.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/ClassID.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -91,7 +91,7 @@
   }
   assert(tempsize==packetSize);
 
-  COUT(5) << "classid packetSize is " << packetSize << endl;
+  orxout(verbose_more, context::packets) << "classid packetSize is " << packetSize << endl;
 
 }
 
@@ -130,7 +130,7 @@
   //clear the map of network ids
   Identifier::clearNetworkIDs();
 
-  COUT(4) << "=== processing classids: " << endl;
+  orxout(verbose, context::packets) << "=== processing classids: " << endl;
   std::pair<uint32_t, std::string> tempPair;
   Identifier *id;
   // read the total number of classes
@@ -142,9 +142,9 @@
     stringsize = *(uint32_t*)(temp+sizeof(uint32_t));
     classname = temp+2*sizeof(uint32_t);
     id=ClassByString( std::string((const char*)classname) );
-    COUT(3) << "processing classid: " << networkID << " name: " << classname << " id: " << id << std::endl;
+    orxout(internal_info, context::packets) << "processing classid: " << networkID << " name: " << classname << " id: " << id << endl;
     if(id==NULL){
-      COUT(0) << "Received a bad classname" << endl;
+      orxout(user_error, context::packets) << "Received a bad classname" << endl;
       abort();
     }
     id->setNetworkID( networkID );

Modified: code/branches/output/src/libraries/network/packet/DeleteObjects.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/DeleteObjects.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/DeleteObjects.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -61,7 +61,7 @@
   unsigned int number = Synchronisable::getNumberOfDeletedObject();
   if(number==0)
     return false;
-  COUT(4) << "sending DeleteObjects: ";
+  orxout(verbose, context::packets) << "sending DeleteObjects: ";
   unsigned int size = sizeof(Type::Value) + sizeof(uint32_t)*(number+1);
   data_ = new uint8_t[size];
   uint8_t *tdata = data_;
@@ -72,10 +72,10 @@
   for(unsigned int i=0; i<number; i++){
     unsigned int temp = Synchronisable::popDeletedObject();
     *reinterpret_cast<uint32_t*>(tdata) = temp;
-    COUT(4) << temp << ' ';
+    orxout(verbose, context::packets) << temp << ' ';
     tdata += sizeof(uint32_t);
   }
-  COUT(4) << std::endl;
+  orxout(verbose, context::packets) << endl;
   return true;
 }
 
@@ -89,7 +89,7 @@
 {
   for(unsigned int i=0; i<*(unsigned int *)(data_+_QUANTITY); i++)
   {
-    COUT(4) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << std::endl;
+    orxout(verbose, context::packets) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << endl;
     Synchronisable::deleteObject( *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) );
   }
   delete this;

Modified: code/branches/output/src/libraries/network/packet/FunctionIDs.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/FunctionIDs.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/FunctionIDs.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -87,7 +87,7 @@
     temp+=2*sizeof(uint32_t)+tempPair.second.size()+1;
   }
 
-  COUT(5) << "FunctionIDs packetSize is " << packetSize << endl;
+  orxout(verbose_more, context::packets) << "FunctionIDs packetSize is " << packetSize << endl;
 
 }
 
@@ -125,7 +125,7 @@
   uint32_t stringsize;
   unsigned char *functionname;
 
-  COUT(4) << "=== processing functionids: " << endl;
+  orxout(verbose, context::packets) << "=== processing functionids: " << endl;
   std::pair<uint32_t, std::string> tempPair;
   // read the total number of classes
   nrOfFunctions = *(uint32_t*)temp;
@@ -136,7 +136,7 @@
     networkID = *(uint32_t*)temp;
     stringsize = *(uint32_t*)(temp+sizeof(uint32_t));
     functionname = temp+2*sizeof(uint32_t);
-    COUT(3) << "processing functionid: " << networkID << " name: " << functionname << std::endl;
+    orxout(internal_info, context::packets) << "processing functionid: " << networkID << " name: " << functionname << endl;
     NetworkFunctionBase::setNetworkID((const char*)functionname, networkID);
     temp += 2*sizeof(uint32_t) + stringsize;
   }

Modified: code/branches/output/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/Gamestate.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/Gamestate.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -107,13 +107,13 @@
   assert(data_==0);
   uint32_t size = calcGamestateSize(id, mode);
 
-  COUT(5) << "G.ST.Man: producing gamestate with id: " << id << std::endl;
+  orxout(verbose_more, context::packets) << "G.ST.Man: producing gamestate with id: " << id << endl;
   if(size==0)
     return false;
   data_ = new uint8_t[size + GamestateHeader::getSize()];
   if(!data_)
   {
-    COUT(2) << "GameStateManager: could not allocate memory" << std::endl;
+    orxout(internal_warning, context::packets) << "GameStateManager: could not allocate memory" << endl;
     return false;
   }
 
@@ -138,7 +138,7 @@
     {
       assert(0); // if we don't use multithreading this part shouldn't be neccessary
       // start allocate additional memory
-      COUT(3) << "Gamestate: need additional memory" << std::endl;
+      orxout(internal_info, context::packets) << "Gamestate: need additional memory" << endl;
       ObjectList<Synchronisable>::iterator temp = it;
       uint32_t addsize=tempsize;
       while(++temp)
@@ -166,15 +166,15 @@
   header_.setCompressed( false );
   //stop write gamestate header
 
-  COUT(5) << "Gamestate: Gamestate size: " << currentsize << std::endl;
-  COUT(5) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << std::endl;
+  orxout(verbose_more, context::packets) << "Gamestate: Gamestate size: " << currentsize << endl;
+  orxout(verbose_more, context::packets) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << endl;
   return true;
 }
 
 
 bool Gamestate::spreadData(uint8_t mode)
 {
-  COUT(5) << "processing gamestate with id " << header_.getID() << endl;
+  orxout(verbose_more, context::packets) << "processing gamestate with id " << header_.getID() << endl;
   assert(data_);
   assert(!header_.isCompressed());
   uint8_t *mem=data_+GamestateHeader::getSize();
@@ -194,13 +194,13 @@
       }
       else
       {
-//         COUT(4) << "not creating object of classid " << objectheader.getClassID() << endl;
+//         orxout(verbose, context::packets) << "not creating object of classid " << objectheader.getClassID() << endl;
         mem += objectheader.getDataSize() + ( objectheader.isDiffed() ? SynchronisableHeaderLight::getSize() : SynchronisableHeader::getSize() );
       }
     }
     else
     {
-//       COUT(4) << "updating object of classid " << objectheader.getClassID() << endl;
+//       orxout(verbose, context::packets) << "updating object of classid " << objectheader.getClassID() << endl;
       OrxVerify(s->updateData(mem, mode), "ERROR: could not update Synchronisable with Gamestate data");
     }
   }
@@ -218,9 +218,9 @@
       {
         if (it->objectMode_ != 0x0)
         {
-          COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;
-          COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;
-          COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;
+          orxout(user_error, context::packets) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << endl;
+          orxout(user_error, context::packets) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << endl;
+          orxout(user_error, context::packets) << "Objects class: " << it->getIdentifier()->getName() << endl;
           assert(false);
         }
       }
@@ -231,9 +231,9 @@
         {
           if (it->getObjectID() == *it2)
           {
-            COUT(0) << "Found duplicate objectIDs on the client!" << std::endl
-                    << "Are you sure you don't create a Sychnronisable objcect with 'new' \
-                        that doesn't have objectMode = 0x0?" << std::endl;
+            orxout(user_error, context::packets) << "Found duplicate objectIDs on the client!" << endl
+                                                 << "Are you sure you don't create a Sychnronisable objcect with 'new' \
+                                                     that doesn't have objectMode = 0x0?" << endl;
             assert(false);
           }
         }
@@ -292,10 +292,10 @@
   retval = compress( dest, &buffer, source, (uLong)(header_.getDataSize()) );
   switch ( retval )
   {
-    case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;
-    case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl; return false;
-    case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl; return false;
-    case Z_DATA_ERROR: COUT(2) << "G.St.Man: compress: data corrupted in gamestate.compress" << std::endl; return false;
+    case Z_OK: orxout(verbose_more, context::packets) << "G.St.Man: compress: successfully compressed" << endl; break;
+    case Z_MEM_ERROR: orxout(internal_error, context::packets) << "G.St.Man: compress: not enough memory available in gamestate.compress" << endl; return false;
+    case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << endl; return false;
+    case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: data corrupted in gamestate.compress" << endl; return false;
   }
 
   //copy and modify header
@@ -309,7 +309,7 @@
   data_ = ndata;
   header_.setCompSize( buffer );
   header_.setCompressed( true );
-  COUT(4) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << std::endl;
+  orxout(verbose, context::packets) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << endl;
   return true;
 }
 
@@ -318,7 +318,7 @@
 {
   assert(data_);
   assert(header_.isCompressed());
-  COUT(4) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << std::endl;
+  orxout(verbose, context::packets) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << endl;
   uint32_t datasize = header_.getDataSize();
   uint32_t compsize = header_.getCompSize();
   uint32_t bufsize;
@@ -332,10 +332,10 @@
   retval = uncompress( dest, &length, source, (uLong)compsize );
   switch ( retval )
   {
-    case Z_OK: COUT(5) << "successfully decompressed" << std::endl; break;
-    case Z_MEM_ERROR: COUT(1) << "not enough memory available" << std::endl; return false;
-    case Z_BUF_ERROR: COUT(2) << "not enough memory available in the buffer" << std::endl; return false;
-    case Z_DATA_ERROR: COUT(2) << "data corrupted (zlib)" << std::endl; return false;
+    case Z_OK: orxout(verbose_more, context::packets) << "successfully decompressed" << endl; break;
+    case Z_MEM_ERROR: orxout(internal_error, context::packets) << "not enough memory available" << endl; return false;
+    case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "not enough memory available in the buffer" << endl; return false;
+    case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "data corrupted (zlib)" << endl; return false;
   }
 
   //copy over the header
@@ -374,7 +374,7 @@
   // Check whether the whole object stayed the same
   if( memcmp( origDataPtr+objectOffset, baseDataPtr+objectOffset, objectHeader.getDataSize()) == 0 )
   {
-//     COUT(4) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;
+//     orxout(verbose, context::packets) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;
     origDataPtr += objectOffset + objectHeader.getDataSize(); // skip the whole object
     baseDataPtr += objectOffset + objectHeader.getDataSize();
     sizes += Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables();
@@ -430,7 +430,7 @@
 
 inline void /*Gamestate::*/copyObject( uint8_t*& newData, uint8_t*& origData, uint8_t*& baseData, SynchronisableHeader& objectHeader, std::vector<uint32_t>::iterator& sizes )
 {
-  //       COUT(4) << "docopy" << endl;
+  //       orxout(verbose, context::packets) << "docopy" << endl;
   // Just copy over the whole Object
   memcpy( newData, origData, objectHeader.getDataSize()+SynchronisableHeader::getSize() );
   SynchronisableHeader(newData).setDiffed(false);
@@ -439,15 +439,15 @@
   origData += objectHeader.getDataSize()+SynchronisableHeader::getSize();
 //   SynchronisableHeader baseHeader( baseData );
 //   baseData += baseHeader.getDataSize()+SynchronisableHeader::getSize();
-  //       COUT(4) << "copy " << h.getObjectID() << endl;
-  //       COUT(4) << "copy " << h.getObjectID() << ":";
+  //       orxout(verbose, context::packets) << "copy " << h.getObjectID() << endl;
+  //       orxout(verbose, context::packets) << "copy " << h.getObjectID() << ":";
   sizes += Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables();
 //   for( unsigned int i = 0; i < Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables(); ++i )
 //   {
-//     //         COUT(4) << " " << *sizes;
+//     //         orxout(verbose, context::packets) << " " << *sizes;
 //     ++sizes;
 //   }
-    //       COUT(4) << endl;
+    //       orxout(verbose, context::packets) << endl;
 }
 
 inline bool findObject(uint8_t*& dataPtr, uint8_t* endPtr, SynchronisableHeader& objectHeader)
@@ -540,13 +540,13 @@
       assert(baseHeader.getDataSize() < 500);
       if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() )
       {
-//         COUT(4) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         diffedObject = true;
       }
       else
       {
-//         COUT(4) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
       }
@@ -564,20 +564,20 @@
         assert(baseHeader.getDataSize() < 500);
         if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() )
         {
-//           COUT(4) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//           orxout(verbose, context::packets) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
           diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
           diffedObject = true;
         }
         else
         {
-//           COUT(4) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//           orxout(verbose, context::packets) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
           copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
           assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
         }
       }
       else
       {
-//         COUT(4) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
+//         orxout(verbose, context::packets) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;
         assert(baseDataPtr == oldBaseDataPtr);
         copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt);
         assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd);
@@ -717,10 +717,10 @@
 
   //copy in the zeros
 //   std::list<obj>::iterator itt;
-//   COUT(0) << "myvector contains:";
+//   orxout() << "myvector contains:";
 //   for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ )
-//     COUT(0) << " " << (*itt).objID;
-//   COUT(0) << endl;
+//     orxout() << " " << (*itt).objID;
+//   orxout() << endl;
   for(it=dataVector_.begin(); it!=dataVector_.end();){
     SynchronisableHeader oldobjectheader(origdata);
     SynchronisableHeader newobjectheader(newdata);
@@ -770,7 +770,7 @@
     size+=it->getSize(id, mode); // size of the actual data of the synchronisable
     nrOfVariables += it->getNrOfVariables();
   }
-//   COUT(0) << "allocating " << nrOfVariables << " ints" << endl;
+//   orxout() << "allocating " << nrOfVariables << " ints" << endl;
   this->sizes_.reserve(nrOfVariables);
   return size;
 }

Modified: code/branches/output/src/libraries/network/packet/Packet.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/Packet.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/Packet.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -191,39 +191,39 @@
 //   if( peerID==static_cast<unsigned int>(-2))
 //     peerID = NETWORK_PEER_ID_SERVER;
   Packet *p = 0;
-//   COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;
+//   orxout(verbose_ultra, context::packets) << "packet type: " << *(Type::Value *)&data[_PACKETID] << endl;
   switch( *(Type::Value *)(data + _PACKETID) )
   {
     case Type::Acknowledgement:
-//       COUT(5) << "ack" << std::endl;
+//       orxout(verbose_more, context::packets) << "ack" << endl;
     p = new Acknowledgement( data, peerID );
       break;
     case Type::Chat:
-//       COUT(5) << "chat" << std::endl;
+//       orxout(verbose_more, context::packets) << "chat" << endl;
       p = new Chat( data, peerID );
       break;
     case Type::ClassID:
-//       COUT(5) << "classid" << std::endl;
+//       orxout(verbose_more, context::packets) << "classid" << endl;
       p = new ClassID( data, peerID );
       break;
     case Type::Gamestate:
-//       COUT(5) << "gamestate" << std::endl;
+//       orxout(verbose_more, context::packets) << "gamestate" << endl;
       p = new Gamestate( data, peerID );
       break;
     case Type::Welcome:
-//       COUT(5) << "welcome" << std::endl;
+//       orxout(verbose_more, context::packets) << "welcome" << endl;
       p = new Welcome( data, peerID );
       break;
     case Type::DeleteObjects:
-//       COUT(5) << "deleteobjects" << std::endl;
+//       orxout(verbose_more, context::packets) << "deleteobjects" << endl;
       p = new DeleteObjects( data, peerID );
       break;
     case Type::FunctionCalls:
-//       COUT(5) << "functionCalls" << std::endl;
+//       orxout(verbose_more, context::packets) << "functionCalls" << endl;
       p = new FunctionCalls( data, peerID );
       break;
     case Type::FunctionIDs:
-//       COUT(5) << "functionIDs" << std::endl;
+//       orxout(verbose_more, context::packets) << "functionIDs" << endl;
       p = new FunctionIDs( data, peerID );
       break;
     default:
@@ -254,7 +254,7 @@
   delete it->second;
   packetMap_.erase(it);
   Packet::packetMapMutex_.unlock();
-//   COUT(6) << "PacketMap size: " << packetMap_.size() << std::endl;
+//   orxout(verbose_ultra, context::packets) << "PacketMap size: " << packetMap_.size() << endl;
 }
 
 } // namespace packet

Modified: code/branches/output/src/libraries/network/packet/Welcome.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/Welcome.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/packet/Welcome.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -77,7 +77,7 @@
   clientID = *(uint32_t *)(data_ + _CLIENTID );
   assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321);
   host->setClientID(clientID);
-  COUT(3) << "Welcome set clientId: " << clientID << endl;
+  orxout(internal_info, context::packets) << "Welcome set clientId: " << clientID << endl;
   Synchronisable::setClient(true);
   delete this;
   return true;

Modified: code/branches/output/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/branches/output/src/libraries/network/synchronisable/Synchronisable.cc	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/synchronisable/Synchronisable.cc	2011-07-31 19:09:23 UTC (rev 8807)
@@ -129,15 +129,15 @@
     }
 //     assert( !header.isDiffed() );
 
-    COUT(4) << "fabricating object with id: " << header.getObjectID() << std::endl;
+    orxout(verbose, context::network) << "fabricating object with id: " << header.getObjectID() << endl;
 
     Identifier* id = ClassByID(header.getClassID());
     if (!id)
     {
         for(int i = 0; i<160; i++)
-            COUT(0) << "classid: " << i << " identifier: " << ClassByID(i) << endl;
-        COUT(0) << "Assertion failed: id" << std::endl;
-        COUT(0) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << std::endl;
+            orxout(user_error, context::network) << "classid: " << i << " identifier: " << ClassByID(i) << endl;
+        orxout(user_error, context::network) << "Assertion failed: id" << endl;
+        orxout(user_error, context::network) << "Possible reason for this error: Client received a synchronizable object whose class has no factory." << endl;
         abort();
     }
     assert(id);
@@ -167,7 +167,7 @@
     if( creator )
       bo->setLevel(creator->getLevel());          // Note: this ensures that the level is known on the client for child objects of the scene (and the scene itself)
     //assert(no->classID_ == header.getClassID());
-    COUT(4) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << std::endl;
+    orxout(verbose, context::network) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << endl;
           // update data and create object/entity...
     bool b = no->updateData(mem, mode, true);
     assert(b);
@@ -241,7 +241,7 @@
 #ifndef NDEBUG
     uint8_t* oldmem = mem;
     if (this->classID_==0)
-      COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
+      orxout(internal_info, context::network) << "classid 0 " << this->getIdentifier()->getName() << endl;
 #endif
 
     if (this->classID_ == static_cast<uint32_t>(-1))
@@ -257,20 +257,20 @@
     mem += SynchronisableHeader::getSize();
     // end copy header
 
-    CCOUT(5) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << std::endl;
-//     COUT(4) << "objectid: " << this->objectID_ << ":";
+    orxout(verbose_more, context::network) << "getting data from objectID_: " << objectID_ << ", classID_: " << classID_ << endl;
+//     orxout(verbose, context::network) << "objectid: " << this->objectID_ << ":";
     // copy to location
     for(i=syncList_.begin(); i!=syncList_.end(); ++i)
     {
       uint32_t varsize = (*i)->getData( mem, mode );
-//       COUT(4) << " " << varsize;
+//       orxout(verbose, context::network) << " " << varsize;
       tempsize += varsize;
       sizes.push_back(varsize);
       ++test;
       //tempsize += (*i)->getSize( mode );
     }
     assert(tempsize!=0);  // if this happens an empty object (with no variables) would be transmitted
-//     COUT(4) << endl;
+//     orxout(verbose, context::network) << endl;
 
     header.setObjectID( this->objectID_ );
     header.setCreatorID( this->creatorID_ );
@@ -304,8 +304,8 @@
     
     if(syncList_.empty())
     {
+      orxout(internal_warning, context::network) << "Synchronisable::updateData syncList_ is empty" << endl;
       assert(0);
-      COUT(2) << "Synchronisable::updateData syncList_ is empty" << std::endl;
       return false;
     }
 
@@ -325,7 +325,7 @@
       return true;
     }
 
-    //COUT(5) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
+    //orxout(verbose_more, context::network) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << endl;
     if( !syncHeaderLight.isDiffed() )
     {
       SynchronisableHeader syncHeader2(mem);
@@ -343,11 +343,11 @@
     else
     {
       mem += SynchronisableHeaderLight::getSize();
-//       COUT(0) << "objectID: " << this->objectID_ << endl;
+//       orxout(debug_output, context::network) << "objectID: " << this->objectID_ << endl;
       while( mem < data+syncHeaderLight.getDataSize()+SynchronisableHeaderLight::getSize() )
       {
         VariableID varID = *(VariableID*)mem;
-//         COUT(0) << "varID: " << varID << endl;
+//         orxout(debug_output, context::network) << "varID: " << varID << endl;
         assert( varID < syncList_.size() );
         mem += sizeof(VariableID);
         syncList_[varID]->putData( mem, mode, forceCallback );

Modified: code/branches/output/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/branches/output/src/libraries/network/synchronisable/Synchronisable.h	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/synchronisable/Synchronisable.h	2011-07-31 19:09:23 UTC (rev 8807)
@@ -231,7 +231,7 @@
       else
         it++;
     }
-    COUT(1) << "Tried to unregister not registered variable" << endl;
+    orxout(internal_error, context::network) << "Tried to unregister not registered variable" << endl;
     assert(false); //if we reach this point something went wrong:
     // the variable has not been registered before
   }

Modified: code/branches/output/src/libraries/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/branches/output/src/libraries/network/synchronisable/SynchronisableVariable.h	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/network/synchronisable/SynchronisableVariable.h	2011-07-31 19:09:23 UTC (rev 8807)
@@ -201,7 +201,7 @@
         // check that the client (source of the data) has a recent version of this variable
         if ( *static_cast<uint8_t*>(mem) != this->varReference_ )
         { // wrong reference number, so discard the data
-//           COUT(0) << "discharding data" << endl;
+//           orxout(debug_output, context::network) << "discharding data" << endl;
           mem += getSize( mode ); // SynchronisableVariableBidirectional::getSize returns size of variable + reference
           return;
         }

Modified: code/branches/output/src/libraries/util/output/OutputDefinitions.h
===================================================================
--- code/branches/output/src/libraries/util/output/OutputDefinitions.h	2011-07-31 15:15:13 UTC (rev 8806)
+++ code/branches/output/src/libraries/util/output/OutputDefinitions.h	2011-07-31 19:09:23 UTC (rev 8807)
@@ -90,6 +90,9 @@
             REGISTER_OUTPUT_CONTEXT(templates);
             REGISTER_OUTPUT_CONTEXT(loader);
             REGISTER_OUTPUT_CONTEXT(xml);
+            REGISTER_OUTPUT_CONTEXT(network);
+            REGISTER_OUTPUT_CONTEXT(packets);
+            REGISTER_OUTPUT_CONTEXT(master_server);
         }
     }
 }




More information about the Orxonox-commit mailing list