Changeset 9667 for code/trunk/src/libraries/network
- Timestamp:
- Aug 25, 2013, 9:08:42 PM (11 years ago)
- Location:
- code/trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core6 merged: 9552-9554,9556-9574,9577-9579,9585-9593,9596-9612,9626-9662
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/network/Client.cc
r9550 r9667 51 51 #include "FunctionCallManager.h" 52 52 #include "core/CoreIncludes.h" 53 #include "core/CommandLineParser.h"54 53 #include "core/Game.h" 54 #include "core/config/CommandLineParser.h" 55 55 56 56 namespace orxonox -
code/trunk/src/libraries/network/ClientConnectionListener.cc
r8327 r9667 35 35 namespace orxonox 36 36 { 37 RegisterAbstractClass(ClientConnectionListener).inheritsFrom(Class(Listable)); 38 37 39 ClientConnectionListener::ClientConnectionListener() 38 40 { 39 Register RootObject(ClientConnectionListener);41 RegisterObject(ClientConnectionListener); 40 42 } 41 43 -
code/trunk/src/libraries/network/ClientConnectionListener.h
r8327 r9667 31 31 32 32 #include "NetworkPrereqs.h" 33 #include "core/ OrxonoxClass.h"33 #include "core/object/Listable.h" 34 34 35 35 namespace orxonox 36 36 { 37 class _NetworkExport ClientConnectionListener : virtual public OrxonoxClass37 class _NetworkExport ClientConnectionListener : virtual public Listable 38 38 { 39 39 public: -
code/trunk/src/libraries/network/Host.cc
r8858 r9667 33 33 34 34 #include "core/CoreIncludes.h" 35 #include "core/ ObjectList.h"35 #include "core/object/ObjectList.h" 36 36 #include "core/command/ConsoleCommand.h" 37 37 #include "NetworkChatListener.h" … … 145 145 NetworkChatListener::NetworkChatListener() 146 146 { 147 Register RootObject(NetworkChatListener);147 RegisterObject(NetworkChatListener); 148 148 } 149 149 -
code/trunk/src/libraries/network/NetworkChatListener.h
r8858 r9667 32 32 #include "NetworkPrereqs.h" 33 33 34 #include "core/ OrxonoxClass.h"34 #include "core/object/Listable.h" 35 35 36 36 namespace orxonox … … 43 43 in Host and ChatManager. ChatManager is the main derivative of this interface. 44 44 */ 45 class _NetworkExport NetworkChatListener : virtual public OrxonoxClass45 class _NetworkExport NetworkChatListener : virtual public Listable 46 46 { 47 47 friend class Host; -
code/trunk/src/libraries/network/NetworkFunction.cc
r7284 r9667 37 37 std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_; 38 38 39 // no suitable factory for NetworkFunctionBase (and children), so we declare it abstract 40 RegisterAbstractClass(NetworkFunctionBase).inheritsFrom(Class(Listable)); 41 RegisterAbstractClass(NetworkFunctionStatic).inheritsFrom(Class(NetworkFunctionBase)); 42 RegisterAbstractClass(NetworkMemberFunctionBase).inheritsFrom(Class(NetworkFunctionBase)); 43 39 44 NetworkFunctionBase::NetworkFunctionBase(const std::string& name) 40 45 { 41 RegisterRootObject(NetworkFunctionBase);46 RegisterObject(NetworkFunctionBase); 42 47 43 48 static uint32_t networkID = 0; … … 57 62 std::map<std::string, NetworkFunctionBase*>::iterator it; 58 63 for( it=map.begin(); it!=map.end(); ++it ) 59 it->second->destroy();64 delete it->second; 60 65 } 61 66 -
code/trunk/src/libraries/network/NetworkFunction.h
r8418 r9667 39 39 #include <boost/static_assert.hpp> 40 40 41 #include "core/Identifier.h" 41 #include "core/object/Listable.h" 42 #include "core/class/Identifier.h" 42 43 #include "core/command/Functor.h" 43 44 #include "FunctionCallManager.h" … … 70 71 71 72 72 class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass{73 class _NetworkExport NetworkFunctionBase: virtual public Listable { 73 74 public: 74 75 NetworkFunctionBase(const std::string& name); -
code/trunk/src/libraries/network/Server.cc
r8858 r9667 48 48 #include "util/Clock.h" 49 49 #include "util/Output.h" 50 #include "core/ObjectList.h"51 50 #include "core/command/Executor.h" 52 51 #include "packet/Chat.h" -
code/trunk/src/libraries/network/TrafficControl.cc
r8858 r9667 33 33 34 34 #include "core/CoreIncludes.h" 35 #include "core/ ConfigValueIncludes.h"35 #include "core/config/ConfigValueIncludes.h" 36 36 #include "synchronisable/Synchronisable.h" 37 37 -
code/trunk/src/libraries/network/WANDiscoverable.cc
r8858 r9667 33 33 34 34 #include "MasterServerProtocol.h" 35 #include "core/ ConfigValueIncludes.h"35 #include "core/config/ConfigValueIncludes.h" 36 36 #include "core/CoreIncludes.h" 37 37 -
code/trunk/src/libraries/network/WANDiscoverable.h
r8858 r9667 30 30 31 31 #include "NetworkPrereqs.h" 32 #include "core/OrxonoxClass.h" 33 #include "core/CoreIncludes.h" 32 #include "core/config/Configurable.h" 34 33 #include "MasterServerComm.h" 35 34 … … 37 36 { 38 37 39 class _NetworkExport WANDiscoverable: public OrxonoxClass38 class _NetworkExport WANDiscoverable: public Configurable 40 39 { 41 40 public: -
code/trunk/src/libraries/network/WANDiscovery.h
r8858 r9667 31 31 #include "NetworkPrereqs.h" 32 32 #include "packet/ServerInformation.h" 33 #include "core/ConfigFileManager.h" 34 #include "core/OrxonoxClass.h" 35 #include "core/ConfigValueIncludes.h" 36 #include "core/CoreIncludes.h" 33 #include "core/config/Configurable.h" 34 #include "core/config/ConfigValueIncludes.h" 37 35 #include "MasterServerComm.h" 38 36 #include "MasterServerProtocol.h" … … 48 46 class _NetworkExport WANDiscovery 49 47 // tolua_end 50 : public OrxonoxClass48 : public Configurable 51 49 { // tolua_export 52 50 public: -
code/trunk/src/libraries/network/packet/ClassID.cc
r8858 r9667 55 55 56 56 //calculate total needed size (for all strings and integers) 57 std::map<std::string, Identifier*>::const_iterator it = Identifier ::getStringIdentifierMapBegin();58 for(;it != Identifier ::getStringIdentifierMapEnd();++it){57 std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getInstance().getIdentifierByStringMap().begin(); 58 for(;it != IdentifierManager::getInstance().getIdentifierByStringMap().end();++it){ 59 59 id = it->second; 60 60 if(id == NULL || !id->hasFactory()) … … 129 129 130 130 //clear the map of network ids 131 Identifier ::clearNetworkIDs();131 IdentifierManager::getInstance().clearNetworkIDs(); 132 132 133 133 orxout(verbose, context::packets) << "=== processing classids: " << endl; -
code/trunk/src/libraries/network/packet/FunctionIDs.cc
r8858 r9667 35 35 36 36 #include "util/Output.h" 37 #include "core/ ObjectList.h"37 #include "core/object/ObjectList.h" 38 38 #include "network/NetworkFunction.h" 39 39 -
code/trunk/src/libraries/network/packet/Gamestate.cc
r8952 r9667 33 33 #include "util/Output.h" 34 34 #include "util/OrxAssert.h" 35 #include "core/CoreIncludes.h" 35 36 #include "core/GameMode.h" 36 #include "core/ ObjectList.h"37 #include "core/object/ObjectList.h" 37 38 #include "network/synchronisable/Synchronisable.h" 38 39 #include "network/GamestateHandler.h" … … 132 133 tempsize = it->getData(mem, this->sizes_, id, mode); 133 134 if ( tempsize != 0 ) 134 dataVector_.push_back( obj(it->getObjectID(), it->getC reatorID(), tempsize, mem-data_) );135 dataVector_.push_back( obj(it->getObjectID(), it->getContextID(), tempsize, mem-data_) ); 135 136 136 137 #ifndef NDEBUG … … 468 469 { 469 470 assert( objectHeader.getClassID() == htemp.getClassID() ); 470 assert( objectHeader.getC reatorID() == htemp.getCreatorID() );471 assert( objectHeader.getContextID() == htemp.getContextID() ); 471 472 return true; 472 473 } -
code/trunk/src/libraries/network/synchronisable/Serialise.h
r8706 r9667 41 41 #include "util/Serialise.h" 42 42 #include "core/CorePrereqs.h" 43 #include "core/CoreIncludes.h"44 #include "core/BaseObject.h" // remove this if circular dependencies in BaseObject/SmartPtr are fixed45 //#include "core/SmartPtr.h"46 43 47 44 namespace orxonox{ -
code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
r8858 r9667 45 45 uint8_t Synchronisable::state_=0x1; // detemines wheter we are server (default) or client 46 46 47 RegisterAbstractClass(Synchronisable).inheritsFrom(Class(OrxonoxInterface)); 48 47 49 /** 48 50 * Constructor: 49 51 * Initializes all Variables and sets the right objectID_ 50 52 */ 51 Synchronisable::Synchronisable( BaseObject* creator)52 { 53 RegisterRootObject(Synchronisable);53 Synchronisable::Synchronisable(Context* context) 54 { 55 RegisterObject(Synchronisable); 54 56 static uint32_t idCounter=0; 55 57 objectMode_=0x1; // by default do not send data to server … … 69 71 this->setPriority( Priority::Normal ); 70 72 71 // get creator id 72 if( creator ) 73 this->creatorID_ = creator->getSceneID(); 74 else 75 this->creatorID_ = OBJECTID_UNKNOWN; 73 // get context id 74 this->contextID_ = this->findContextID(context); 76 75 } 77 76 … … 83 82 { 84 83 // delete callback function objects 85 if(!Identifier ::isCreatingHierarchy()){84 if(!IdentifierManager::getInstance().isCreatingHierarchy()){ 86 85 // remove object from the static objectMap 87 86 if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer())) … … 100 99 } 101 100 101 /** 102 * @brief Returns the id of the context. 103 * If the context is not Synchronisable, it moves on to its parent, recursively. 104 */ 105 uint32_t Synchronisable::findContextID(Context* context) 106 { 107 if (context == NULL) 108 return OBJECTID_UNKNOWN; 109 110 Synchronisable* synchronisableContext = orxonox_cast<Synchronisable*>(context); 111 if (synchronisableContext != NULL) 112 return synchronisableContext->getObjectID(); 113 else 114 return this->findContextID(context->getParentContext()); 115 } 102 116 103 117 /** … … 142 156 } 143 157 assert(id); 144 BaseObject* creator= 0;145 if (header.getC reatorID() != OBJECTID_UNKNOWN)146 { 147 Synchronisable* synchronisable_c reator = Synchronisable::getSynchronisable(header.getCreatorID());148 if (!synchronisable_c reator)158 Context* context = 0; 159 if (header.getContextID() != OBJECTID_UNKNOWN) 160 { 161 Synchronisable* synchronisable_context = Synchronisable::getSynchronisable(header.getContextID()); 162 if (!synchronisable_context) 149 163 { 150 164 mem += header.getDataSize()+SynchronisableHeader::getSize(); //.TODO: this suckz.... remove size from header … … 153 167 } 154 168 else 155 creator = orxonox_cast<BaseObject*>(synchronisable_creator); 156 } 169 context = orxonox_cast<Context*>(synchronisable_context); 170 } 171 else 172 context = Context::getRootContext(); 173 157 174 assert(getSynchronisable(header.getObjectID())==0); //make sure no object with this id exists 158 BaseObject *bo = id->fabricate(creator);175 BaseObject *bo = orxonox_cast<BaseObject*>(id->fabricate(context)); 159 176 assert(bo); 160 177 Synchronisable *no = orxonox_cast<Synchronisable*>(bo); … … 162 179 assert( Synchronisable::objectMap_.find(header.getObjectID()) == Synchronisable::objectMap_.end() ); 163 180 no->setObjectID(header.getObjectID()); 164 //no->c reatorID=header.getCreatorID(); //TODO: remove this181 //no->contextID=header.getContextID(); //TODO: remove this 165 182 no->setClassID(header.getClassID()); 166 assert(no->creatorID_ == header.getCreatorID()); 167 if( creator ) 168 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) 183 assert(no->contextID_ == header.getContextID()); 184 if( context ) 185 { 186 BaseObject* boContext = orxonox_cast<BaseObject*>(context); 187 if (boContext) 188 bo->setLevel(boContext->getLevel()); // Note: this ensures that the level is known on the client for child objects of the scene (and the scene itself) 189 } 169 190 //assert(no->classID_ == header.getClassID()); 170 191 orxout(verbose, context::network) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << endl; … … 274 295 275 296 header.setObjectID( this->objectID_ ); 276 header.setC reatorID( this->creatorID_ );297 header.setContextID( this->contextID_ ); 277 298 header.setClassID( this->classID_ ); 278 299 header.setDataSize( tempsize ); … … 331 352 SynchronisableHeader syncHeader2(mem); 332 353 assert( this->getClassID() == syncHeader2.getClassID() ); 333 assert( this->getC reatorID() == syncHeader2.getCreatorID() );354 assert( this->getContextID() == syncHeader2.getContextID() ); 334 355 mem += SynchronisableHeader::getSize(); 335 356 std::vector<SynchronisableVariableBase *>::iterator i; -
code/trunk/src/libraries/network/synchronisable/Synchronisable.h
r8858 r9667 40 40 41 41 #include "util/mbool.h" 42 #include "core/OrxonoxClass.h" 42 #include "util/Output.h" 43 #include "core/class/OrxonoxInterface.h" 43 44 #include "SynchronisableVariable.h" 44 45 #include "NetworkCallback.h" … … 106 107 * @brief: stores information about a Synchronisable 107 108 * 108 * This class stores the information about a Synchronisable (objectID_, classID_, c reatorID_, dataSize)109 * This class stores the information about a Synchronisable (objectID_, classID_, contextID_, dataSize) 109 110 * in an emulated bitset. 110 111 * Bit 1 to 31 store the size of the Data the synchronisable consumes in the stream … … 112 113 * Byte 5 to 8: objectID_ 113 114 * Byte 9 to 12: classID_ 114 * Byte 13 to 16: c reatorID_115 * Byte 13 to 16: contextID_ 115 116 */ 116 117 class _NetworkExport SynchronisableHeader: public SynchronisableHeaderLight … … 125 126 inline void setClassID(uint32_t classID_) 126 127 { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()) = classID_; } 127 inline uint32_t getC reatorID() const128 inline uint32_t getContextID() const 128 129 { return *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4); } 129 inline void setC reatorID(uint32_t creatorID_)130 { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4) = c reatorID_; }130 inline void setContextID(uint32_t contextID_) 131 { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4) = contextID_; } 131 132 inline void operator=(SynchronisableHeader& h) 132 133 { memcpy(data_, h.data_, getSize()); } … … 143 144 * @author Oliver Scheuss 144 145 */ 145 class _NetworkExport Synchronisable : virtual public Orxonox Class{146 class _NetworkExport Synchronisable : virtual public OrxonoxInterface { 146 147 public: 147 148 friend class packet::Gamestate; … … 157 158 158 159 inline uint32_t getObjectID() const {return this->objectID_;} 159 inline unsigned int getC reatorID() const {return this->creatorID_;}160 inline unsigned int getContextID() const {return this->contextID_;} 160 161 inline uint32_t getClassID() const {return this->classID_;} 161 162 inline unsigned int getPriority() const { return this->objectFrequency_;} … … 169 170 170 171 protected: 171 Synchronisable( BaseObject* creator);172 Synchronisable(Context* context); 172 173 template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false); 173 174 template <class T> void registerVariable(std::set<T>& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false); … … 175 176 176 177 void setPriority(unsigned int freq){ objectFrequency_ = freq; } 177 178 uint32_t findContextID(Context* context); 178 179 179 180 private: … … 188 189 189 190 uint32_t objectID_; 190 uint32_t c reatorID_;191 uint32_t contextID_; 191 192 uint32_t classID_; 192 193
Note: See TracChangeset
for help on using the changeset viewer.