Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/network/TrafficControl.cc

    r9667 r11071  
    3030
    3131#include <cassert>
    32 #include <boost/bind.hpp>
     32#include <functional>
    3333
    3434#include "core/CoreIncludes.h"
     
    3838namespace orxonox {
    3939
    40   static const unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1);
     40  static constexpr unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1);
     41  namespace arg = std::placeholders;
    4142
    4243  objInfo::objInfo(uint32_t ID, uint32_t creatorID, int32_t curGsID, int32_t diffGsID, uint32_t size, unsigned int prioperm, unsigned int priosched)
     
    6465*Initializing protected members
    6566*/
    66     TrafficControl *TrafficControl::instance_=0;
     67    TrafficControl *TrafficControl::instance_=nullptr;
    6768
    6869    /**
     
    7273    {
    7374    RegisterObject(TrafficControl);
    74       assert(instance_==0);
     75      assert(instance_==nullptr);
    7576      instance_=this;
    7677    this->setConfigValues();
     
    7879
    7980    /**
    80     * @brief Destructor: resets the instance pointer to 0
     81    * @brief Destructor: resets the instance pointer to nullptr
    8182    */
    8283    TrafficControl::~TrafficControl()
    8384    {
    84       instance_=0;
     85      instance_=nullptr;
    8586    }
    8687
     
    148149    // shortcut for maps
    149150    std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID];
    150     std::map<unsigned int, std::list<obj> >& objectListTemp = clientListTemp_[clientID];
     151    std::map<unsigned int, std::list<obj>>& objectListTemp = clientListTemp_[clientID];
    151152
    152153    for(itvec = objectListTemp[gamestateID].begin(); itvec != objectListTemp[gamestateID].end(); itvec++)
     
    180181    void TrafficControl::insertinClientListPerm(unsigned int clientID, obj objinf)
    181182    {
    182       std::map<unsigned int,std::map<unsigned int, objInfo> >::iterator itperm;//iterator clientListPerm over clientIDs
     183      std::map<unsigned int,std::map<unsigned int, objInfo>>::iterator itperm;//iterator clientListPerm over clientIDs
    183184    unsigned int gsid=GAMESTATEID_INITIAL, gsdiff=currentGamestateID, prioperm=Synchronisable::getSynchronisable(objinf.objID)->getPriority(), priomom=0;
    184185    clientListPerm_[clientID][objinf.objID] = objInfo(objinf.objID, objinf.objCreatorID,gsid,gsdiff, objinf.objSize,prioperm,priomom);
     
    258259
    259260      //sort copied list according to priorities
    260       // use boost bind here because we need to pass a memberfunction to stl sort
    261 //       sort( list.begin(), list.end(), boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
    262       list.sort( boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
    263 
    264 //       list.sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) );
     261      // use std::bind here because we need to pass a memberfunction to stl sort
     262//       sort( list.begin(), list.end(), std::bind(&TrafficControl::prioritySort, this, clientID, arg::_1, arg::_2) );
     263      list.sort( std::bind(&TrafficControl::prioritySort, this, clientID, arg::_1, arg::_2) );
     264
     265//       list.sort(std::bind(&TrafficControl::prioritySort, this, clientID, arg::_1, arg::_2) );
    265266
    266267      //now we check, that the creator of an object always exists on a client
     
    275276      cut(list, targetSize);
    276277      //now sort again after objDataOffset
    277 //       sort(list.begin(), list.end(), boost::bind(&TrafficControl::dataSort, this, _1, _2) );
    278       list.sort( boost::bind(&TrafficControl::dataSort, this, _1, _2) );
     278//       sort(list.begin(), list.end(), std::bind(&TrafficControl::dataSort, this, arg::_1, arg::_2) );
     279      list.sort( std::bind(&TrafficControl::dataSort, this, arg::_1, arg::_2) );
    279280
    280281      //diese Funktion updateClientList muss noch gemacht werden
Note: See TracChangeset for help on using the changeset viewer.