Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 11, 2009, 4:06:31 PM (15 years ago)
Author:
rgrieder
Message:

Removed all enet and boost includes from header files in the network library.

  • Reduces dependencies
  • Minimises problems with windows.h
  • Speeds up the compiling process a little bit (probably negligible)
  • Also removes ugly WIN32_LEAN_AND_MEAN declarations before every enet.h include in the network library.

Removed windows.h header from util/Sleep.h by adding Sleep.cc

Location:
code/trunk/src/network/packet
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/network/packet/Chat.cc

    r2171 r2773  
    2828
    2929#include "Chat.h"
    30 #include <assert.h>
     30
     31#include <enet/enet.h>
     32#include <cassert>
    3133#include "network/Host.h"
    3234
  • code/trunk/src/network/packet/ClassID.cc

    r2759 r2773  
    3030
    3131#include "ClassID.h"
     32#include <enet/enet.h>
    3233#include "core/CoreIncludes.h"
    3334#include "core/Factory.h"
    3435#include <cstring>
    3536#include <string>
    36 #include <assert.h>
     37#include <cassert>
    3738#include <map>
    3839#include <queue>
  • code/trunk/src/network/packet/DeleteObjects.cc

    r2756 r2773  
    2929
    3030#include "DeleteObjects.h"
    31 #ifndef WIN32_LEAN_AND_MEAN
    32 #  define WIN32_LEAN_AND_MEAN
    33 #endif
    34 #define NOMINMAX // required to stop windows.h screwing up std::min definition
    3531#include <enet/enet.h>
    3632#include "network/synchronisable/Synchronisable.h"
    3733#include "core/CoreIncludes.h"
    38 #include <assert.h>
     34#include <cassert>
    3935
    4036namespace orxonox {
  • code/trunk/src/network/packet/Gamestate.cc

    r2759 r2773  
    2828
    2929#include "Gamestate.h"
     30#include <enet/enet.h>
     31#include <zlib.h>
     32#include <cassert>
    3033#include "../GamestateHandler.h"
    3134#include "../synchronisable/Synchronisable.h"
     
    3538#include "core/Iterator.h"
    3639
    37 #include <zlib.h>
    38 #include <cassert>
    3940
    4041
  • code/trunk/src/network/packet/Packet.cc

    r2756 r2773  
    3131
    3232#include <cassert>
    33 #ifndef WIN32_LEAN_AND_MEAN
    34 #  define WIN32_LEAN_AND_MEAN
    35 #endif
    36 #define NOMINMAX // required to stop windows.h screwing up std::min definition
    3733#include <enet/enet.h>
    3834#include <boost/bind.hpp>
     35#include <boost/thread/recursive_mutex.hpp>
    3936
    4037#include "network/ConnectionManager.h"
     
    5855
    5956std::map<size_t, Packet *> Packet::packetMap_;
    60 boost::recursive_mutex Packet::packetMap_mutex;
     57//! Static mutex for any packetMap_ access
     58static boost::recursive_mutex packetMap_mutex_g;
    6159
    6260Packet::Packet(){
     
    142140      // Assures we don't create a packet and destroy it right after in another thread
    143141      // without having a reference in the packetMap_
    144       boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);
     142      boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g);
    145143      packetMap_[(size_t)(void*)enetPacket_] = this;
    146144    }
     
    217215*/
    218216void Packet::deletePacket(ENetPacket *enetPacket){
    219   boost::recursive_mutex::scoped_lock lock(Packet::packetMap_mutex);
     217  boost::recursive_mutex::scoped_lock lock(packetMap_mutex_g);
    220218  // Get our Packet from a gloabal map with all Packets created in the send() method of Packet.
    221219  std::map<size_t, Packet*>::iterator it = packetMap_.find((size_t)enetPacket);
  • code/trunk/src/network/packet/Packet.h

    r2756 r2773  
    3232
    3333#include <map>
    34 #ifndef WIN32_LEAN_AND_MEAN
    35 #  define WIN32_LEAN_AND_MEAN
    36 #endif
    37 #define NOMINMAX // required to stop windows.h screwing up std::min definition
    38 #include <enet/enet.h>
    39 #include <boost/thread/recursive_mutex.hpp>
    4034
    4135namespace orxonox {
     
    7266    virtual unsigned int getSize() const =0;
    7367    virtual bool process()=0;
    74     enet_uint32 getFlags()
     68    uint32_t getFlags()
    7569      { return flags_; }
    7670    int getClientID()
     
    8478    Packet(uint8_t *data, unsigned int clientID);
    8579//    Packet(ENetPacket *packet, ENetPeer *peer);
    86     enet_uint32 flags_;
     80    uint32_t flags_;
    8781    unsigned int clientID_;
    8882    ENUM::Direction packetDirection_;
     
    9690  private:
    9791    static std::map<size_t, Packet *> packetMap_;
    98     //! Static mutex for any packetMap_ access
    99     static boost::recursive_mutex packetMap_mutex;
    10092    ENetPacket *enetPacket_;
    10193};
  • code/trunk/src/network/packet/Welcome.cc

    r2662 r2773  
    3131
    3232#include "Welcome.h"
     33#include <enet/enet.h>
     34#include <cassert>
    3335#include "network/Host.h"
    3436#include "network/synchronisable/Synchronisable.h"
    3537#include "core/CoreIncludes.h"
    36 #include <assert.h>
    3738
    3839namespace orxonox {
Note: See TracChangeset for help on using the changeset viewer.