Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2010, 6:15:45 PM (14 years ago)
Author:
dafrick
Message:

Done some (almost final) documenting in pickup module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/pickup/items/MetaPickup.cc

    r6524 r6538  
    2828
    2929/**
    30     @file
     30    @file MetaPickup.cc
    3131    @brief Implementation of the MetaPickup class.
    3232*/
     
    4343    CreateFactory(MetaPickup);
    4444   
     45    //! Setting the static variables to their values.
    4546    /*static*/ const std::string MetaPickup::metaTypeNone_s = "none";
    4647    /*static*/ const std::string MetaPickup::metaTypeUse_s = "use";
     
    4950    /**
    5051    @brief
    51         Constructor.
     52        Constructor. Registers and initializes the object.
    5253    */
    5354    MetaPickup::MetaPickup(BaseObject* creator) : Pickup(creator)
     
    5556        RegisterObject(MetaPickup);
    5657       
     58        this->initialize();
     59    }
     60   
     61    /**
     62    @brief
     63        Destructor.
     64    */
     65    MetaPickup::~MetaPickup()
     66    {
     67       
     68    }
     69   
     70    /**
     71    @brief
     72        Initializes the object.
     73    */
     74    void MetaPickup::initialize(void)
     75    {
    5776        this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier());
     77       
    5878        this->setActivationTypeDirect(pickupActivationType::immediate);
    5979        this->setDurationTypeDirect(pickupDurationType::once);
     
    6181    }
    6282   
    63     MetaPickup::~MetaPickup()
    64     {
    65        
    66     }
    67    
     83    /**
     84    @brief
     85        Helper method to initialize the PickupIdentifier.
     86    */
    6887    void MetaPickup::initializeIdentifier(void)
    6988    {
     
    7392    }
    7493   
     94    /**
     95    @brief
     96        Method for creating a MetaPickup object through XML.
     97    */
    7598    void MetaPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
    7699    {
     
    82105    }
    83106   
     107    /**
     108    @brief
     109        Is called when the pickup has transited from used to unused or the other way around.
     110        Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedUsed); to their changdeUsed method.
     111    */
    84112    void MetaPickup::changedUsed(void)
    85113    {
    86114        SUPER(MetaPickup, changedUsed);
    87115       
     116        //! If the MetaPickup transited to used.
    88117        if(this->isUsed())
    89118        {
     
    92121            {
    93122                std::set<Pickupable*> pickups = carrier->getPickups();
     123                //! Set all Pickupables carried by the PickupCarrier either to used or drop them, depending o the meta type.
    94124                for(std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)
    95125                {
     
    114144        }
    115145    }
    116    
     146       
     147    /**
     148    @brief
     149        Creates a duplicate of the input OrxonoxClass.
     150    @param item
     151        A pointer to the Orxonox class.
     152    */
     153    void MetaPickup::clone(OrxonoxClass*& item)
     154    {
     155        if(item == NULL)
     156            item = new MetaPickup(this);
     157       
     158        SUPER(MetaPickup, clone, item);
     159       
     160        MetaPickup* pickup = dynamic_cast<MetaPickup*>(item);
     161        pickup->setMetaTypeDirect(this->getMetaTypeDirect());
     162       
     163        pickup->initializeIdentifier();
     164    }
     165   
     166    /**
     167    @brief
     168        Get the meta type of this MetaPickup.
     169    @return
     170        Returns a string with the meta type of the MetaPickup.
     171    */
    117172    const std::string& MetaPickup::getMetaType(void)
    118173    {
     
    130185    }
    131186   
     187    /**
     188    @brief
     189        Set the meta type of this MetaPickup.
     190    @param type
     191        A string with the type to be set.
     192    */
    132193    void MetaPickup::setMetaType(const std::string& type)
    133194    {
     
    146207    }
    147208   
    148     void MetaPickup::clone(OrxonoxClass*& item)
    149     {
    150         if(item == NULL)
    151             item = new MetaPickup(this);
    152        
    153         SUPER(MetaPickup, clone, item);
    154        
    155         MetaPickup* pickup = dynamic_cast<MetaPickup*>(item);
    156         pickup->setMetaTypeDirect(this->getMetaTypeDirect());
    157        
    158         pickup->initializeIdentifier();
    159     }
    160    
    161209}
Note: See TracChangeset for help on using the changeset viewer.