Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

added comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/core/ClassFactory.h

    r258 r365  
     1/*!
     2    @file ClassFactory.h
     3    @brief Definition of the ClassFactory class
     4
     5    The ClassFactory is able to create new objects of a specific class.
     6*/
     7
    18#ifndef _ClassFactory_H__
    29#define _ClassFactory_H__
     
    916    // ###      ClassFactory       ###
    1017    // ###############################
     18    //! The ClassFactory is able to create new objects of a specific class.
    1119    template <class T>
    1220    class ClassFactory : public BaseFactory
     
    1725
    1826        private:
    19             ClassFactory() {}
    20             ClassFactory(const ClassFactory& factory) {}
    21             ~ClassFactory() {}
     27            ClassFactory() {}                               // Don't create
     28            ClassFactory(const ClassFactory& factory) {}    // Don't copy
     29            ~ClassFactory() {}                              // Don't delete
    2230
    2331            static T* createNewObject();
    2432    };
    2533
     34    /**
     35        @brief Adds the ClassFactory to the Identifier of the same type and creates a new object to retrieve the parents.
     36        @return True, because the compiler only allows assignments before main()
     37    */
    2638    template <class T>
    2739    bool ClassFactory<T>::create()
    2840    {
     41        // Add the ClassFactory to the Classidentifier of type T
    2942        ClassIdentifier<T>::getIdentifier()->addFactory(new ClassFactory<T>);
    3043
     44        // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
    3145        ClassIdentifier<T>::getIdentifier()->startCreatingHierarchy();
    3246#if HIERARCHY_VERBOSE
     
    4054    }
    4155
     56    /**
     57        @brief Creates and returns a new object of class T.
     58        @return The new object
     59    */
    4260    template <class T>
    4361    BaseObject* ClassFactory<T>::fabricate()
     
    4664    }
    4765
     66    /**
     67        @brief Creates and returns a new object of class T; this is a wrapper for the new operator.
     68        @return The new object
     69    */
    4870    template <class T>
    4971    T* ClassFactory<T>::createNewObject()
Note: See TracChangeset for help on using the changeset viewer.