Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 30, 2013, 7:26:54 PM (12 years ago)
Author:
landauf
Message:

object lists are now stored in a Context object instead of Identifiers

Location:
code/branches/core6/src/libraries/core/class
Files:
2 edited

Legend:

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

    r9602 r9606  
    5252        : classID_(IdentifierManager::classIDCounter_s++)
    5353    {
    54         this->objects_ = new ObjectListBase();
    55 
    5654        this->bCreatedOneObject_ = false;
    5755        this->bSetName_ = false;
     
    7068    Identifier::~Identifier()
    7169    {
    72         delete this->objects_;
    73 
    7470        if (this->factory_)
    7571            delete this->factory_;
  • code/branches/core6/src/libraries/core/class/Identifier.h

    r9602 r9606  
    5757
    5858    OrxonoxClass* other = object->getIdentifier()->fabricate(0);                // fabricates a new instance of MyClass
    59 
    60 
    61     // iterate through all objects of type MyClass:
    62     ObjectListBase* objects = object->getIdentifier()->getObjects();            // get a pointer to the object-list
    63     int count;
    64     for (Iterator<MyClass> it = objects.begin(); it != objects.end(); ++it)     // iterate through the objects
    65         ++count;
    66     orxout() << count << endl;                                                  // prints "2" because we created 2 instances of MyClass so far
    6759
    6860
     
    9183#include "util/Output.h"
    9284#include "core/object/ObjectList.h"
    93 #include "core/object/ObjectListBase.h"
     85#include "core/object/Listable.h"
     86#include "core/object/Context.h"
    9487#include "IdentifierManager.h"
    9588#include "Super.h"
     
    126119            /// Returns the unique ID of the class.
    127120            ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; }
    128 
    129             /// Returns the list of all existing objects of this class.
    130             inline ObjectListBase* getObjects() const { return this->objects_; }
    131121
    132122            /// Sets the Factory.
     
    231221            /// Returns the direct children of the class the Identifier belongs to.
    232222            inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; }
    233 
    234             ObjectListBase* objects_;                                      //!< The list of all objects of this class
    235223
    236224        private:
     
    424412     */
    425413    template <class T>
    426     void ClassIdentifier<T>::addObjectToList(T* object, Listable*)
    427     {
    428         orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
    429         object->elements_.push_back(this->objects_->add(object));
     414    void ClassIdentifier<T>::addObjectToList(T* object, Listable* listable)
     415    {
     416        listable->getContext()->addObject(object);
    430417    }
    431418
Note: See TracChangeset for help on using the changeset viewer.