Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5775 for code/branches/core5


Ignore:
Timestamp:
Sep 23, 2009, 11:35:54 PM (15 years ago)
Author:
landauf
Message:

Added copyconstructor and copyassignment to SubclassIdentifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/Identifier.h

    r5738 r5775  
    532532
    533533            /**
    534                 @brief Copyconstructor: Assigns the given Identifier.
     534                @brief Constructor: Assigns the given Identifier.
    535535                @param identifier The Identifier
    536536            */
     
    538538            {
    539539                this->operator=(identifier);
     540            }
     541
     542            /**
     543                @brief Copyconstructor: Assigns the identifier of the other SubclassIdentifier.
     544                @param identifier The other SublcassIdentifier
     545            */
     546            template <class O>
     547            SubclassIdentifier(const SubclassIdentifier<O>& identifier)
     548            {
     549                this->operator=(identifier.getIdentifier());
    540550            }
    541551
     
    545555                @return The SubclassIdentifier itself
    546556            */
    547             SubclassIdentifier<T>& operator=(Identifier* identifier)
     557            const SubclassIdentifier<T>& operator=(Identifier* identifier)
    548558            {
    549559                if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
     
    568578
    569579            /**
     580                @brief Overloading of the = operator: assigns the identifier of the other SubclassIdentifier.
     581                @param identifier The other SublcassIdentifier
     582            */
     583            template <class O>
     584            const SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
     585            {
     586                return this->operator=(identifier.getIdentifier());
     587            }
     588
     589            /**
    570590                @brief Overloading of the * operator: returns the assigned identifier.
    571591            */
     
    612632                        COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;
    613633                        COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;
    614                         COUT(1) << "Aborting..." << std::endl;
    615634                    }
    616635                    else
     
    618637                        COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;
    619638                        COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl;
    620                         COUT(1) << "Aborting..." << std::endl;
    621639                    }
    622640
     
    629647            inline Identifier* getIdentifier() const
    630648                { return this->identifier_; }
    631 
    632 //            /** @brief Returns true, if the assigned identifier is at least of the given type. @param identifier The identifier to compare with */
    633 //            inline bool isA(const Identifier* identifier) const
    634 //                { return this->identifier_->isA(identifier); }
    635 //
    636 //            /** @brief Returns true, if the assigned identifier is exactly of the given type. @param identifier The identifier to compare with */
    637 //            inline bool isExactlyA(const Identifier* identifier) const
    638 //                { return this->identifier_->isExactlyA(identifier); }
    639 //
    640 //            /** @brief Returns true, if the assigned identifier is a child of the given identifier. @param identifier The identifier to compare with */
    641 //            inline bool isChildOf(const Identifier* identifier) const
    642 //                { return this->identifier_->isChildOf(identifier); }
    643 //
    644 //            /** @brief Returns true, if the assigned identifier is a direct child of the given identifier. @param identifier The identifier to compare with */
    645 //            inline bool isDirectChildOf(const Identifier* identifier) const
    646 //                { return this->identifier_->isDirectChildOf(identifier); }
    647 //
    648 //            /** @brief Returns true, if the assigned identifier is a parent of the given identifier. @param identifier The identifier to compare with */
    649 //            inline bool isParentOf(const Identifier* identifier) const
    650 //                { return this->identifier_->isParentOf(identifier); }
    651 //
    652 //            /** @brief Returns true, if the assigned identifier is a direct parent of the given identifier. @param identifier The identifier to compare with */
    653 //            inline bool isDirectParentOf(const Identifier* identifier) const
    654 //                { return this->identifier_->isDirectParentOf(identifier); }
    655649
    656650        private:
Note: See TracChangeset for help on using the changeset viewer.