Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 13, 2008, 2:58:55 AM (17 years ago)
Author:
landauf
Message:

Added copyconstructor to the SubclassIdentifier (this class is still a hack after the changes with the ClassManager).

Location:
code/branches/core/src/orxonox/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/orxonox/core/ClassManager.h

    r809 r810  
    134134        static std::string unknownClassName = std::string("unknown");
    135135
    136         if (ClassManager<T>::getSingleton()->bInitialized)
     136        if (ClassManager<T>::getSingleton()->bInitialized_)
    137137            return ClassManager<T>::getSingleton()->identifier_->getName();
    138138        else
  • code/branches/core/src/orxonox/core/Identifier.h

    r809 r810  
    299299            SubclassIdentifier()
    300300            {
    301                 T* temp = new T;
    302                 this->subclassIdentifier_ = temp->getIdentifier();
    303                 delete temp;
     301                std::string name = ClassManager<T>::getName();
     302
     303                if (name != "unknown")
     304                    this->subclassIdentifier_ = ClassManager<T>::getIdentifier(name);
     305                else
     306                    this->subclassIdentifier_ = 0;
    304307
    305308                this->identifier_ = this->subclassIdentifier_;
     309            }
     310
     311            /**
     312                @brief Copyconstructor: Assigns the given Identifier.
     313                @param identifier The Identifier
     314            */
     315            SubclassIdentifier(Identifier* identifier)
     316            {
     317                std::string name = ClassManager<T>::getName();
     318
     319                if (name != "unknown")
     320                    this->subclassIdentifier_ = ClassManager<T>::getIdentifier(name);
     321                else
     322                    this->subclassIdentifier_ = 0;
     323
     324                this->identifier_ = identifier;
    306325            }
    307326
Note: See TracChangeset for help on using the changeset viewer.