Changeset 10473 for code/branches/core7
- Timestamp:
- May 25, 2015, 2:04:43 PM (10 years ago)
- Location:
- code/branches/core7/src/libraries/network
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/libraries/network/FunctionCall.cc
r10472 r10473 52 52 { 53 53 case 0: 54 return !fct->call(this->objectID_);54 return fct->call(this->objectID_); 55 55 case 1: 56 return !fct->call(this->objectID_, this->arguments_[0]);56 return fct->call(this->objectID_, this->arguments_[0]); 57 57 case 2: 58 return !fct->call(this->objectID_, this->arguments_[0], this->arguments_[1]);58 return fct->call(this->objectID_, this->arguments_[0], this->arguments_[1]); 59 59 case 3: 60 return !fct->call(this->objectID_, this->arguments_[0], this->arguments_[1], this->arguments_[2]);60 return fct->call(this->objectID_, this->arguments_[0], this->arguments_[1], this->arguments_[2]); 61 61 case 4: 62 return !fct->call(this->objectID_, this->arguments_[0], this->arguments_[1], this->arguments_[2], this->arguments_[3]);62 return fct->call(this->objectID_, this->arguments_[0], this->arguments_[1], this->arguments_[2], this->arguments_[3]); 63 63 case 5: 64 return !fct->call(this->objectID_, this->arguments_[0], this->arguments_[1], this->arguments_[2], this->arguments_[3], this->arguments_[4]);64 return fct->call(this->objectID_, this->arguments_[0], this->arguments_[1], this->arguments_[2], this->arguments_[3], this->arguments_[4]); 65 65 default: 66 66 assert(0); … … 69 69 } 70 70 71 void FunctionCall::setCall Static( uint32_t networkID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){71 void FunctionCall::setCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){ 72 72 73 73 // first determine the size that has to be reserved for this call 74 uint32_t callsize = 2*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and for bool isStatic 75 uint32_t nrOfArguments = 0; 76 if(mt1) 77 { 78 nrOfArguments++; 79 callsize += mt1->getNetworkSize(); 80 this->arguments_.push_back(*mt1); 81 if(mt2) 82 { 83 nrOfArguments++; 84 callsize += mt2->getNetworkSize(); 85 this->arguments_.push_back(*mt2); 86 if(mt3) 87 { 88 nrOfArguments++; 89 callsize += mt3->getNetworkSize(); 90 this->arguments_.push_back(*mt3); 91 if(mt4) 92 { 93 nrOfArguments++; 94 callsize += mt4->getNetworkSize(); 95 this->arguments_.push_back(*mt4); 96 if(mt5) 97 { 98 nrOfArguments++; 99 callsize += mt5->getNetworkSize(); 100 this->arguments_.push_back(*mt5); 101 } 102 } 103 } 104 } 105 } 106 this->nrOfArguments_ = nrOfArguments; 107 this->size_ = callsize; 108 this->functionID_ = networkID; 109 } 110 111 void FunctionCall::setCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){ 112 113 // first determine the size that has to be reserved for this call 114 uint32_t callsize = 3*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and the objectID and bIsStatic 74 uint32_t callsize = 3*sizeof(uint32_t); //size for network-function-id and nrOfArguments and the objectID 115 75 uint32_t nrOfArguments = 0; 116 76 if(mt1) … … 146 106 this->nrOfArguments_ = nrOfArguments; 147 107 this->functionID_ = networkID; 108 this->objectID_ = objectID; 148 109 this->size_ = callsize; 149 this->objectID_ = objectID;150 110 } 151 111 -
code/branches/core7/src/libraries/network/FunctionCall.h
r10472 r10473 52 52 bool execute(); 53 53 54 void setCallStatic( uint32_t networkID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0); 55 void setCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0); 54 void setCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0); 56 55 57 56 void saveData( uint8_t*& mem ); … … 60 59 uint32_t nrOfArguments_; 61 60 uint32_t functionID_; 62 uint32_t objectID_; 61 uint32_t objectID_; // equals OBJECTID_UNKNOWN for static functions 63 62 uint32_t size_; 64 63 std::vector<MultiType> arguments_; -
code/branches/core7/src/libraries/network/FunctionCallManager.cc
r8403 r10473 39 39 std::vector<std::pair<FunctionCall, std::pair<uint32_t, uint32_t> > > FunctionCallManager::sIncomingFunctionCallBuffer_; 40 40 41 // Static calls42 41 43 void FunctionCallManager::addCall Static(uint32_t functionID, uint32_t peerID)42 void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID) 44 43 { 45 44 if(sPeerMap_.find(peerID)==sPeerMap_.end()) … … 48 47 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 49 48 } 50 FunctionCallManager::sPeerMap_[peerID]->addCall Static(functionID);49 FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID); 51 50 } 52 void FunctionCallManager::addCall Static(uint32_t functionID, uint32_t peerID, const MultiType& mt1)51 void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1) 53 52 { 54 53 if(sPeerMap_.find(peerID)==sPeerMap_.end()) … … 57 56 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 58 57 } 59 FunctionCallManager:: sPeerMap_[peerID]->addCallStatic(functionID, &mt1);58 FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1); 60 59 } 61 void FunctionCallManager::addCall Static(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2)60 void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2) 62 61 { 63 62 if(sPeerMap_.find(peerID)==sPeerMap_.end()) … … 66 65 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 67 66 } 68 FunctionCallManager:: sPeerMap_[peerID]->addCallStatic(functionID, &mt1, &mt2);67 FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2); 69 68 } 70 void FunctionCallManager::addCall Static(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3)69 void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) 71 70 { 72 71 if(sPeerMap_.find(peerID)==sPeerMap_.end()) … … 75 74 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 76 75 } 77 FunctionCallManager:: sPeerMap_[peerID]->addCallStatic(functionID, &mt1, &mt2, &mt3);76 FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2, &mt3); 78 77 } 79 void FunctionCallManager::addCall Static(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)78 void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) 80 79 { 81 80 if(sPeerMap_.find(peerID)==sPeerMap_.end()) … … 84 83 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 85 84 } 86 FunctionCallManager:: sPeerMap_[peerID]->addCallStatic(functionID, &mt1, &mt2, &mt3, &mt4);85 FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2, &mt3, &mt4); 87 86 } 88 void FunctionCallManager::addCall Static(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)87 void FunctionCallManager::addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) 89 88 { 90 89 if(sPeerMap_.find(peerID)==sPeerMap_.end()) … … 93 92 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 94 93 } 95 FunctionCallManager:: sPeerMap_[peerID]->addCallStatic(functionID, &mt1, &mt2, &mt3, &mt4, &mt5); 96 } 97 98 99 // MemberCalls 100 101 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID) 102 { 103 if(sPeerMap_.find(peerID)==sPeerMap_.end()) 104 { 105 FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls; 106 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 107 } 108 FunctionCallManager::sPeerMap_[peerID]->addCallMember(functionID, objectID); 109 } 110 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1) 111 { 112 if(sPeerMap_.find(peerID)==sPeerMap_.end()) 113 { 114 FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls; 115 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 116 } 117 FunctionCallManager::sPeerMap_[peerID]->addCallMember(functionID, objectID, &mt1); 118 } 119 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2) 120 { 121 if(sPeerMap_.find(peerID)==sPeerMap_.end()) 122 { 123 FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls; 124 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 125 } 126 FunctionCallManager::sPeerMap_[peerID]->addCallMember(functionID, objectID, &mt1, &mt2); 127 } 128 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3) 129 { 130 if(sPeerMap_.find(peerID)==sPeerMap_.end()) 131 { 132 FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls; 133 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 134 } 135 FunctionCallManager::sPeerMap_[peerID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3); 136 } 137 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4) 138 { 139 if(sPeerMap_.find(peerID)==sPeerMap_.end()) 140 { 141 FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls; 142 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 143 } 144 FunctionCallManager::sPeerMap_[peerID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3, &mt4); 145 } 146 void FunctionCallManager::addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5) 147 { 148 if(sPeerMap_.find(peerID)==sPeerMap_.end()) 149 { 150 FunctionCallManager::sPeerMap_[peerID] = new packet::FunctionCalls; 151 FunctionCallManager::sPeerMap_[peerID]->setPeerID(peerID); 152 } 153 FunctionCallManager::sPeerMap_[peerID]->addCallMember(functionID, objectID, &mt1, &mt2, &mt3, &mt4, &mt5); 94 FunctionCallManager::sPeerMap_[peerID]->addCall(functionID, objectID, &mt1, &mt2, &mt3, &mt4, &mt5); 154 95 } 155 96 -
code/branches/core7/src/libraries/network/FunctionCallManager.h
r7801 r10473 46 46 { 47 47 public: 48 static void addCallStatic(uint32_t functionID, uint32_t peerID); 49 static void addCallStatic(uint32_t functionID, uint32_t peerID, const MultiType& mt1); 50 static void addCallStatic(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2); 51 static void addCallStatic(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3); 52 static void addCallStatic(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4); 53 static void addCallStatic(uint32_t functionID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5); 54 55 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID); 56 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1); 57 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2); 58 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3); 59 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4); 60 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5); 48 static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID); 49 static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1); 50 static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2); 51 static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3); 52 static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4); 53 static void addCall(uint32_t functionID, uint32_t objectID, uint32_t peerID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5); 61 54 62 55 static void sendCalls(orxonox::Host* host); -
code/branches/core7/src/libraries/network/NetworkFunctionIncludes.h
r10471 r10473 51 51 NetworkFunctionPointer p1; \ 52 52 copyPtr( functionPointer, p1 ); \ 53 FunctionCallManager::addCall Static(NetworkFunctionManager::getFunction(p1)->getNetworkID(), __VA_ARGS__); \53 FunctionCallManager::addCall(NetworkFunctionManager::getFunction(p1)->getNetworkID(), OBJECTID_UNKNOWN, __VA_ARGS__); \ 54 54 } 55 55 … … 59 59 NetworkFunctionPointer p1; \ 60 60 copyPtr( &class::function, p1 ); \ 61 FunctionCallManager::addCall Member(NetworkFunctionManager::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \61 FunctionCallManager::addCall(NetworkFunctionManager::getFunction(p1)->getNetworkID(), objectID, __VA_ARGS__); \ 62 62 } 63 63 -
code/branches/core7/src/libraries/network/packet/FunctionCalls.cc
r8351 r10473 82 82 } 83 83 84 void FunctionCalls::addCall Static( uint32_t networkID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5)84 void FunctionCalls::addCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5) 85 85 { 86 86 assert(!isDataENetAllocated()); 87 87 88 88 this->functionCalls_.push(orxonox::FunctionCall()); 89 this->functionCalls_.back().setCallStatic( networkID, mt1, mt2, mt3, mt4, mt5 ); 90 this->currentSize_ += this->functionCalls_.back().getSize(); 91 } 92 93 void FunctionCalls::addCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5) 94 { 95 assert(!isDataENetAllocated()); 96 97 this->functionCalls_.push(orxonox::FunctionCall()); 98 this->functionCalls_.back().setCallMember( networkID, objectID, mt1, mt2, mt3, mt4, mt5 ); 89 this->functionCalls_.back().setCall( networkID, objectID, mt1, mt2, mt3, mt4, mt5 ); 99 90 this->currentSize_ += this->functionCalls_.back().getSize(); 100 91 } -
code/branches/core7/src/libraries/network/packet/FunctionCalls.h
r7801 r10473 56 56 virtual bool process(orxonox::Host* host); 57 57 58 void addCallStatic( uint32_t networkID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0); 59 void addCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0); 58 void addCall( uint32_t networkID, uint32_t objectID, const MultiType* mt1=0, const MultiType* mt2=0, const MultiType* mt3=0, const MultiType* mt4=0, const MultiType* mt5=0); 60 59 virtual bool send(orxonox::Host* host); 61 60 private:
Note: See TracChangeset
for help on using the changeset viewer.