Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 25, 2013, 9:08:42 PM (11 years ago)
Author:
landauf
Message:

merged core6 back to trunk

Location:
code/trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r9550 r9667  
    5151#include "FunctionCallManager.h"
    5252#include "core/CoreIncludes.h"
    53 #include "core/CommandLineParser.h"
    5453#include "core/Game.h"
     54#include "core/config/CommandLineParser.h"
    5555
    5656namespace orxonox
  • code/trunk/src/libraries/network/ClientConnectionListener.cc

    r8327 r9667  
    3535namespace orxonox
    3636{
     37    RegisterAbstractClass(ClientConnectionListener).inheritsFrom(Class(Listable));
     38
    3739    ClientConnectionListener::ClientConnectionListener()
    3840    {
    39         RegisterRootObject(ClientConnectionListener);
     41        RegisterObject(ClientConnectionListener);
    4042    }
    4143
  • code/trunk/src/libraries/network/ClientConnectionListener.h

    r8327 r9667  
    3131
    3232#include "NetworkPrereqs.h"
    33 #include "core/OrxonoxClass.h"
     33#include "core/object/Listable.h"
    3434
    3535namespace orxonox
    3636{
    37     class _NetworkExport ClientConnectionListener : virtual public OrxonoxClass
     37    class _NetworkExport ClientConnectionListener : virtual public Listable
    3838    {
    3939        public:
  • code/trunk/src/libraries/network/Host.cc

    r8858 r9667  
    3333
    3434#include "core/CoreIncludes.h"
    35 #include "core/ObjectList.h"
     35#include "core/object/ObjectList.h"
    3636#include "core/command/ConsoleCommand.h"
    3737#include "NetworkChatListener.h"
     
    145145  NetworkChatListener::NetworkChatListener()
    146146  {
    147       RegisterRootObject(NetworkChatListener);
     147      RegisterObject(NetworkChatListener);
    148148  }
    149149
  • code/trunk/src/libraries/network/NetworkChatListener.h

    r8858 r9667  
    3232#include "NetworkPrereqs.h"
    3333
    34 #include "core/OrxonoxClass.h"
     34#include "core/object/Listable.h"
    3535
    3636namespace orxonox
     
    4343        in Host and ChatManager. ChatManager is the main derivative of this interface.
    4444    */
    45     class _NetworkExport NetworkChatListener : virtual public OrxonoxClass
     45    class _NetworkExport NetworkChatListener : virtual public Listable
    4646    {
    4747        friend class Host;
  • code/trunk/src/libraries/network/NetworkFunction.cc

    r7284 r9667  
    3737  std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
    3838
     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
    3944  NetworkFunctionBase::NetworkFunctionBase(const std::string& name)
    4045  {
    41     RegisterRootObject(NetworkFunctionBase);
     46      RegisterObject(NetworkFunctionBase);
    4247
    4348    static uint32_t networkID = 0;
     
    5762    std::map<std::string, NetworkFunctionBase*>::iterator it;
    5863    for( it=map.begin(); it!=map.end(); ++it )
    59       it->second->destroy();
     64      delete it->second;
    6065  }
    6166
  • code/trunk/src/libraries/network/NetworkFunction.h

    r8418 r9667  
    3939#include <boost/static_assert.hpp>
    4040
    41 #include "core/Identifier.h"
     41#include "core/object/Listable.h"
     42#include "core/class/Identifier.h"
    4243#include "core/command/Functor.h"
    4344#include "FunctionCallManager.h"
     
    7071
    7172
    72 class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass {
     73class _NetworkExport NetworkFunctionBase: virtual public Listable {
    7374  public:
    7475    NetworkFunctionBase(const std::string& name);
  • code/trunk/src/libraries/network/Server.cc

    r8858 r9667  
    4848#include "util/Clock.h"
    4949#include "util/Output.h"
    50 #include "core/ObjectList.h"
    5150#include "core/command/Executor.h"
    5251#include "packet/Chat.h"
  • code/trunk/src/libraries/network/TrafficControl.cc

    r8858 r9667  
    3333
    3434#include "core/CoreIncludes.h"
    35 #include "core/ConfigValueIncludes.h"
     35#include "core/config/ConfigValueIncludes.h"
    3636#include "synchronisable/Synchronisable.h"
    3737
  • code/trunk/src/libraries/network/WANDiscoverable.cc

    r8858 r9667  
    3333
    3434#include "MasterServerProtocol.h"
    35 #include "core/ConfigValueIncludes.h"
     35#include "core/config/ConfigValueIncludes.h"
    3636#include "core/CoreIncludes.h"
    3737
  • code/trunk/src/libraries/network/WANDiscoverable.h

    r8858 r9667  
    3030
    3131#include "NetworkPrereqs.h"
    32 #include "core/OrxonoxClass.h"
    33 #include "core/CoreIncludes.h"
     32#include "core/config/Configurable.h"
    3433#include "MasterServerComm.h"
    3534
     
    3736{
    3837
    39   class _NetworkExport WANDiscoverable: public OrxonoxClass
     38  class _NetworkExport WANDiscoverable: public Configurable
    4039  {
    4140    public:
  • code/trunk/src/libraries/network/WANDiscovery.h

    r8858 r9667  
    3131#include "NetworkPrereqs.h"
    3232#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"
    3735#include "MasterServerComm.h"
    3836#include "MasterServerProtocol.h"
     
    4846  class _NetworkExport WANDiscovery
    4947// tolua_end
    50     : public OrxonoxClass
     48    : public Configurable
    5149  { // tolua_export
    5250    public:
  • code/trunk/src/libraries/network/packet/ClassID.cc

    r8858 r9667  
    5555
    5656  //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){
    5959    id = it->second;
    6060    if(id == NULL || !id->hasFactory())
     
    129129
    130130  //clear the map of network ids
    131   Identifier::clearNetworkIDs();
     131  IdentifierManager::getInstance().clearNetworkIDs();
    132132
    133133  orxout(verbose, context::packets) << "=== processing classids: " << endl;
  • code/trunk/src/libraries/network/packet/FunctionIDs.cc

    r8858 r9667  
    3535
    3636#include "util/Output.h"
    37 #include "core/ObjectList.h"
     37#include "core/object/ObjectList.h"
    3838#include "network/NetworkFunction.h"
    3939
  • code/trunk/src/libraries/network/packet/Gamestate.cc

    r8952 r9667  
    3333#include "util/Output.h"
    3434#include "util/OrxAssert.h"
     35#include "core/CoreIncludes.h"
    3536#include "core/GameMode.h"
    36 #include "core/ObjectList.h"
     37#include "core/object/ObjectList.h"
    3738#include "network/synchronisable/Synchronisable.h"
    3839#include "network/GamestateHandler.h"
     
    132133    tempsize = it->getData(mem, this->sizes_, id, mode);
    133134    if ( tempsize != 0 )
    134       dataVector_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
     135      dataVector_.push_back( obj(it->getObjectID(), it->getContextID(), tempsize, mem-data_) );
    135136
    136137#ifndef NDEBUG
     
    468469    {
    469470      assert( objectHeader.getClassID() == htemp.getClassID() );
    470       assert( objectHeader.getCreatorID() == htemp.getCreatorID() );
     471      assert( objectHeader.getContextID() == htemp.getContextID() );
    471472      return true;
    472473    }
  • code/trunk/src/libraries/network/synchronisable/Serialise.h

    r8706 r9667  
    4141#include "util/Serialise.h"
    4242#include "core/CorePrereqs.h"
    43 #include "core/CoreIncludes.h"
    44 #include "core/BaseObject.h" // remove this if circular dependencies in BaseObject/SmartPtr are fixed
    45 //#include "core/SmartPtr.h"
    4643
    4744namespace orxonox{
  • code/trunk/src/libraries/network/synchronisable/Synchronisable.cc

    r8858 r9667  
    4545  uint8_t Synchronisable::state_=0x1; // detemines wheter we are server (default) or client
    4646
     47  RegisterAbstractClass(Synchronisable).inheritsFrom(Class(OrxonoxInterface));
     48
    4749  /**
    4850  * Constructor:
    4951  * Initializes all Variables and sets the right objectID_
    5052  */
    51   Synchronisable::Synchronisable(BaseObject* creator )
    52   {
    53     RegisterRootObject(Synchronisable);
     53  Synchronisable::Synchronisable(Context* context)
     54  {
     55      RegisterObject(Synchronisable);
    5456    static uint32_t idCounter=0;
    5557    objectMode_=0x1; // by default do not send data to server
     
    6971    this->setPriority( Priority::Normal );
    7072
    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);
    7675  }
    7776
     
    8382  {
    8483    // delete callback function objects
    85     if(!Identifier::isCreatingHierarchy()){
     84    if(!IdentifierManager::getInstance().isCreatingHierarchy()){
    8685      // remove object from the static objectMap
    8786      if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
     
    10099  }
    101100
     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  }
    102116
    103117  /**
     
    142156    }
    143157    assert(id);
    144     BaseObject* creator = 0;
    145     if (header.getCreatorID() != OBJECTID_UNKNOWN)
    146     {
    147       Synchronisable* synchronisable_creator = Synchronisable::getSynchronisable(header.getCreatorID());
    148       if (!synchronisable_creator)
     158    Context* context = 0;
     159    if (header.getContextID() != OBJECTID_UNKNOWN)
     160    {
     161      Synchronisable* synchronisable_context = Synchronisable::getSynchronisable(header.getContextID());
     162      if (!synchronisable_context)
    149163      {
    150164        mem += header.getDataSize()+SynchronisableHeader::getSize(); //.TODO: this suckz.... remove size from header
     
    153167      }
    154168      else
    155         creator = orxonox_cast<BaseObject*>(synchronisable_creator);
    156     }
     169        context = orxonox_cast<Context*>(synchronisable_context);
     170    }
     171    else
     172      context = Context::getRootContext();
     173
    157174    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));
    159176    assert(bo);
    160177    Synchronisable *no = orxonox_cast<Synchronisable*>(bo);
     
    162179    assert( Synchronisable::objectMap_.find(header.getObjectID()) == Synchronisable::objectMap_.end() );
    163180    no->setObjectID(header.getObjectID());
    164     //no->creatorID=header.getCreatorID(); //TODO: remove this
     181    //no->contextID=header.getContextID(); //TODO: remove this
    165182    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    }
    169190    //assert(no->classID_ == header.getClassID());
    170191    orxout(verbose, context::network) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << endl;
     
    274295
    275296    header.setObjectID( this->objectID_ );
    276     header.setCreatorID( this->creatorID_ );
     297    header.setContextID( this->contextID_ );
    277298    header.setClassID( this->classID_ );
    278299    header.setDataSize( tempsize );
     
    331352      SynchronisableHeader syncHeader2(mem);
    332353      assert( this->getClassID() == syncHeader2.getClassID() );
    333       assert( this->getCreatorID() == syncHeader2.getCreatorID() );
     354      assert( this->getContextID() == syncHeader2.getContextID() );
    334355      mem += SynchronisableHeader::getSize();
    335356      std::vector<SynchronisableVariableBase *>::iterator i;
  • code/trunk/src/libraries/network/synchronisable/Synchronisable.h

    r8858 r9667  
    4040
    4141#include "util/mbool.h"
    42 #include "core/OrxonoxClass.h"
     42#include "util/Output.h"
     43#include "core/class/OrxonoxInterface.h"
    4344#include "SynchronisableVariable.h"
    4445#include "NetworkCallback.h"
     
    106107   * @brief: stores information about a Synchronisable
    107108   *
    108    * This class stores the information about a Synchronisable (objectID_, classID_, creatorID_, dataSize)
     109   * This class stores the information about a Synchronisable (objectID_, classID_, contextID_, dataSize)
    109110   * in an emulated bitset.
    110111   * Bit 1 to 31 store the size of the Data the synchronisable consumes in the stream
     
    112113   * Byte 5 to 8: objectID_
    113114   * Byte 9 to 12: classID_
    114    * Byte 13 to 16: creatorID_
     115   * Byte 13 to 16: contextID_
    115116   */
    116117  class _NetworkExport SynchronisableHeader: public SynchronisableHeaderLight
     
    125126      inline void setClassID(uint32_t classID_)
    126127        { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()) = classID_; }
    127       inline uint32_t getCreatorID() const
     128      inline uint32_t getContextID() const
    128129        { return *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4); }
    129       inline void setCreatorID(uint32_t creatorID_)
    130         { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4) = creatorID_; }
     130      inline void setContextID(uint32_t contextID_)
     131        { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4) = contextID_; }
    131132      inline void operator=(SynchronisableHeader& h)
    132133        { memcpy(data_, h.data_, getSize()); }
     
    143144  * @author Oliver Scheuss
    144145  */
    145   class _NetworkExport Synchronisable : virtual public OrxonoxClass{
     146  class _NetworkExport Synchronisable : virtual public OrxonoxInterface {
    146147  public:
    147148    friend class packet::Gamestate;
     
    157158
    158159    inline uint32_t getObjectID() const {return this->objectID_;}
    159     inline unsigned int getCreatorID() const {return this->creatorID_;}
     160    inline unsigned int getContextID() const {return this->contextID_;}
    160161    inline uint32_t getClassID() const {return this->classID_;}
    161162    inline unsigned int getPriority() const { return this->objectFrequency_;}
     
    169170
    170171  protected:
    171     Synchronisable(BaseObject* creator);
     172    Synchronisable(Context* context);
    172173    template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
    173174    template <class T> void registerVariable(std::set<T>& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
     
    175176
    176177    void setPriority(unsigned int freq){ objectFrequency_ = freq; }
    177 
     178    uint32_t findContextID(Context* context);
    178179
    179180  private:
     
    188189
    189190    uint32_t objectID_;
    190     uint32_t creatorID_;
     191    uint32_t contextID_;
    191192    uint32_t classID_;
    192193
Note: See TracChangeset for help on using the changeset viewer.