- Timestamp:
- Dec 21, 2009, 1:18:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc
r5781 r6387 53 53 flags_ = flags_ | PACKET_FLAGS_FUNCTIONIDS; 54 54 std::queue<std::pair<uint32_t, std::string> > tempQueue; 55 55 56 56 //calculate total needed size (for all strings and integers) 57 57 ObjectList<NetworkFunctionBase>::iterator it; … … 64 64 packetSize += (functionname.size()+1)+sizeof(uint32_t)+sizeof(uint32_t); // reserver size for the functionname string, the functionname length and the networkID 65 65 } 66 66 67 67 this->data_=new uint8_t[ packetSize ]; 68 68 //set the appropriate packet id 69 69 assert(this->data_); 70 70 *(Type::Value *)(this->data_ + _PACKETID ) = Type::FunctionIDs; 71 71 72 72 uint8_t *temp=data_+sizeof(uint32_t); 73 73 // save the number of all classes 74 74 *(uint32_t*)temp = nrOfFunctions; 75 75 temp += sizeof(uint32_t); 76 76 77 77 // now save all classids and classnames 78 78 std::pair<uint32_t, std::string> tempPair; … … 85 85 temp+=2*sizeof(uint32_t)+tempPair.second.size()+1; 86 86 } 87 87 88 88 COUT(5) << "FunctionIDs packetSize is " << packetSize << endl; 89 89 90 90 } 91 91 … … 106 106 temp += sizeof(uint32_t); 107 107 totalsize += sizeof(uint32_t); // storage size for nr of all classes 108 108 109 109 for(unsigned int i=0; i<nrOfFunctions; i++){ 110 110 totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t)); // for each network function add size for id, sizeof(string) and length of string itself to totalsize … … 121 121 uint32_t stringsize; 122 122 unsigned char *functionname; 123 123 124 124 COUT(4) << "=== processing functionids: " << endl; 125 125 std::pair<uint32_t, std::string> tempPair; … … 127 127 nrOfFunctions = *(uint32_t*)temp; 128 128 temp += sizeof(uint32_t); 129 129 130 130 for( int i=0; i<nrOfFunctions; i++){ 131 131 networkID = *(uint32_t*)temp;
Note: See TracChangeset
for help on using the changeset viewer.