Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2008, 4:35:38 AM (16 years ago)
Author:
landauf
Message:

big change in ObjectList: separated the class into a non-template base and a template wrapper for the base. this also changes the Iterator, there is now a non-template IteratorBase. this brings much more flexibility, like iterating through all objects of a given identifier without knowing the type. however this needs a dynamic_cast, which isn't quite optimal, but I think there are much worser things than that out there. ;)

there isn't much you have to know about this, except there is no more ObjectList<myClass>::start() function but a ObjectList<myClass>::begin() to be more STLish. another thing: ObjectList<myClass>::end() points now to the element _after_ the last element, so it's possible to iterate in a for-loop until (it != ObjectList<myClass>::end()). the reason is the same as above. however, (it) as a boolean still works perfectly fine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/core/Identifier.cc

    r1543 r1574  
    3939#include "ConsoleCommand.h"
    4040#include "CommandExecutor.h"
     41#include "MetaObjectList.h"
     42#include "ObjectList.h"
     43#include "OrxonoxClass.h"
    4144
    4245namespace orxonox
     
    5255    Identifier::Identifier()
    5356    {
     57        this->objects_ = new ObjectListBase(this);
     58
    5459        this->bCreatedOneObject_ = false;
    5560        this->factory_ = 0;
     
    174179
    175180    /**
     181        @brief Adds an object of the given type to the ObjectList.
     182        @param object The object to add
     183    */
     184    void Identifier::addObject(OrxonoxClass* object)
     185    {
     186        COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
     187        object->getMetaList().add(this->objects_, this->objects_->add(object));
     188    }
     189
     190    /**
    176191        @brief Returns true, if the Identifier is at least of the given type.
    177192        @param identifier The identifier to compare with
Note: See TracChangeset for help on using the changeset viewer.