Changeset 10817 for code/branches/cpp11_v2/src/libraries/network
- Timestamp:
- Nov 19, 2015, 11:40:28 AM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries/network
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/network/Client.h
r8858 r10817 76 76 static Client* getInstance(){ return singletonPtr_s; } // tolua_export 77 77 78 bool establishConnection() ;78 bool establishConnection() override; 79 79 void setDestination( const std::string& serverAddress, unsigned int port ); // tolua_export 80 bool closeConnection() ;81 void queuePacket(ENetPacket* packet, int clientID, uint8_t channelID) ;82 virtual bool sendPacket( packet::Packet* packet ) { return packet->send( static_cast<Host*>(this) ); }83 virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID) ;84 virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID) ;85 virtual void printRTT() ;80 bool closeConnection() override; 81 void queuePacket(ENetPacket* packet, int clientID, uint8_t channelID) override; 82 virtual bool sendPacket( packet::Packet* packet ) override{ return packet->send( static_cast<Host*>(this) ); } 83 virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID) override; 84 virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID) override; 85 virtual void printRTT() override; 86 86 87 87 void update(const Clock& time); 88 88 protected: 89 virtual void connectionClosed() ;89 virtual void connectionClosed() override; 90 90 private: 91 91 Client(const Client& copy); // not used 92 virtual bool isServer_() {return false;}93 void processPacket(packet::Packet* packet) ;92 virtual bool isServer_() override{return false;} 93 void processPacket(packet::Packet* packet) override; 94 94 95 95 static Client* singletonPtr_s; -
code/branches/cpp11_v2/src/libraries/network/ClientConnection.h
r8327 r10817 57 57 uint32_t getRTT(); 58 58 private: 59 virtual void addPeer(uint32_t peerID) ;60 virtual void removePeer(uint32_t peerID) ;59 virtual void addPeer(uint32_t peerID) override; 60 virtual void removePeer(uint32_t peerID) override; 61 61 62 62 bool disconnectConnection(); -
code/branches/cpp11_v2/src/libraries/network/GamestateManager.h
r10774 r10817 83 83 ~GamestateManager(); 84 84 85 virtual bool addGamestate(packet::Gamestate *gs, unsigned int peerID) ;86 virtual bool ackGamestate(unsigned int gamestateID, unsigned int peerID) ;87 virtual uint32_t getLastReceivedGamestateID( unsigned int peerID ) ;88 virtual uint32_t getCurrentGamestateID() { if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }85 virtual bool addGamestate(packet::Gamestate *gs, unsigned int peerID) override; 86 virtual bool ackGamestate(unsigned int gamestateID, unsigned int peerID) override; 87 virtual uint32_t getLastReceivedGamestateID( unsigned int peerID ) override; 88 virtual uint32_t getCurrentGamestateID() override{ if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; } 89 89 90 90 bool processGamestates(); -
code/branches/cpp11_v2/src/libraries/network/LANDiscoverable.cc
r10768 r10817 109 109 { 110 110 case ENET_EVENT_TYPE_CONNECT: 111 orxout(verbose, context::network) << "Received LAN discovery connect from client " << event.peer->host->receivedAddress << endl;111 //orxout(verbose, context::network) << "Received LAN discovery connect from client " << event.peer->host->receivedAddress << endl; 112 112 break; 113 113 case ENET_EVENT_TYPE_DISCONNECT: … … 117 117 if( strcmp( LAN_DISCOVERY_MESSAGE, (char*)event.packet->data ) == 0 ) // check for a suitable orxonox client 118 118 { 119 orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl;119 //orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl; 120 120 packet::ServerInformation info; 121 121 info.setServerName(this->ownName); -
code/branches/cpp11_v2/src/libraries/network/NetworkFunction.h
r10768 r10817 114 114 115 115 // ignore the objectID because its a static function 116 virtual bool call(uint32_t objectID) { (*this->functor_)(); return true; }117 virtual bool call(uint32_t objectID, const MultiType& mt1) { (*this->functor_)(mt1); return true; }118 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2) { (*this->functor_)(mt1, mt2); return true; }119 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) { (*this->functor_)(mt1, mt2, mt3); return true; }120 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) { (*this->functor_)(mt1, mt2, mt3, mt4); return true; }121 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) { (*this->functor_)(mt1, mt2, mt3, mt4, mt5); return true; }116 virtual bool call(uint32_t objectID) override{ (*this->functor_)(); return true; } 117 virtual bool call(uint32_t objectID, const MultiType& mt1) override{ (*this->functor_)(mt1); return true; } 118 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2) override{ (*this->functor_)(mt1, mt2); return true; } 119 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) override{ (*this->functor_)(mt1, mt2, mt3); return true; } 120 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) override{ (*this->functor_)(mt1, mt2, mt3, mt4); return true; } 121 virtual bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) override{ (*this->functor_)(mt1, mt2, mt3, mt4, mt5); return true; } 122 122 123 123 private: … … 142 142 { } 143 143 144 inline bool call(uint32_t objectID) 144 inline bool call(uint32_t objectID) override 145 145 { 146 146 if ( Synchronisable::getSynchronisable(objectID)!=nullptr ) … … 152 152 return false; 153 153 } 154 inline bool call(uint32_t objectID, const MultiType& mt1) 154 inline bool call(uint32_t objectID, const MultiType& mt1) override 155 155 { 156 156 if ( Synchronisable::getSynchronisable(objectID)!=nullptr ) … … 162 162 return false; 163 163 } 164 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2) 164 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2) override 165 165 { 166 166 if ( Synchronisable::getSynchronisable(objectID)!=nullptr ) … … 172 172 return false; 173 173 } 174 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) 174 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) override 175 175 { 176 176 if ( Synchronisable::getSynchronisable(objectID)!=nullptr ) … … 182 182 return false; 183 183 } 184 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) 184 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) override 185 185 { 186 186 if ( Synchronisable::getSynchronisable(objectID)!=nullptr ) … … 192 192 return false; 193 193 } 194 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) 194 inline bool call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) override 195 195 { 196 196 if ( Synchronisable::getSynchronisable(objectID)!=nullptr ) -
code/branches/cpp11_v2/src/libraries/network/NetworkFunctionIncludes.h
r10774 r10817 56 56 ~StaticallyInitializedNetworkFunction() { delete function_; } 57 57 58 virtual void load() ;59 virtual void unload() ;58 virtual void load() override; 59 virtual void unload() override; 60 60 61 61 inline NetworkFunctionBase& getFunction() -
code/branches/cpp11_v2/src/libraries/network/NetworkStaticInitializationHandler.h
r10624 r10817 39 39 { 40 40 public: 41 virtual void setupHandler() ;42 virtual void shutdownHandler() ;41 virtual void setupHandler() override; 42 virtual void shutdownHandler() override; 43 43 44 virtual void loadModule(ModuleInstance* module) ;45 virtual void unloadModule(ModuleInstance* module) ;44 virtual void loadModule(ModuleInstance* module) override; 45 virtual void unloadModule(ModuleInstance* module) override; 46 46 }; 47 47 } -
code/branches/cpp11_v2/src/libraries/network/Server.h
r10622 r10817 61 61 void open(); 62 62 void close(); 63 void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID) ;64 virtual bool sendPacket( packet::Packet* packet ) { return packet->send( static_cast<Host*>(this) ); }63 void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID) override; 64 virtual bool sendPacket( packet::Packet* packet ) override{ return packet->send( static_cast<Host*>(this) ); } 65 65 void update(const Clock& time); 66 66 unsigned int getRTT(unsigned int clientID); 67 virtual void printRTT() ;67 virtual void printRTT() override; 68 68 float getPacketLoss(unsigned int clientID); 69 69 int getClientCount() { return this->clientIDs_.size();} … … 73 73 void updateGamestate(); 74 74 private: 75 virtual bool isServer_() {return true;}75 virtual bool isServer_() override{return true;} 76 76 unsigned int playerID(){return 0;} 77 77 78 void addPeer(uint32_t peerID) ;79 void removePeer(uint32_t peerID) ;80 void processPacket(packet::Packet* packet) ;78 void addPeer(uint32_t peerID) override; 79 void removePeer(uint32_t peerID) override; 80 void processPacket(packet::Packet* packet) override; 81 81 82 82 bool createClient(int clientID); … … 85 85 bool sendObjectDeletes(); 86 86 bool isValidTarget(unsigned int targetID); 87 virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID) ;88 virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID) ;87 virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID) override; 88 virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID) override; 89 89 void syncClassid(unsigned int clientID); 90 90 -
code/branches/cpp11_v2/src/libraries/network/TrafficControl.h
r10769 r10817 109 109 110 110 //ClientConnectionListener functions 111 virtual void clientConnected(unsigned int clientID) {};112 virtual void clientDisconnected(unsigned int clientID) ;111 virtual void clientConnected(unsigned int clientID) override{}; 112 virtual void clientDisconnected(unsigned int clientID) override; 113 113 114 114 -
code/branches/cpp11_v2/src/libraries/network/packet/Acknowledgement.h
r7801 r10817 46 46 ~Acknowledgement(); 47 47 48 inline unsigned int getSize() const ;49 virtual bool process(orxonox::Host* host) ;48 inline unsigned int getSize() const override; 49 virtual bool process(orxonox::Host* host) override; 50 50 51 51 unsigned int getAckID(); -
code/branches/cpp11_v2/src/libraries/network/packet/Chat.h
r8858 r10817 49 49 50 50 /* get size of packet */ 51 inline unsigned int getSize() const ;51 inline unsigned int getSize() const override; 52 52 53 53 /* process chat message packet and remove it afterwards */ 54 virtual bool process(orxonox::Host* host) ;54 virtual bool process(orxonox::Host* host) override; 55 55 56 56 /* Get the length of the message (not the full size of the packet) */ -
code/branches/cpp11_v2/src/libraries/network/packet/ClassID.h
r7801 r10817 47 47 ~ClassID(); 48 48 49 uint32_t getSize() const ;50 virtual bool process(orxonox::Host* host) ;49 uint32_t getSize() const override; 50 virtual bool process(orxonox::Host* host) override; 51 51 52 52 private: -
code/branches/cpp11_v2/src/libraries/network/packet/DeleteObjects.h
r7801 r10817 48 48 bool fetchIDs(); 49 49 50 inline unsigned int getSize() const ;51 virtual bool process(orxonox::Host* host) ;50 inline unsigned int getSize() const override; 51 virtual bool process(orxonox::Host* host) override; 52 52 53 53 private: -
code/branches/cpp11_v2/src/libraries/network/packet/FunctionCalls.h
r10624 r10817 52 52 ~FunctionCalls(); 53 53 54 inline unsigned int getSize() const 54 inline unsigned int getSize() const override 55 55 { assert(!this->isDataENetAllocated()); return currentSize_; } 56 virtual bool process(orxonox::Host* host) ;56 virtual bool process(orxonox::Host* host) override; 57 57 58 58 void addCall( uint32_t networkID, uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5); 59 virtual bool send(orxonox::Host* host) ;59 virtual bool send(orxonox::Host* host) override; 60 60 private: 61 61 std::queue<orxonox::FunctionCall> functionCalls_; -
code/branches/cpp11_v2/src/libraries/network/packet/FunctionIDs.h
r7801 r10817 47 47 ~FunctionIDs(); 48 48 49 virtual uint32_t getSize() const ;50 virtual bool process(orxonox::Host* host) ;49 virtual uint32_t getSize() const override; 50 virtual bool process(orxonox::Host* host) override; 51 51 52 52 private: -
code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.h
r10768 r10817 138 138 // void rawDiff( uint8_t* newdata, uint8_t* data, uint8_t* basedata, uint32_t datalength, uint32_t baselength); 139 139 // inline uint32_t findObject( const SynchronisableHeader& header, uint8_t* mem, uint32_t dataLength, uint32_t startPosition = 0 ); 140 virtual uint32_t getSize() const ;141 virtual bool process(orxonox::Host* host) ;140 virtual uint32_t getSize() const override; 141 virtual bool process(orxonox::Host* host) override; 142 142 uint32_t calcGamestateSize(uint32_t id, uint8_t mode=0x0); 143 143 // inline void diffObject( uint8_t*& newData, uint8_t*& origData, uint8_t*& baseData, SynchronisableHeader& objectHeader, std::vector<uint32_t>::iterator& sizes ); -
code/branches/cpp11_v2/src/libraries/network/packet/Welcome.h
r8706 r10817 45 45 virtual ~Welcome(); 46 46 47 uint8_t *getData() ;48 inline unsigned int getSize() const ;49 virtual bool process(orxonox::Host* host) ;47 uint8_t *getData() override; 48 inline unsigned int getSize() const override; 49 virtual bool process(orxonox::Host* host) override; 50 50 51 51 private: -
code/branches/cpp11_v2/src/libraries/network/synchronisable/NetworkCallback.h
r6417 r10817 53 53 NetworkCallback(T* object, void (T::*function) (void)) : object_(object), function_(function) {} 54 54 virtual ~NetworkCallback() {} 55 virtual void call() 55 virtual void call() override 56 56 { (this->object_->*function_)(); } 57 57 … … 68 68 NetworkCallbackNotify() {} 69 69 virtual ~NetworkCallbackNotify() {} 70 virtual void call() 70 virtual void call() override 71 71 { (this->object_->*function_)( this->oldValue_ ); } 72 72 void setOldValue(const U& value){ this->oldValue_ = value; } -
code/branches/cpp11_v2/src/libraries/network/synchronisable/SynchronisableVariable.h
r10768 r10817 74 74 virtual ~SynchronisableVariable(); 75 75 76 virtual inline uint8_t getMode() { return mode_; }77 virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode) ;78 virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false) ;79 virtual inline uint32_t getSize(uint8_t mode) ;80 virtual inline void* getReference() { return static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->variable_)); }76 virtual inline uint8_t getMode() override{ return mode_; } 77 virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode) override; 78 virtual inline void putData(uint8_t*& mem, uint8_t mode, bool forceCallback = false) override; 79 virtual inline uint32_t getSize(uint8_t mode) override; 80 virtual inline void* getReference() override{ return static_cast<void*>(const_cast<typename Loki::TypeTraits<T>::UnqualifiedType*>(&this->variable_)); } 81 81 protected: 82 82 T& variable_;
Note: See TracChangeset
for help on using the changeset viewer.