Changeset 7494 for code/trunk/src/orxonox/pickup/PickupIdentifier.cc
- Timestamp:
- Sep 28, 2010, 5:31:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/pickup/PickupIdentifier.cc
r7163 r7494 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/Identifier.h" 38 37 39 #include "interfaces/Pickupable.h" 38 40 … … 69 71 int PickupIdentifier::compare(const PickupIdentifier* identifier) const 70 72 { 71 if(identifier == NULL) 72 { 73 return 1; 74 COUT(1) << "Error in PickupIdentifier::compare: Input Identifier is NULL." << std::endl; 75 } 73 assert(identifier); 74 assert(identifier->pickup_); 75 assert(this->pickup_); 76 76 77 if(identifier->pickup_ == NULL && this->pickup_ == NULL) 78 { 79 return 0; 80 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 81 } 82 83 if(identifier->pickup_ == NULL) 84 { 85 return 1; 86 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 87 } 88 89 if(this->pickup_ == NULL) 90 { 91 return -1; 92 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 93 } 94 95 //! If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), the obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames. 77 // If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), the obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames. 96 78 if(!identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier())) 97 79 return this->pickup_->getIdentifier()->getName().compare(identifier->pickup_->getIdentifier()->getName()); 98 80 99 // !If the class is the same for both PickupIdentifiers we go on to check the parameters of the class.100 // ! If the two have a different number of parameters then obviusly something is very wrong.81 // If the class is the same for both PickupIdentifiers we go on to check the parameters of the class. 82 // If the two have a different number of parameters then obviously something is very wrong. 101 83 if(!(this->parameters_.size() == identifier->parameters_.size())) 102 84 { … … 105 87 } 106 88 107 // !We iterate through all parameters and compare their values (which are strings). The first parameter is the most significant. The ordering is once again established by the alphabetical comparison of the two value strings.89 // We iterate through all parameters and compare their values (which are strings). The first parameter is the most significant. The ordering is once again established by the alphabetical comparison of the two value strings. 108 90 for(std::map<std::string, std::string>::const_iterator it = this->parameters_.begin(); it != this->parameters_.end(); it++) 109 91 { 110 // !<If a parameter present in one of the identifiers is not found in the other, once again, something is very wrong.92 // If a parameter present in one of the identifiers is not found in the other, once again, something is very wrong. 111 93 if(identifier->parameters_.find(it->first) == identifier->parameters_.end()) 112 94 {
Note: See TracChangeset
for help on using the changeset viewer.