Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 24, 2009, 8:58:27 PM (15 years ago)
Author:
landauf
Message:

some cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/ClassFactory.h

    r5779 r5783  
    6565    {
    6666        public:
    67             ClassFactory(const std::string& name, bool bLoadable = true);
    68             BaseObject* fabricate(BaseObject* creator);
     67            /**
     68                @brief Constructor: Adds the ClassFactory to the Identifier of the same type.
     69                @param name The name of the class
     70                @param bLoadable True if the class can be loaded through XML
     71            */
     72            ClassFactory(const std::string& name, bool bLoadable = true)
     73            {
     74                COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
     75                ClassIdentifier<T>::getIdentifier(name)->addFactory(this);
     76                ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
     77            }
     78
     79            /**
     80                @brief Creates and returns a new object of class T.
     81                @return The new object
     82            */
     83            inline BaseObject* fabricate(BaseObject* creator)
     84            {
     85                return static_cast<BaseObject*>(new T(creator));
     86            }
    6987    };
    70 
    71     /**
    72         @brief Adds the ClassFactory to the Identifier of the same type.
    73         @param name The name of the class
    74         @param bLoadable True if the class can be loaded through XML
    75     */
    76     template <class T>
    77     ClassFactory<T>::ClassFactory(const std::string& name, bool bLoadable)
    78     {
    79         COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
    80         ClassIdentifier<T>::getIdentifier(name)->addFactory(this);
    81         ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
    82     }
    83 
    84     /**
    85         @brief Creates and returns a new object of class T.
    86         @return The new object
    87     */
    88     template <class T>
    89     inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)
    90     {
    91         return static_cast<BaseObject*>(new T(creator));
    92     }
    9388}
    9489
Note: See TracChangeset for help on using the changeset viewer.