Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2015, 10:59:13 PM (9 years ago)
Author:
landauf
Message:

fixed issue: Class(T) may not be allowed in StaticallyInitializedIdentifier::load() because T may not yet be initialized.
now the inheritance is resolved in Identifier::finishInitialization()

File:
1 edited

Legend:

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

    r10483 r10512  
    7979            delete this->factory_;
    8080
     81        for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)
     82            delete (*it);
     83
    8184        for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
    8285            delete (it->second);
     
    121124     * @brief Used to define the direct parents of an Identifier of an abstract class.
    122125     */
    123     Identifier& Identifier::inheritsFrom(Identifier* directParent)
    124     {
    125         if (this->parents_.empty())
    126             this->directParents_.push_back(directParent);
    127         else
    128             orxout(internal_error) << "Trying to add " << directParent->getName() << " as a direct parent of " << this->getName() << " after the latter was already initialized" << endl;
     126    Identifier& Identifier::inheritsFrom(InheritsFrom* directParent)
     127    {
     128        if (this->directParents_.empty())
     129            this->manualDirectParents_.push_back(directParent);
     130        else
     131            orxout(internal_error) << "Trying to manually add direct parent of " << this->getName() << " after the latter was already initialized" << endl;
    129132
    130133        return *this;
     
    183186            this->verifyIdentifierTrace();
    184187        }
    185         else if (!this->directParents_.empty())
     188        else if (!this->manualDirectParents_.empty())
    186189        {
    187190            // no parents defined -> this class was manually initialized by calling inheritsFrom<Class>()
    188191
    189192            // initialize all direct parents
    190             for (std::list<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
    191                 const_cast<Identifier*>(*it)->finishInitialization(); // initialize parent
     193            for (std::list<const InheritsFrom*>::const_iterator it = this->manualDirectParents_.begin(); it != this->manualDirectParents_.end(); ++it)
     194            {
     195                Identifier* directParent = (*it)->getParent();
     196                this->directParents_.push_back(directParent);
     197                directParent->finishInitialization(); // initialize parent
     198            }
    192199
    193200            // direct parents and their parents are also parents of this identifier (but only add them once)
Note: See TracChangeset for help on using the changeset viewer.