Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 3, 2010, 2:24:14 AM (14 years ago)
Author:
scheusso
Message:

std::set<T> is now synchronisable
this was neccessary to synchronise templates (now used in the Level class)
this was neccessary to synchronise lod templates and configuration

Location:
code/branches/presentation3/src/orxonox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/orxonox/Level.cc

    r7036 r7105  
    8080    void Level::registerVariables()
    8181    {
    82         registerVariable(this->xmlfilename_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
    83         registerVariable(this->name_,        VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::changedName));
    84         registerVariable(this->description_, VariableDirection::ToClient);
     82        registerVariable(this->xmlfilename_,            VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
     83        registerVariable(this->name_,                   VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::changedName));
     84        registerVariable(this->description_,            VariableDirection::ToClient);
     85        registerVariable(this->networkTemplateNames_,   VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkCallbackTemplatesChanged));
    8586    }
    8687
     
    9798
    9899        Loader::open(this->xmlfile_);
     100    }
     101   
     102    void Level::networkCallbackTemplatesChanged()
     103    {
     104        for( std::set<std::string>::iterator it = this->networkTemplateNames_.begin(); it!=this->networkTemplateNames_.end(); ++it )
     105        {
     106            assert(Template::getTemplate(*it));
     107            Template::getTemplate(*it)->applyOn(this);
     108        }
    99109    }
    100110
  • code/branches/presentation3/src/orxonox/Level.h

    r7039 r7105  
    6666
    6767            void addLodInfo(MeshLodInformation* object);
     68            void networkCallbackTemplatesChanged();
    6869//            const MeshLodInformation* getLodInfo(std::string meshName) const;
    6970//            MeshLodInformation* getLodInfo(unsigned int index) const;
  • code/branches/presentation3/src/orxonox/Test.cc

    r6417 r7105  
    8888    void Test::registerVariables()
    8989    {
    90         registerVariable ( u1, VariableDirection::ToClient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
    91         registerVariable ( u2, VariableDirection::ToServer, new NetworkCallback<Test> ( this, &Test::checkU2 ));
    92         registerVariable ( u3, Bidirectionality::ServerMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
    93         registerVariable ( u4, Bidirectionality::ClientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true );
     90        registerVariable ( this->mySet_, VariableDirection::ToClient );
     91     
     92//         registerVariable ( u1, VariableDirection::ToClient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
     93//         registerVariable ( u2, VariableDirection::ToServer, new NetworkCallback<Test> ( this, &Test::checkU2 ));
     94//         registerVariable ( u3, Bidirectionality::ServerMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
     95//         registerVariable ( u4, Bidirectionality::ClientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true );
    9496   
    95         registerVariable ( s1, VariableDirection::ToClient, new NetworkCallback<Test> ( this, &Test::checkS1 ));
    96         registerVariable ( s2, VariableDirection::ToServer, new NetworkCallback<Test> ( this, &Test::checkS2 ));
    97         registerVariable ( s3, Bidirectionality::ServerMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true );
    98         registerVariable ( s4, Bidirectionality::ClientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true );
     97//         registerVariable ( s1, VariableDirection::ToClient, new NetworkCallback<Test> ( this, &Test::checkS1 ));
     98//         registerVariable ( s2, VariableDirection::ToServer, new NetworkCallback<Test> ( this, &Test::checkS2 ));
     99//         registerVariable ( s3, Bidirectionality::ServerMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true );
     100//         registerVariable ( s4, Bidirectionality::ClientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true );
    99101   
    100         registerVariable ( pointer_, VariableDirection::ToClient, new NetworkCallback<Test> ( this, &Test::printPointer ) );
     102//         registerVariable ( pointer_, VariableDirection::ToClient, new NetworkCallback<Test> ( this, &Test::printPointer ) );
    101103    }
    102104 
  • code/branches/presentation3/src/orxonox/Test.h

    r6417 r7105  
    3535#include "tools/interfaces/Tickable.h"
    3636
     37#include <set>
    3738
    3839typedef int TYPE;
     
    7879      void printPointer();
    7980
    80       static void printV1(){ instance_->checkU1(); }
    81       static void printV2(){ instance_->checkU2(); }
     81      static void printV1(){ instance_->blub(); }
     82      static void printV2(){ instance_->blub2(); }
    8283      static void printV3(){ instance_->checkU3(); }
    8384      static void printV4(){ instance_->checkU4(); }
     
    9798
    9899      Test* pointer_;
     100     
     101      std::set<uint32_t> mySet_;
    99102
    100103      static Test* instance_;
     104     
     105      void blub()
     106      { mySet_.insert(2); }
     107     
     108      void blub2()
     109      { for( std::set<uint32_t>::iterator it=mySet_.begin(); it!=mySet_.end(); ++it ) COUT(0) << *it << endl; }
    101110  };
    102111}
Note: See TracChangeset for help on using the changeset viewer.