Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 25, 2007, 4:07:56 AM (16 years ago)
Author:
landauf
Message:

removed the "directParent" feature - it was a clever but unnecessary feature.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchie/src/Identifier.h

    r242 r243  
    2828        public:
    2929            virtual void removeObject(OrxonoxClass* object) const = 0;
     30            virtual void removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const = 0;
    3031
    3132            virtual BaseObject* fabricate() const = 0;
     
    3435            bool isDirectlyA(const Identifier* identifier) const;
    3536            bool isChildOf(const Identifier* identifier) const;
    36             bool isDirectChildOf(const Identifier* identifier) const;
    3737            bool isParentOf(const Identifier* identifier) const;
    38             bool isDirectParentOf(const Identifier* identifier) const;
    3938
    4039            const std::string& getName() const { return this->name_; }
    41             const IdentifierList& getDirectParents() const { return this->directParents_; }
    42             const IdentifierList& getAllParents() const { return this->allParents_; }
    43             IdentifierList& getDirectChildren() const { return *this->directChildren_; }
    44             IdentifierList& getAllChildren() const { return *this->allChildren_; }
     40            const IdentifierList& getParents() const { return this->parents_; }
     41            IdentifierList& getChildren() const { return *this->children_; }
    4542
    4643            static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
     
    6865            }
    6966
    70             IdentifierList directParents_;
    71             IdentifierList allParents_;
    72             IdentifierList* directChildren_;
    73             IdentifierList* allChildren_;
     67            IdentifierList parents_;
     68            IdentifierList* children_;
    7469
    7570            std::string name_;
     
    9893            static void addObject(T* object);
    9994            void removeObject(OrxonoxClass* object) const;
     95            void removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const;
    10096
    10197        private:
     
    212208        bool bIterateForwards = !Identifier::isCreatingHierarchy();
    213209
     210        this->removeObjectIntern(object, bIterateForwards);
     211
     212        IdentifierListElement* temp = this->parents_.first_;
     213        while (temp)
     214        {
     215            temp->identifier_->removeObjectIntern(object, bIterateForwards);
     216            temp = temp->next_;
     217        }
     218    }
     219
     220    template <class T>
     221    void ClassIdentifier<T>::removeObjectIntern(OrxonoxClass* object, bool bIterateForwards) const
     222    {
    214223#if HIERARCHY_VERBOSE
    215224        if (bIterateForwards)
     
    220229
    221230        this->objects_->remove(object, bIterateForwards);
    222 
    223         IdentifierListElement* temp = this->directParents_.first_;
    224         while (temp)
    225         {
    226             temp->identifier_->removeObject(object);
    227             temp = temp->next_;
    228         }
    229231    }
    230232
     
    295297            inline bool isChildOf(const Identifier* identifier) const
    296298                { return this->identifier_->isChildOf(identifier); }
    297             inline bool isDirectChildOf(const Identifier* identifier) const
    298                 { return this->identifier_->isDirectChildOf(identifier); }
    299299            inline bool isParentOf(const Identifier* identifier) const
    300300                { return this->identifier_->isParentOf(identifier); }
    301             inline bool isDirectParentOf(const Identifier* identifier) const
    302                 { return this->identifier_->isDirectParentOf(identifier); }
    303301
    304302        private:
Note: See TracChangeset for help on using the changeset viewer.