Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2010, 6:26:54 PM (14 years ago)
Author:
dafrick
Message:

Additional documentation, code niceifying and potential bug fixing. Also: Renamed DroppedItem to DroppedPickup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup3/src/orxonox/pickup/PickupIdentifier.h

    r6474 r6475  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "core/OrxonoxClass.h"
    35 #include "core/Identifier.h"
    3634#include <map>
    3735#include <string>
     36#include "core/Identifier.h"
     37
     38#include "core/OrxonoxClass.h"
    3839
    3940namespace orxonox
    4041{
    4142   
     43    /**
     44    @brief
     45        The purpose of the PickupIdentifier class is to identify different types of pickups allthough they are of the same class.
     46        This allows for more generic classes (or pickups in this case) that can be a number of different pickup types and can be identified as such without the need for a lot of different classes. An example is the HealthPickup class that encompasses a wide variety of different types of health pickups, e.g a HealthPickup that adds 10 health every second for 10 seconds or a HealthPickup that adds 100 health as soon as it is picked up, a.s.o.
     47        To that purpose this class provides functionality to compare two PickupIdentifier (and since all Pickupables have an Identifier through that Pickupables can be compared). It als provides functionality to add parameters that distinguish between different types of pickups in the same pickup class.
     48        Lastly a struct is provided that can be used in stl containers to establish a strictly lesser ordering between PickupIdentifiers (and thus Pickupables).
     49    @author
     50        Damian 'Mozork' Frick
     51    */
    4252    class _OrxonoxExport PickupIdentifier : virtual public OrxonoxClass
    4353    {
    4454       
    4555        public:
    46             PickupIdentifier(void);
    47             ~PickupIdentifier();
     56            PickupIdentifier(void); //!< Constructor.
     57            ~PickupIdentifier(); //!< Destructor.
    4858           
    49             virtual int compare(const PickupIdentifier& identifier) const;
     59            virtual int compare(const PickupIdentifier* identifier) const; //!< Compares two PickupIdentifiers and returns 0 if a == b, <0 if a < b and >0 if a > b for a.compare(b).
    5060           
    51             void addClass(Identifier* identifier);
    52             bool addParameter(std::string & name, std::string & value);
     61            void addClass(Identifier* identifier); //!< Add the class of the Pickupable to its PickupIdentifier.
     62            bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier.
    5363           
    5464        private:
    55             Identifier* classIdentifier_;
    56             std::map<std::string, std::string> parameters_;
    57            
     65            Identifier* classIdentifier_; //!< The Identifier of the class.
     66            std::map<std::string, std::string> parameters_; //!< The parameters identifying the type of the pickup beyond the class.
    5867           
    5968    };
    6069   
    61     //TODO: Needed?
     70    /**
     71    @brief
     72        Struct that overloads the compare operation between two PickupIdentifier pointers.
     73    */
    6274    struct PickupIdentifierCompare
    6375    {
    64         bool operator() (const PickupIdentifier& lhs, const PickupIdentifier& rhs) const
    65             { return lhs.compare(rhs) < 0; }
    66     };
    67    
    68     struct PickupIdentifierPtrCompare
    69     {
    7076        bool operator() (const PickupIdentifier* lhs, const PickupIdentifier* rhs) const
    71             { return lhs->compare(*rhs) < 0; }
     77            { return lhs->compare(rhs) < 0; }
    7278    };
    7379   
Note: See TracChangeset for help on using the changeset viewer.