Changeset 2112 for code/branches/objecthierarchy/src/network
- Timestamp:
- Nov 2, 2008, 12:54:17 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/network
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/network/ChatListener.cc
r2072 r2112 32 32 #include "core/Core.h" 33 33 34 namespace network34 namespace orxonox 35 35 { 36 36 ChatListener::ChatListener() -
code/branches/objecthierarchy/src/network/ChatListener.h
r2072 r2112 35 35 #include "core/OrxonoxClass.h" 36 36 37 namespace network37 namespace orxonox 38 38 { 39 class _NetworkExport ChatListener : virtual public orxonox::OrxonoxClass39 class _NetworkExport ChatListener : virtual public OrxonoxClass 40 40 { 41 41 public: -
code/branches/objecthierarchy/src/network/Client.cc
r2070 r2112 49 49 // #include "packet/Acknowledgement.h" 50 50 51 namespace network51 namespace orxonox 52 52 { 53 53 // SetConsoleCommandShortcut(Client, chat); -
code/branches/objecthierarchy/src/network/Client.h
r1953 r2112 54 54 55 55 56 namespace network56 namespace orxonox 57 57 { 58 58 /** 59 network::Client *client;59 Client *client; 60 60 * The network/Client class 61 61 * This class implements all necessary function for the network communication -
code/branches/objecthierarchy/src/network/ClientConnection.cc
r2111 r2112 48 48 #include "util/Debug.h" 49 49 50 namespace network50 namespace orxonox 51 51 { 52 52 //static boost::thread_group network_threads; … … 72 72 bool ClientConnection::waitEstablished(int milisec) { 73 73 for(int i=0; i<=milisec && !established; i++) 74 orxonox::msleep(1);74 msleep(1); 75 75 76 76 return established; … … 184 184 case ENET_EVENT_TYPE_NONE: 185 185 //receiverThread_->yield(); 186 orxonox::msleep(1);186 msleep(1); 187 187 break; 188 188 } -
code/branches/objecthierarchy/src/network/ClientConnection.h
r1953 r2112 50 50 namespace boost { class thread; } 51 51 52 namespace network52 namespace orxonox 53 53 { 54 54 -
code/branches/objecthierarchy/src/network/ClientConnectionListener.cc
r1949 r2112 3 3 #include "core/Core.h" 4 4 5 namespace network{5 namespace orxonox{ 6 6 7 7 ClientConnectionListener::ClientConnectionListener() … … 11 11 12 12 void ClientConnectionListener::getConnectedClients(){ 13 if( orxonox::Core::showsGraphics())13 if(Core::showsGraphics()) 14 14 this->clientConnected(0); //server client id 15 15 ClientInformation *client = ClientInformation::getBegin(); -
code/branches/objecthierarchy/src/network/ClientConnectionListener.h
r1940 r2112 6 6 #include "core/OrxonoxClass.h" 7 7 8 namespace network{8 namespace orxonox{ 9 9 10 class _NetworkExport ClientConnectionListener : virtual public orxonox::OrxonoxClass10 class _NetworkExport ClientConnectionListener : virtual public OrxonoxClass 11 11 { 12 12 friend class Server; -
code/branches/objecthierarchy/src/network/ClientInformation.cc
r2009 r2112 43 43 #include <iostream> //debug 44 44 45 namespace network45 namespace orxonox 46 46 { 47 47 -
code/branches/objecthierarchy/src/network/ClientInformation.h
r2009 r2112 48 48 // WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE 49 49 50 namespace network50 namespace orxonox 51 51 { 52 52 static const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1; -
code/branches/objecthierarchy/src/network/ConnectionManager.cc
r2111 r2112 65 65 } 66 66 67 namespace network67 namespace orxonox 68 68 { 69 69 //boost::thread_group network_threads; … … 227 227 case ENET_EVENT_TYPE_NONE: 228 228 //receiverThread_->yield(); 229 orxonox::msleep(1);229 msleep(1); 230 230 break; 231 231 } … … 306 306 unsigned int network_id=0, failures=0; 307 307 std::string classname; 308 orxonox::Identifier *id;309 std::map<std::string, orxonox::Identifier*>::const_iterator it = orxonox::Factory::getFactoryMapBegin();310 while(it != orxonox::Factory::getFactoryMapEnd()){308 Identifier *id; 309 std::map<std::string, Identifier*>::const_iterator it = Factory::getFactoryMapBegin(); 310 while(it != Factory::getFactoryMapEnd()){ 311 311 id = (*it).second; 312 312 if(id == NULL) -
code/branches/objecthierarchy/src/network/ConnectionManager.h
r1953 r2112 59 59 } 60 60 61 namespace network61 namespace orxonox 62 62 { 63 63 const int NETWORK_PORT = 55556; -
code/branches/objecthierarchy/src/network/GamestateClient.cc
r2063 r2112 39 39 40 40 41 namespace network41 namespace orxonox 42 42 { 43 43 struct _NetworkExport GameStateItem{ … … 94 94 * @return iterator pointing to the next object in the list 95 95 */ 96 void GamestateClient::removeObject( orxonox::ObjectList<Synchronisable>::iterator &it) {97 orxonox::ObjectList<Synchronisable>::iterator temp=it;96 void GamestateClient::removeObject(ObjectList<Synchronisable>::iterator &it) { 97 ObjectList<Synchronisable>::iterator temp=it; 98 98 ++it; 99 99 delete *temp; -
code/branches/objecthierarchy/src/network/GamestateClient.h
r2006 r2112 50 50 const unsigned int GAMESTATEID_INITIAL = (unsigned int)-1; 51 51 52 namespace network52 namespace orxonox 53 53 { 54 54 class _NetworkExport GamestateClient: public GamestateHandler … … 66 66 private: 67 67 packet::Gamestate *processGamestate(packet::Gamestate *gs); 68 void removeObject( orxonox::ObjectListIterator<Synchronisable> &it);68 void removeObject(ObjectListIterator<Synchronisable> &it); 69 69 void printGamestateMap(); 70 70 bool sendAck(unsigned int gamestateID); -
code/branches/objecthierarchy/src/network/GamestateHandler.cc
r1763 r2112 4 4 #include "packet/Packet.h" 5 5 6 namespace network{6 namespace orxonox { 7 7 8 8 GamestateHandler *GamestateHandler::instance_=0; … … 22 22 23 23 24 }//namespace network24 }//namespace orxonox -
code/branches/objecthierarchy/src/network/GamestateHandler.h
r1990 r2112 34 34 #include "packet/Chat.h" 35 35 36 namespace network{36 namespace orxonox { 37 37 38 38 /** -
code/branches/objecthierarchy/src/network/GamestateManager.cc
r2035 r2112 51 51 #include "Synchronisable.h" 52 52 53 namespace network53 namespace orxonox 54 54 { 55 55 GamestateManager::GamestateManager() { -
code/branches/objecthierarchy/src/network/GamestateManager.h
r1990 r2112 47 47 #include "packet/Gamestate.h" 48 48 49 namespace network49 namespace orxonox 50 50 { 51 51 -
code/branches/objecthierarchy/src/network/Host.cc
r1953 r2112 34 34 #include "ChatListener.h" 35 35 36 namespace network{36 namespace orxonox { 37 37 38 38 SetConsoleCommandShortcut(Host, Chat); … … 80 80 // } 81 81 82 // bool Host::receiveChat( network::packet::Chat *message, unsigned int clientID){82 // bool Host::receiveChat(packet::Chat *message, unsigned int clientID){ 83 83 // if(instance_) 84 84 // return instance_->processChat(message, clientID); … … 110 110 111 111 bool Host::incomingChat(const std::string& message, unsigned int playerID){ 112 for ( orxonox::ObjectList<ChatListener>::iterator it = orxonox::ObjectList<ChatListener>::begin(); it != orxonox::ObjectList<ChatListener>::end(); ++it)112 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 113 113 it->incomingChat(message, playerID); 114 114 … … 116 116 } 117 117 118 }//namespace network118 }//namespace orxonox -
code/branches/objecthierarchy/src/network/Host.h
r1953 r2112 34 34 #include "packet/Chat.h" 35 35 36 namespace network{36 namespace orxonox { 37 37 38 38 /** -
code/branches/objecthierarchy/src/network/NetworkCallback.h
r1947 r2112 4 4 #include "NetworkPrereqs.h" 5 5 6 namespace network{6 namespace orxonox{ 7 7 class _NetworkExport NetworkCallbackBase 8 8 { -
code/branches/objecthierarchy/src/network/NetworkPrereqs.h
r1938 r2112 59 59 // Forward declarations 60 60 //----------------------------------------------------------------------- 61 namespace network61 namespace orxonox 62 62 { 63 63 class Client; -
code/branches/objecthierarchy/src/network/PacketBuffer.cc
r1505 r2112 39 39 #include <boost/thread/mutex.hpp> 40 40 41 namespace network41 namespace orxonox 42 42 { 43 43 boost::recursive_mutex PacketBuffer::mutex_; … … 147 147 } 148 148 149 } // namespace network149 } // namespace orxonox -
code/branches/objecthierarchy/src/network/PacketBuffer.h
r1916 r2112 47 47 #include <boost/thread/recursive_mutex.hpp> 48 48 49 namespace network49 namespace orxonox 50 50 { 51 51 struct _NetworkExport PacketEnvelope{ -
code/branches/objecthierarchy/src/network/Server.cc
r2048 r2112 60 60 #include "ChatListener.h" 61 61 62 namespace network62 namespace orxonox 63 63 { 64 64 const unsigned int MAX_FAILURES = 20; … … 317 317 318 318 // inform all the listeners 319 orxonox::ObjectList<ClientConnectionListener>::iterator listener = orxonox::ObjectList<ClientConnectionListener>::begin();319 ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin(); 320 320 while(listener){ 321 321 listener->clientConnected(newid); … … 366 366 367 367 // inform all the listeners 368 orxonox::ObjectList<ClientConnectionListener>::iterator listener = orxonox::ObjectList<ClientConnectionListener>::begin();368 ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin(); 369 369 while(listener){ 370 370 listener->clientDisconnected(client->getID()); … … 404 404 } 405 405 // COUT(1) << "Player " << Host::getPlayerID() << ": " << message << std::endl; 406 for ( orxonox::ObjectList<ChatListener>::iterator it = orxonox::ObjectList<ChatListener>::begin(); it != orxonox::ObjectList<ChatListener>::end(); ++it)406 for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it) 407 407 it->incomingChat(message, clientID); 408 408 -
code/branches/objecthierarchy/src/network/Server.h
r2009 r2112 49 49 #include "GamestateManager.h" 50 50 51 namespace network51 namespace orxonox 52 52 { 53 53 const int CLIENTID_SERVER = 0; -
code/branches/objecthierarchy/src/network/Synchronisable.cc
r2062 r2112 50 50 // #include "core/Identifier.h" 51 51 52 namespace network52 namespace orxonox 53 53 { 54 54 … … 63 63 * Initializes all Variables and sets the right objectID 64 64 */ 65 Synchronisable::Synchronisable( orxonox::BaseObject* creator){65 Synchronisable::Synchronisable(BaseObject* creator){ 66 66 RegisterRootObject(Synchronisable); 67 67 static uint32_t idCounter=0; … … 96 96 Synchronisable::~Synchronisable(){ 97 97 // delete callback function objects 98 if(! orxonox::Identifier::isCreatingHierarchy()){98 if(!Identifier::isCreatingHierarchy()){ 99 99 for(std::list<synchronisableVariable *>::iterator it = syncList->begin(); it!=syncList->end(); it++) 100 100 delete (*it)->callback; … … 155 155 COUT(4) << "fabricating object with id: " << header->objectID << std::endl; 156 156 157 orxonox::Identifier* id = ClassByID(header->classID);157 Identifier* id = ClassByID(header->classID); 158 158 assert(id); 159 orxonox::BaseObject* creator = 0;159 BaseObject* creator = 0; 160 160 if (header->creatorID != OBJECTID_UNKNOWN) 161 161 { … … 167 167 } 168 168 else 169 creator = dynamic_cast< orxonox::BaseObject*>(synchronisable_creator);170 } 171 orxonox::BaseObject *bo = id->fabricate(creator);169 creator = dynamic_cast<BaseObject*>(synchronisable_creator); 170 } 171 BaseObject *bo = id->fabricate(creator); 172 172 assert(bo); 173 173 Synchronisable *no = dynamic_cast<Synchronisable *>(bo); … … 214 214 */ 215 215 Synchronisable* Synchronisable::getSynchronisable(unsigned int objectID){ 216 orxonox::ObjectList<Synchronisable>::iterator it;217 for(it = orxonox::ObjectList<Synchronisable>::begin(); it; ++it){216 ObjectList<Synchronisable>::iterator it; 217 for(it = ObjectList<Synchronisable>::begin(); it; ++it){ 218 218 if( it->getObjectID()==objectID ) 219 219 return *it; … … 234 234 * @param var pointer to the variable 235 235 * @param size size of the datatype the variable consists of 236 * @param t the type of the variable ( network::DATA or network::STRING236 * @param t the type of the variable (DATA or STRING 237 237 * @param mode same as in getData 238 238 * @param cb callback object that should get called, if the value of the variable changes -
code/branches/objecthierarchy/src/network/Synchronisable.h
r2034 r2112 42 42 43 43 #define REGISTERDATA(varname, ...) \ 44 registerVar((void*)&varname, sizeof(varname), network::DATA, __VA_ARGS__)44 registerVar((void*)&varname, sizeof(varname), DATA, __VA_ARGS__) 45 45 #define REGISTERSTRING(stringname, ...) \ 46 registerVar(&stringname, stringname.length()+1, network::STRING, __VA_ARGS__)46 registerVar(&stringname, stringname.length()+1, STRING, __VA_ARGS__) 47 47 48 namespace network48 namespace orxonox 49 49 { 50 50 static const unsigned int OBJECTID_UNKNOWN = (unsigned int)-1; … … 95 95 * @author Oliver Scheuss 96 96 */ 97 class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{97 class _NetworkExport Synchronisable : virtual public OrxonoxClass{ 98 98 public: 99 99 friend class packet::Gamestate; … … 115 115 inline unsigned int getClassID(){return classID;} 116 116 protected: 117 Synchronisable( orxonox::BaseObject* creator);117 Synchronisable(BaseObject* creator); 118 118 void registerVar(void *var, int size, variableType t, int mode=1, NetworkCallbackBase *cb=0); 119 119 void setObjectMode(int mode); -
code/branches/objecthierarchy/src/network/packet/Acknowledgement.cc
r1907 r2112 33 33 #include "core/CoreIncludes.h" 34 34 35 namespace network{35 namespace orxonox { 36 36 namespace packet { 37 37 38 38 #define PACKET_FLAGS_ACK 0 39 39 #define _PACKETID 0 40 #define _ACKID _PACKETID + sizeof( network::packet::ENUM::Type)40 #define _ACKID _PACKETID + sizeof(packet::ENUM::Type) 41 41 42 42 Acknowledgement::Acknowledgement( unsigned int id, unsigned int clientID ) … … 74 74 75 75 } //namespace packet 76 } //namespace network76 } //namespace orxonox -
code/branches/objecthierarchy/src/network/packet/Acknowledgement.h
r1916 r2112 33 33 34 34 35 namespace network{35 namespace orxonox { 36 36 namespace packet { 37 37 /** … … 53 53 54 54 } //namespace packet 55 } //namespace network55 } //namespace orxonox 56 56 57 57 #endif -
code/branches/objecthierarchy/src/network/packet/Chat.cc
r1907 r2112 31 31 #include "network/Host.h" 32 32 33 namespace network{33 namespace orxonox { 34 34 namespace packet { 35 35 … … 77 77 78 78 } //namespace packet 79 } //namespace network79 } //namespace orxonox -
code/branches/objecthierarchy/src/network/packet/Chat.h
r1916 r2112 10 10 #include "Packet.h" 11 11 12 namespace network{12 namespace orxonox { 13 13 namespace packet { 14 14 /** … … 33 33 34 34 } //namespace packet 35 } //namespace network35 } //namespace orxonox 36 36 37 37 #endif -
code/branches/objecthierarchy/src/network/packet/ClassID.cc
r1907 r2112 34 34 #include <assert.h> 35 35 36 namespace network{36 namespace orxonox { 37 37 namespace packet { 38 38 … … 68 68 69 69 unsigned int ClassID::getSize() const{ 70 return sizeof( network::packet::ENUM::Type) + 2*sizeof(uint32_t) + classNameLength_;70 return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t) + classNameLength_; 71 71 } 72 72 73 73 bool ClassID::process(){ 74 74 COUT(3) << "processing classid: " << getClassID() << " name: " << (const char*)(data_+_CLASSNAME) << std::endl; 75 orxonox::Identifier *id=ClassByID( std::string((const char*)(data_+_CLASSNAME) ));75 Identifier *id=ClassByID( std::string((const char*)(data_+_CLASSNAME) )); 76 76 if(id==NULL) 77 77 return false; … … 86 86 87 87 } //namespace packet 88 }//namespace network88 }//namespace orxonox -
code/branches/objecthierarchy/src/network/packet/ClassID.h
r1916 r2112 35 35 #include "Packet.h" 36 36 37 namespace network{37 namespace orxonox { 38 38 namespace packet { 39 39 … … 59 59 60 60 } //namespace packet 61 } //namespace network61 } //namespace orxonox 62 62 63 63 #endif -
code/branches/objecthierarchy/src/network/packet/DeleteObjects.cc
r1907 r2112 34 34 #include <assert.h> 35 35 36 namespace network{36 namespace orxonox { 37 37 namespace packet { 38 38 … … 95 95 96 96 } //namespace packet 97 } //namespace network97 } //namespace orxonox -
code/branches/objecthierarchy/src/network/packet/DeleteObjects.h
r1916 r2112 34 34 35 35 36 namespace network{36 namespace orxonox { 37 37 namespace packet { 38 38 /** … … 55 55 56 56 } //namespace packet 57 } //namespace network57 } //namespace orxonox 58 58 59 59 #endif -
code/branches/objecthierarchy/src/network/packet/Gamestate.cc
r2111 r2112 38 38 39 39 40 namespace network{40 namespace orxonox { 41 41 42 42 namespace packet { … … 93 93 uint8_t *mem=data_; 94 94 mem+=sizeof(GamestateHeader); 95 orxonox::ObjectList<Synchronisable>::iterator it;96 for(it = orxonox::ObjectList<Synchronisable>::begin(); it; ++it){95 ObjectList<Synchronisable>::iterator it; 96 for(it = ObjectList<Synchronisable>::begin(); it; ++it){ 97 97 tempsize=it->getSize(id, mode); 98 98 … … 100 100 // start allocate additional memory 101 101 COUT(3) << "G.St.Man: need additional memory" << std::endl; 102 orxonox::ObjectList<Synchronisable>::iterator temp = it;102 ObjectList<Synchronisable>::iterator temp = it; 103 103 int addsize=tempsize; 104 104 while(++temp) … … 147 147 uint8_t *mem=data_+sizeof(GamestateHeader); 148 148 // get the start of the Synchronisable list 149 // orxonox::ObjectList<Synchronisable>::iterator it=orxonox::ObjectList<Synchronisable>::begin();149 //ObjectList<Synchronisable>::iterator it=ObjectList<Synchronisable>::begin(); 150 150 Synchronisable *s; 151 151 … … 244 244 //copy and modify header 245 245 #ifndef NDEBUG 246 HEADER->crc32 = orxonox::calcCRC(data_+sizeof(GamestateHeader), HEADER->datasize);246 HEADER->crc32 = calcCRC(data_+sizeof(GamestateHeader), HEADER->datasize); 247 247 #endif 248 248 *GAMESTATE_HEADER(ndata) = *HEADER; … … 281 281 } 282 282 #ifndef NDEBUG 283 assert(HEADER->crc32== orxonox::calcCRC(ndata+sizeof(GamestateHeader), HEADER->datasize));283 assert(HEADER->crc32==calcCRC(ndata+sizeof(GamestateHeader), HEADER->datasize)); 284 284 #endif 285 285 … … 569 569 int size=0; 570 570 // get the start of the Synchronisable list 571 orxonox::ObjectList<Synchronisable>::iterator it;571 ObjectList<Synchronisable>::iterator it; 572 572 // get total size of gamestate 573 for(it = orxonox::ObjectList<Synchronisable>::begin(); it; ++it)573 for(it = ObjectList<Synchronisable>::begin(); it; ++it) 574 574 size+=it->getSize(id, mode); // size of the actual data of the synchronisable 575 575 // size+=sizeof(GamestateHeader); … … 582 582 * @return iterator pointing to the next object in the list 583 583 */ 584 void Gamestate::removeObject( orxonox::ObjectList<Synchronisable>::iterator &it) {585 orxonox::ObjectList<Synchronisable>::iterator temp=it;584 void Gamestate::removeObject(ObjectList<Synchronisable>::iterator &it) { 585 ObjectList<Synchronisable>::iterator temp=it; 586 586 ++it; 587 587 delete *temp; -
code/branches/objecthierarchy/src/network/packet/Gamestate.h
r1916 r2112 40 40 #endif 41 41 42 namespace network{42 namespace orxonox { 43 43 44 44 namespace packet { … … 91 91 private: 92 92 unsigned int calcGamestateSize(unsigned int id, int mode=0x0); 93 void removeObject( orxonox::ObjectListIterator<Synchronisable> &it);93 void removeObject(ObjectListIterator<Synchronisable> &it); 94 94 std::map<unsigned int, Synchronisable*> dataMap_; 95 95 }; -
code/branches/objecthierarchy/src/network/packet/Packet.cc
r2084 r2112 46 46 #include "core/CoreIncludes.h" 47 47 48 namespace network{48 namespace orxonox{ 49 49 50 50 namespace packet{ … … 153 153 // ENetPacket *temp = enetPacket_; 154 154 // enetPacket_ = 0; // otherwise we have a double free because enet already handles the deallocation of the packet 155 network::Host::addPacket( enetPacket_, clientID_);155 Host::addPacket( enetPacket_, clientID_); 156 156 return true; 157 157 } … … 219 219 } // namespace packet 220 220 221 } // namespace network222 221 } // namespace orxonox 222 -
code/branches/objecthierarchy/src/network/packet/Packet.h
r2070 r2112 36 36 #include "util/Integers.h" 37 37 38 namespace network{38 namespace orxonox { 39 39 40 40 namespace packet{ … … 98 98 } //namespace packet 99 99 100 } //namespace network100 } //namespace orxonox 101 101 102 102 #endif -
code/branches/objecthierarchy/src/network/packet/Welcome.cc
r1907 r2112 36 36 #include <assert.h> 37 37 38 namespace network{38 namespace orxonox { 39 39 namespace packet { 40 40 … … 70 70 71 71 unsigned int Welcome::getSize() const{ 72 return sizeof( network::packet::ENUM::Type) + 2*sizeof(uint32_t);72 return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t); 73 73 } 74 74 … … 87 87 88 88 } //namespace packet 89 }//namespace network89 }//namespace orxonox -
code/branches/objecthierarchy/src/network/packet/Welcome.h
r1916 r2112 33 33 #include "Packet.h" 34 34 35 namespace network{35 namespace orxonox { 36 36 namespace packet { 37 37 … … 54 54 55 55 } //namespace packet 56 } //namespace network56 } //namespace orxonox 57 57 58 58 #endif
Note: See TracChangeset
for help on using the changeset viewer.