Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 1, 2007, 4:24:56 AM (17 years ago)
Author:
landauf
Message:

added comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/core/Identifier.cc

    r362 r365  
     1/*!
     2    @file Identifier.cc
     3    @brief Implementation of the Identifier class.
     4*/
     5
    16#include "Identifier.h"
    27
     
    611    // ###       Identifier        ###
    712    // ###############################
    8     int Identifier::hierarchyCreatingCounter_s = 0;
    9     unsigned int Identifier::classIDcounter_s = 0;
     13    int Identifier::hierarchyCreatingCounter_s = 0; // Set the static member variable hierarchyCreatingCounter_s to zero
     14    unsigned int Identifier::classIDcounter_s = 0; // Set the static member variable classIDcounter_s to zero
    1015
     16    /**
     17        @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
     18    */
    1119    Identifier::Identifier()
    1220    {
     
    1826    }
    1927
     28    /**
     29        @brief Destructor: Deletes the name and the IdentifierList containing the children.
     30    */
    2031    Identifier::~Identifier()
    2132    {
    2233        delete &this->name_;
    23 
    2434        delete this->children_;
    2535    }
    2636
     37    /**
     38        @brief Initializes the Identifier with an IdentifierList containing all parents of the class the Identifier belongs to.
     39        @param parents The IdentifierList containing all parents
     40    */
    2741    void Identifier::initialize(const IdentifierList* parents)
    2842    {
     
    3852            {
    3953                this->parents_.add(temp1->identifier_);
    40                 temp1->identifier_->getChildren().add(this);
     54                temp1->identifier_->getChildren().add(this); // We're a child of our parents
    4155
    4256                temp1 = temp1->next_;
     
    4559    }
    4660
     61    /**
     62        @brief Creates an object of the type the Identifier belongs to.
     63        @return The new object
     64    */
    4765    BaseObject* Identifier::fabricate()
    4866    {
    4967        if (this->factory_)
    5068        {
    51             return this->factory_->fabricate();
     69            return this->factory_->fabricate(); // We have to return a BaseObject, because we don't know the exact type.
    5270        }
    5371        else
    5472        {
     73            // Abstract classes don't have a factory and therefore can't create new objects
    5574            std::cout << "Error: Cannot create an object of type '" << this->name_ << "'. Class is abstract.\n";
    5675            std::cout << "Aborting...";
     
    5978    }
    6079
     80    /**
     81        @brief Sets the networkID to a new value and changes the entry in the Factory.
     82        @param id The new networkID
     83    */
    6184    void Identifier::setNetworkID(unsigned int id)
    6285    {
     
    6588    }
    6689
     90    /**
     91        @returns true, if the Identifier is at least of the given type.
     92        @param identifier The identifier to compare with
     93    */
    6794    bool Identifier::isA(const Identifier* identifier) const
    6895    {
     
    7097    }
    7198
     99    /**
     100        @returns true, if the Identifier is exactly of the given type.
     101        @param identifier The identifier to compare with
     102    */
    72103    bool Identifier::isDirectlyA(const Identifier* identifier) const
    73104    {
     
    75106    }
    76107
     108    /**
     109        @returns true, if the assigned identifier is a child of the given identifier.
     110        @param identifier The identifier to compare with
     111    */
    77112    bool Identifier::isChildOf(const Identifier* identifier) const
    78113    {
     
    80115    }
    81116
     117    /**
     118        @returns true, if the assigned identifier is a parent of the given identifier.
     119        @param identifier The identifier to compare with
     120    */
    82121    bool Identifier::isParentOf(const Identifier* identifier) const
    83122    {
Note: See TracChangeset for help on using the changeset viewer.