Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 5, 2009, 5:20:06 PM (15 years ago)
Author:
rgrieder
Message:

Stupid TSVN bug: All items in a commit list are always checked by default (which is exactly wrong). It was fixed again in the upcoming 1.6.4 version though.

File:
1 edited

Legend:

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

    r5610 r5611  
    5454    class ClassFactory : public BaseFactory
    5555    {
    56         friend class Factory;
    57 
    5856        public:
    5957            static bool create(const std::string& name, bool bLoadable = true);
     
    6159
    6260        private:
    63             ClassFactory(bool bLoadable) : bLoadable_(bLoadable) {}
    64             ClassFactory(const ClassFactory& factory)    // Don't copy
     61            ClassFactory() {}                               // Don't create
     62            ClassFactory(const ClassFactory& factory) {}    // Don't copy
    6563            virtual ~ClassFactory() {}                      // Don't delete
    6664
    67             Identifier* createIdentifier(const std::string& name);
    68 
    69             bool bLoadable_;
     65            static T* createNewObject(BaseObject* creator);
    7066    };
    7167
     
    8076    {
    8177        COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;
    82         Factory::add(name, new ClassFactory<T>(bLoadable));
     78        ClassIdentifier<T>::getIdentifier(name)->addFactory(new ClassFactory<T>);
     79        ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
     80        Factory::add(name, ClassIdentifier<T>::getIdentifier());
    8381
    8482        return true;
     
    9290    inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)
    9391    {
    94         return new T(creator);
     92        return ClassFactory<T>::createNewObject(creator);
    9593    }
    9694
    9795    /**
     96        @brief Creates and returns a new object of class T; this is a wrapper for the new operator.
     97        @return The new object
    9898    */
    9999    template <class T>
    100     inline Identifier* ClassFactory<T>::createIdentifier(const std::string& name)
     100    inline T* ClassFactory<T>::createNewObject(BaseObject* creator)
    101101    {
    102         Identifier* identifier = ClassIdentifier<T>::getIdentifier(name);
    103         identifier->addFactory(this);
    104         identifier->setLoadable(this->bLoadable_);
    105         return identifier;
     102        return new T(creator);
    106103    }
    107104}
Note: See TracChangeset for help on using the changeset viewer.