Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 5, 2009, 5:02:25 PM (15 years ago)
Author:
landauf
Message:

More changes in the event-system: processEvent() is now locally executed in BaseObject. The event states (like activity, visibility, …) are now defined in XMLEventPort, a function which closely resembles XMLPort. This function is used to define event states and to parse event sources from XML.

Connected the main-state directly with the event-system. After a state was declared as the "main state", the Functor from the corresponding EventState-object is used to call the function. This reduces the redundancy of declaring event-states and main-states separately. Of course only boolean event-states (like activity or visibility) can be used as main-state, while memoryless states (like spawn in ParticleSpawner) and individual states which need the triggering object (like execute in QuestEffectBeacon) won't work.

File:
1 edited

Legend:

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

    r5821 r5879  
    8787            delete (it->second);
    8888        for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
    89             delete (it->second);
    90         for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportEventContainers_.begin(); it != this->xmlportEventContainers_.end(); ++it)
    9189            delete (it->second);
    9290    }
     
    565563
    566564    /**
    567         @brief Returns a XMLPortEventContainer that attaches an event to this class.
    568         @param sectionname The name of the section that contains the event
    569         @return The container
    570     */
    571     XMLPortObjectContainer* Identifier::getXMLPortEventContainer(const std::string& eventname)
    572     {
    573         std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportEventContainers_.find(eventname);
    574         if (it != this->xmlportEventContainers_.end())
    575             return it->second;
    576         else
    577             return 0;
    578     }
    579 
    580     /**
    581         @brief Adds a new XMLPortEventContainer that attaches an event to this class.
    582         @param sectionname The name of the section that contains the event
    583         @param container The container
    584     */
    585     void Identifier::addXMLPortEventContainer(const std::string& eventname, XMLPortObjectContainer* container)
    586     {
    587         std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportEventContainers_.find(eventname);
    588         if (it != this->xmlportEventContainers_.end())
    589         {
    590             COUT(2) << "Warning: Overwriting XMLPortEventContainer in class " << this->getName() << "." << std::endl;
    591             delete (it->second);
    592         }
    593 
    594         this->xmlportEventContainers_[eventname] = container;
    595     }
    596 
    597     /**
    598565        @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
    599566        @param out The outstream
Note: See TracChangeset for help on using the changeset viewer.