Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 28, 2010, 5:31:59 PM (14 years ago)
Author:
dafrick
Message:

Some documenting and cleaning up/re-organization in pickups module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/pickup/PickupIdentifier.cc

    r7163 r7494  
    3535
    3636#include "core/CoreIncludes.h"
     37#include "core/Identifier.h"
     38
    3739#include "interfaces/Pickupable.h"
    3840
     
    6971    int PickupIdentifier::compare(const PickupIdentifier* identifier) const
    7072    {
    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_);
    7676
    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.
    9678        if(!identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier()))
    9779            return this->pickup_->getIdentifier()->getName().compare(identifier->pickup_->getIdentifier()->getName());
    9880
    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.
    10183        if(!(this->parameters_.size() == identifier->parameters_.size()))
    10284        {
     
    10587        }
    10688
    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.
    10890        for(std::map<std::string, std::string>::const_iterator it = this->parameters_.begin(); it != this->parameters_.end(); it++)
    10991        {
    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.
    11193            if(identifier->parameters_.find(it->first) == identifier->parameters_.end())
    11294            {
Note: See TracChangeset for help on using the changeset viewer.