Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9632


Ignore:
Timestamp:
Aug 11, 2013, 11:00:43 AM (11 years ago)
Author:
landauf
Message:

Factory::fabricate() returns an Identifiable

Location:
code/branches/core6
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/class/Identifier.cc

    r9629 r9632  
    174174        @return The new object
    175175    */
    176     OrxonoxClass* Identifier::fabricate(Context* context)
     176    Identifiable* Identifier::fabricate(Context* context)
    177177    {
    178178        if (this->factory_)
  • code/branches/core6/src/libraries/core/class/Identifier.h

    r9629 r9632  
    5656    object->getIdentifier()->getName();                                         // returns "MyClass"
    5757
    58     OrxonoxClass* other = object->getIdentifier()->fabricate(0);                // fabricates a new instance of MyClass
     58    Identifiable* other = object->getIdentifier()->fabricate(0);                // fabricates a new instance of MyClass
    5959
    6060
     
    125125            inline bool hasFactory() const { return (this->factory_ != 0); }
    126126
    127             OrxonoxClass* fabricate(Context* context);
     127            Identifiable* fabricate(Context* context);
    128128
    129129            /// Returns true if the class can be loaded through XML.
  • code/branches/core6/src/libraries/core/class/IdentifierManager.cc

    r9564 r9632  
    9191            if (it->second->hasFactory())
    9292            {
    93                 OrxonoxClass* temp = it->second->fabricate(0);
    94                 temp->destroy();
     93                Identifiable* temp = it->second->fabricate(0);
     94                delete temp;
    9595            }
    9696        }
  • code/branches/core6/src/libraries/core/class/SubclassIdentifier.h

    r9629 r9632  
    165165            T* fabricate(Context* context) const
    166166            {
    167                 OrxonoxClass* newObject = this->identifier_->fabricate(context);
     167                Identifiable* newObject = this->identifier_->fabricate(context);
    168168
    169169                // Check if the creation was successful
  • code/branches/core6/src/libraries/core/object/ClassFactory.h

    r9629 r9632  
    5555        public:
    5656            virtual ~Factory() {};
    57             virtual OrxonoxClass* fabricate(Context* context) = 0;
     57            virtual Identifiable* fabricate(Context* context) = 0;
    5858    };
    5959
     
    8282                @return The new object
    8383            */
    84             inline OrxonoxClass* fabricate(Context* context)
     84            inline Identifiable* fabricate(Context* context)
    8585            {
    8686                return static_cast<OrxonoxClass*>(new T(context));
  • code/branches/core6/test/core/object/ClassFactoryTest.cc

    r9603 r9632  
    88    {
    99        Factory* factory = new ClassFactory<BaseObject>("BaseObject");
    10         OrxonoxClass* object = factory->fabricate(NULL);
     10        Identifiable* object = factory->fabricate(NULL);
    1111        ASSERT_TRUE(object != NULL);
    1212        BaseObject* baseObject = dynamic_cast<BaseObject*>(object);
Note: See TracChangeset for help on using the changeset viewer.