Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/orxonox/pickup/PickupIdentifier.h @ 7186

Last change on this file since 7186 was 7129, checked in by rgrieder, 15 years ago

svn:eol-style "native" for all text-based files.

  • Property svn:eol-style set to native
File size: 3.4 KB
RevLine 
[6474]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27 */
28
[6540]29/**
30    @file PickupIdentifier.h
31    @brief Definition of the PickupIdentifier class.
32*/
33
[6474]34#ifndef _PickupIdentifier_H__
35#define _PickupIdentifier_H__
36
37#include "OrxonoxPrereqs.h"
38
39#include <map>
40#include <string>
[6475]41#include "core/Identifier.h"
[6474]42
[7127]43#include "core/OrxonoxClass.h"
[6475]44
[6474]45namespace orxonox
46{
[7127]47
[6475]48    /**
49    @brief
50        The purpose of the PickupIdentifier class is to identify different types of pickups allthough they are of the same class.
51        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.
52        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.
53        Lastly a struct is provided that can be used in stl containers to establish a strictly lesser ordering between PickupIdentifiers (and thus Pickupables).
54    @author
55        Damian 'Mozork' Frick
56    */
[6474]57    class _OrxonoxExport PickupIdentifier : virtual public OrxonoxClass
58    {
[7127]59
[6474]60        public:
[6480]61            PickupIdentifier(Pickupable* pickup); //!< Constructor.
[6475]62            ~PickupIdentifier(); //!< Destructor.
[7127]63
[6475]64            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).
[7127]65
[6475]66            bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier.
[7127]67
[6474]68        private:
[6480]69            Pickupable* pickup_; //!< The Pickupable the PickupIdentififer is for.
[6475]70            std::map<std::string, std::string> parameters_; //!< The parameters identifying the type of the pickup beyond the class.
[7127]71
[6474]72    };
[7127]73
[6475]74    /**
75    @brief
76        Struct that overloads the compare operation between two PickupIdentifier pointers.
77    */
[6474]78    struct PickupIdentifierCompare
79    {
80        bool operator() (const PickupIdentifier* lhs, const PickupIdentifier* rhs) const
[6475]81            { return lhs->compare(rhs) < 0; }
[6474]82    };
[7127]83
[6474]84}
85
86#endif // _PickupIdentifier_H__
Note: See TracBrowser for help on using the repository browser.