Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2009, 5:05:17 PM (15 years ago)
Author:
dafrick
Message:

Hopefully merged trunk successfully into pickup branch.

Location:
code/branches/pickup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup

  • code/branches/pickup/src/libraries/network/packet/ClassID.cc

    r5781 r5935  
    4949  Identifier *id;
    5050  std::string classname;
    51   unsigned int nrOfClasses=0; 
     51  unsigned int nrOfClasses=0;
    5252  unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nrofclasses
    5353  uint32_t network_id;
    5454  flags_ = flags_ | PACKET_FLAGS_CLASSID;
    5555  std::queue<std::pair<uint32_t, std::string> > tempQueue;
    56  
     56
    5757  //calculate total needed size (for all strings and integers)
    58   std::map<std::string, Identifier*>::const_iterator it = Factory::getFactoryMapBegin();
    59   for(;it != Factory::getFactoryMapEnd();++it){
     58  std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin();
     59  for(;it != Identifier::getStringIdentifierMapEnd();++it){
    6060    id = (*it).second;
    61     if(id == NULL)
     61    if(id == NULL || !id->hasFactory())
    6262      continue;
    6363    classname = id->getName();
    6464    network_id = id->getNetworkID();
    65     if(network_id==0)
    66       COUT(3) << "we got a null class id: " << id->getName() << std::endl;
    6765    // now push the network id and the classname to the stack
    6866    tempQueue.push( std::pair<unsigned int, std::string>(network_id, classname) );
     
    7068    packetSize += (classname.size()+1)+sizeof(uint32_t)+sizeof(uint32_t);
    7169  }
    72  
     70
    7371  this->data_=new uint8_t[ packetSize ];
    7472  //set the appropriate packet id
    7573  assert(this->data_);
    7674  *(Type::Value *)(this->data_ + _PACKETID ) = Type::ClassID;
    77  
     75
    7876  uint8_t *temp=data_+sizeof(uint32_t);
    7977  // save the number of all classes
    8078  *(uint32_t*)temp = nrOfClasses;
    8179  temp += sizeof(uint32_t);
    82  
     80
    8381  // now save all classids and classnames
    8482  std::pair<uint32_t, std::string> tempPair;
     
    9189    temp+=2*sizeof(uint32_t)+tempPair.second.size()+1;
    9290  }
    93  
     91
    9492  COUT(5) << "classid packetSize is " << packetSize << endl;
    95  
     93
    9694}
    9795
     
    111109  temp += sizeof(uint32_t);
    112110  totalsize += sizeof(uint32_t); // storage size for nr of all classes
    113  
     111
    114112  for(unsigned int i=0; i<nrOfClasses; i++){
    115113    totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t));
     
    125123  uint32_t stringsize;
    126124  unsigned char *classname;
    127  
    128  
    129   //clean the map of network ids
    130   Factory::cleanNetworkIDs();
    131  
     125
     126
     127  //clear the map of network ids
     128  Identifier::clearNetworkIDs();
     129
    132130  COUT(4) << "=== processing classids: " << endl;
    133131  std::pair<uint32_t, std::string> tempPair;
     
    136134  nrOfClasses = *(uint32_t*)temp;
    137135  temp += sizeof(uint32_t);
    138  
     136
    139137  for( int i=0; i<nrOfClasses; i++){
    140138    networkID = *(uint32_t*)temp;
Note: See TracChangeset for help on using the changeset viewer.