Changeset 2990 for code/branches/netp3/src/orxonox/objects/Test.cc
- Timestamp:
- May 19, 2009, 9:35:10 PM (15 years ago)
- Location:
- code/branches/netp3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/netp3
- Property svn:mergeinfo changed
/code/branches/netp2 (added) merged: 2835-2836,2861,2937-2938,2940-2941,2943-2945,2947-2949,2951,2953,2964-2965,2974-2976
- Property svn:mergeinfo changed
-
code/branches/netp3/src/orxonox/objects/Test.cc
r2662 r2990 31 31 #include "core/ConfigValueIncludes.h" 32 32 #include "core/ConsoleCommand.h" 33 #include "network/NetworkFunction.h" 33 34 #include "Test.h" 35 #include "util/MultiType.h" 34 36 35 37 namespace orxonox … … 41 43 SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User); 42 44 SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User); 45 SetConsoleCommand(Test, call, true).accessLevel(AccessLevel::User); 46 SetConsoleCommand(Test, call2, true).accessLevel(AccessLevel::User); 47 48 49 //void=* aaaaa = copyPtr<sizeof(&Test::printV1)>( &NETWORK_FUNCTION_POINTER, &Test::printV1 ); 50 //void* NETWORK_FUNCTION_TEST_B = memcpy(&NETWORK_FUNCTION_POINTER, &a, sizeof(a)); 51 // NetworkFunctionBase* NETWORK_FUNCTION_TEST_C = new NetworkFunctionStatic( createFunctor(&Test::printV1), "bla", NETWORK_FUNCTION_POINTER ); 52 53 registerStaticNetworkFunction( &Test::printV1 ); 54 registerMemberNetworkFunction( Test, checkU1 ); 55 registerMemberNetworkFunction( Test, printBlaBla ); 43 56 44 57 Test* Test::instance_ = 0; … … 73 86 74 87 75 76 77 88 void Test::registerVariables() 89 { 90 registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 )); 78 91 registerVariable ( u2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkU2 )); 79 92 registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true ); 80 93 registerVariable ( u4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true ); 81 94 … … 84 97 registerVariable ( s3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true ); 85 98 registerVariable ( s4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true ); 86 } 87 99 } 100 101 void Test::call(unsigned int clientID) 102 { 103 callStaticNetworkFunction( &Test::printV1, clientID ); 104 callStaticNetworkFunction( &Test::printV1, clientID ); 105 } 106 107 void Test::call2(unsigned int clientID, std::string s1, std::string s2, std::string s3, std::string s4) 108 { 109 callMemberNetworkFunction( Test, printBlaBla, this->getObjectID(), clientID, s1, s2, s3, s4, s4 ); 110 } 111 112 void Test::tick(float dt) 113 { 114 // std::string str1 = "blub"; 115 // //MultiType mt1(std::string("blub")); 116 // MultiType mt1(str1); 117 // uint8_t* mem = new uint8_t[mt1.getNetworkSize()]; 118 // uint8_t* temp = mem; 119 // mt1.exportData( temp ); 120 // assert( temp-mem == mt1.getNetworkSize() ); 121 // MultiType mt2; 122 // temp = mem; 123 // mt2.importData( temp ); 124 // assert( temp-mem == mt1.getNetworkSize() ); 125 // COUT(0) << mt2 << endl; 126 if(!Core::isMaster()) 127 call2(0, "bal", "a", "n", "ce"); 128 // callMemberNetworkFunction( Test, checkU1, this->getObjectID(), 0 ); 129 } 130 131 void Test::printBlaBla(std::string s1, std::string s2, std::string s3, std::string s4, std::string s5) 132 { 133 COUT(0) << s1 << s2 << s3 << s4 << s5 << endl; 134 } 135 88 136 void Test::checkU1(){ COUT(1) << "U1 changed: " << u1 << std::endl; } 89 137 void Test::checkU2(){ COUT(1) << "U2 changed: " << u2 << std::endl; }
Note: See TracChangeset
for help on using the changeset viewer.