Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 16, 2010, 12:37:09 PM (14 years ago)
Author:
dafrick
Message:

Documenting and cleanup.

Location:
code/trunk/src/orxonox
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/interfaces/PickupCarrier.cc

    r7494 r7547  
    3636#include "core/CoreIncludes.h"
    3737#include "core/Identifier.h"
     38
    3839#include "Pickupable.h"
    3940
     
    8990        Returns true if the PickupCarrier or one of its children is a target, false if not.
    9091    */
    91     bool PickupCarrier::isTarget(const Pickupable* pickup)
     92    bool PickupCarrier::isTarget(const Pickupable* pickup) const
    9293    {
    9394        if(pickup->isTarget(this)) // If the PickupCarrier itself is a target.
  • code/trunk/src/orxonox/interfaces/PickupCarrier.h

    r7494 r7547  
    6464        Different PickupCarriers are structured hierarchically, a pickup can be picked up by a PickupCarrier that can't really carry that particular pickup but one of its children (or one of their children) can, and thus it gets "handed down" until it is at the right place.
    6565        But this structure has to be established first.
    66         - <b>getCarrierChildren()</b> To this end a PickupCarrier needs to implement getCarrierChildren() which returns a list of its direct PickupCarrier children. If you need an example, have a look at @ref orxonox::Pawn "Pawn" and @ref orxonx::Engine "Engine".
     66        - <b>getCarrierChildren()</b> To this end a PickupCarrier needs to implement getCarrierChildren() which returns a list of its direct PickupCarrier children. If you need an example, have a look at @ref orxonox::Pawn "Pawn" and @ref orxonox::Engine "Engine".
    6767        - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or NULL if the PickupCarrier is a root node in this hierarchy.
    6868
    6969    @author
    7070        Damian 'Mozork' Frick
     71
     72    @ingroup Pickup
    7173    */
    7274    class _OrxonoxExport PickupCarrier : virtual public OrxonoxClass
     
    8890            void preDestroy(void); //!< Is called before the PickupCarrier is effectively destroyed.
    8991
    90             bool isTarget(const Pickupable* pickup); //!< Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable.
     92            bool isTarget(const Pickupable* pickup) const; //!< Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable.
    9193            PickupCarrier* getTarget(const Pickupable* pickup); //!< Get the carrier that is both a child of the PickupCarrier (or the PickupCarrier itself) and a target of the input Pickupable.
    9294
     
    9698            @return Returns the position as a Vector3.
    9799            */
    98             virtual const Vector3& getCarrierPosition(void) = 0;
     100            virtual const Vector3& getCarrierPosition(void) const = 0;
    99101
    100102        protected:
     
    105107            @return Returns a pointer to a list of all direct children.
    106108            */
    107             virtual std::vector<PickupCarrier*>* getCarrierChildren(void) = 0;
     109            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const = 0;
    108110            /**
    109111            @brief Get the parent of this PickupSpawner.
     
    111113            @return Returns a pointer to the parent.
    112114            */
    113             virtual PickupCarrier* getCarrierParent(void) = 0;
     115            virtual PickupCarrier* getCarrierParent(void) const = 0;
    114116
    115117            /**
  • code/trunk/src/orxonox/interfaces/PickupListener.h

    r7504 r7547  
    4848        The PickupListener class facilitates the flow of information regarding the picking up, dropping, using and unusing of @ref orxonox::Pickupable "Pickupables" to interested parties (such as the @ref orxonox::PickupManager "PickupManager").
    4949
    50         All you need to to do be notified is to inherit from PickupListener and implement the two methods pickupChangedUsed() and pickupChangedPickedUp().
     50        All you need to to do be notified is to inherit from PickupListener and implement the two methods <code>pickupChangedUsed()</code> and <code>pickupChangedPickedUp()</code>.
     51
    5152    @author
    5253        Damian 'Mozork' Frick
     54
     55    @ingroup Pickup
    5356    */
    5457    class _OrxonoxExport PickupListener : virtual public OrxonoxClass
  • code/trunk/src/orxonox/interfaces/Pickupable.cc

    r7504 r7547  
    147147        Returns true if the given PickupCarrier is a target.
    148148    */
    149     bool Pickupable::isTarget(PickupCarrier* carrier) const
     149    bool Pickupable::isTarget(const PickupCarrier* carrier) const
    150150    {
    151151        if(carrier == NULL)
     
    165165    bool Pickupable::isTarget(const Identifier* identifier) const
    166166    {
    167         //! Iterate through all targets of this Pickupable.
     167        // Iterate through all targets of this Pickupable.
    168168        for(std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
    169169        {
     
    198198    bool Pickupable::addTarget(Identifier* target)
    199199    {
    200         if(this->isTarget(target)) //!< If the input target is already present in the list of targets.
     200        if(this->isTarget(target)) // If the input target is already present in the list of targets.
    201201            return false;
    202202
     
    216216    bool Pickupable::pickup(PickupCarrier* carrier)
    217217    {
    218         if(carrier == NULL || this->isPickedUp()) //!< If carrier is NULL or the Pickupable is already picked up.
     218        if(carrier == NULL || this->isPickedUp()) // If carrier is NULL or the Pickupable is already picked up.
    219219            return false;
    220220
  • code/trunk/src/orxonox/interfaces/Pickupable.h

    r7504 r7547  
    5151        An Interface (or more precisely an abstract class) to model and represent different (all kinds of) pickups.
    5252
    53         Pickups (@ref orxonox:Pickupable "Pickupables") are objects that (quite unsurprisingly) can be picked up. Additionally they can be used and unused (transition from used to not used), and also dropped.
     53        Pickups (@ref orxonox::Pickupable "Pickupables") are objects that (quite unsurprisingly) can be picked up. Additionally they can be used and unused (transition from used to not used), and also dropped.
    5454
    5555        A class of Pickups can incorporate many different types of pickups (see @ref orxonox::PickupIdentifier "PickupIdentifier"), each type is uniquely defined by a @ref orxonox::PickupIdentifier "PickupIdentifier". Each pickup has such an identifier identiying its type. This means that two pickups of the same type have identifiers which are equal.
     
    5757    @author
    5858        Damian 'Mozork' Frick
     59
     60    @ingroup Pickup
    5961    */
    6062    class _OrxonoxExport Pickupable : virtual public OrxonoxClass, public Rewardable
     
    7072            @return Returns true if the Pickupable is currently in use.
    7173            */
    72             inline bool isUsed(void)
     74            inline bool isUsed(void) const
    7375                { return this->used_; }
    7476            /**
     
    9496            @return Returns true if the Pickupable is currently picked up, false if not.
    9597            */
    96             inline bool isPickedUp(void)
     98            inline bool isPickedUp(void) const
    9799                { return this->pickedUp_; }
    98100            /**
     
    106108            @return Returns true if it can be used.
    107109            */
    108             inline bool isUsable(void)
     110            inline bool isUsable(void) const
    109111                { return this->enabled_; }
    110112
     
    113115            @return Returns true if it can be unused.
    114116            */
    115             inline bool isUnusable(void)
     117            inline bool isUnusable(void) const
    116118                { return this->enabled_; }
    117119
     
    121123            @return Returns true if the Pickupable is enabled.
    122124            */
    123             inline bool isEnabled(void)
     125            inline bool isEnabled(void) const
    124126                { return this->enabled_; }
    125127
     
    127129            bool drop(bool createSpawner = true); //!< Can be called to drop a Pickupable.
    128130
    129             virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this Pickupable.
     131            virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this Pickupable.
    130132            bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable.
    131133            bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this Pickupable.
     
    139141            @return Returns a pointer to the PickupIdentifier of this Pickupable.
    140142            */
    141             virtual const PickupIdentifier* getPickupIdentifier(void)
     143            virtual const PickupIdentifier* getPickupIdentifier(void) const
    142144                { return this->pickupIdentifier_; }
    143145
  • code/trunk/src/orxonox/items/Engine.cc

    r7163 r7547  
    248248    }
    249249
    250     PickupCarrier* Engine::getCarrierParent(void)
     250    PickupCarrier* Engine::getCarrierParent(void) const
    251251    {
    252252        return this->ship_;
    253253    }
    254254
    255     const Vector3& Engine::getCarrierPosition(void)
     255    const Vector3& Engine::getCarrierPosition(void) const
    256256    {
    257257        return this->ship_->getWorldPosition();
  • code/trunk/src/orxonox/items/Engine.h

    r7163 r7547  
    112112            virtual const Vector3& getDirection() const;
    113113
    114             virtual const Vector3& getCarrierPosition(void);
     114            virtual const Vector3& getCarrierPosition(void) const;
    115115
    116116            //TODO: Move to protected or private. How?
     
    121121
    122122        protected:
    123             virtual std::vector<PickupCarrier*>* getCarrierChildren(void)
     123            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
    124124                { return new std::vector<PickupCarrier*>(); }
    125             virtual PickupCarrier* getCarrierParent(void);
     125            virtual PickupCarrier* getCarrierParent(void) const;
    126126
    127127        private:
  • code/trunk/src/orxonox/pickup/PickupIdentifier.h

    r7494 r7547  
    5757
    5858        Lastly a struct (@ref orxonox::PickupIdentifierCompare "PickupIdentifierCompare") is provided that can be used in stl containers to establish a strictly lesser ordering between @ref orxonox::PickupIdentifier "PickupIdentifiers" (and thus @ref orxonox::Pickupable "Pickupables").
     59
    5960    @author
    6061        Damian 'Mozork' Frick
     62
     63    @ingroup Pickup
    6164    */
    6265    class _OrxonoxExport PickupIdentifier : virtual public OrxonoxClass
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r7163 r7547  
    128128                { return this->aimPosition_; }
    129129
    130             virtual const Vector3& getCarrierPosition(void)
     130            virtual const Vector3& getCarrierPosition(void) const
    131131                { return this->getWorldPosition(); };
    132132
     
    144144            bool bAlive_;
    145145
    146             virtual std::vector<PickupCarrier*>* getCarrierChildren(void)
     146            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
    147147                { return new std::vector<PickupCarrier*>(); }
    148             virtual PickupCarrier* getCarrierParent(void)
     148            virtual PickupCarrier* getCarrierParent(void) const
    149149                { return NULL; }
    150150
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r6711 r7547  
    221221    }
    222222
    223     std::vector<PickupCarrier*>* SpaceShip::getCarrierChildren(void)
     223    std::vector<PickupCarrier*>* SpaceShip::getCarrierChildren(void) const
    224224    {
    225225        std::vector<PickupCarrier*>* list = new std::vector<PickupCarrier*>();
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h

    r7163 r7547  
    8585
    8686        protected:
    87             virtual std::vector<PickupCarrier*>* getCarrierChildren(void);
     87            virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const;
    8888            bool bInvertYAxis_;
    8989
Note: See TracChangeset for help on using the changeset viewer.