[1505] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Fabian 'x3n' Landau |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | @file |
---|
| 31 | @brief Implementation of the BaseObject class. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | #include "BaseObject.h" |
---|
[5781] | 35 | |
---|
| 36 | #include <tinyxml/tinyxml.h> |
---|
| 37 | |
---|
[1505] | 38 | #include "CoreIncludes.h" |
---|
[5781] | 39 | #include "Event.h" |
---|
| 40 | #include "EventIncludes.h" |
---|
| 41 | #include "Functor.h" |
---|
| 42 | #include "Iterator.h" |
---|
| 43 | #include "Template.h" |
---|
| 44 | #include "XMLFile.h" |
---|
| 45 | #include "XMLNameListener.h" |
---|
| 46 | #include "XMLPort.h" |
---|
[1505] | 47 | |
---|
| 48 | namespace orxonox |
---|
| 49 | { |
---|
| 50 | CreateFactory(BaseObject); |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | @brief Constructor: Registers the object in the BaseObject-list. |
---|
| 54 | */ |
---|
[2087] | 55 | BaseObject::BaseObject(BaseObject* creator) : bInitialized_(false) |
---|
[1505] | 56 | { |
---|
| 57 | RegisterRootObject(BaseObject); |
---|
[1558] | 58 | |
---|
| 59 | this->bInitialized_ = true; |
---|
[5781] | 60 | |
---|
| 61 | this->bActive_ = true; |
---|
| 62 | this->bVisible_ = true; |
---|
| 63 | this->oldGametype_ = 0; |
---|
[5929] | 64 | this->bRegisteredEventStates_ = false; |
---|
[5781] | 65 | |
---|
| 66 | this->lastLoadedXMLElement_ = 0; |
---|
| 67 | |
---|
[5929] | 68 | this->mainStateFunctor_ = 0; |
---|
[5781] | 69 | |
---|
| 70 | this->setCreator(creator); |
---|
| 71 | if (this->creator_) |
---|
| 72 | { |
---|
| 73 | this->setFile(this->creator_->getFile()); |
---|
| 74 | this->setNamespace(this->creator_->getNamespace()); |
---|
[5929] | 75 | this->setScene(this->creator_->getScene(), this->creator_->getSceneID()); |
---|
[5781] | 76 | this->setGametype(this->creator_->getGametype()); |
---|
| 77 | } |
---|
| 78 | else |
---|
| 79 | { |
---|
| 80 | this->file_ = 0; |
---|
| 81 | this->namespace_ = 0; |
---|
| 82 | this->scene_ = 0; |
---|
[5929] | 83 | this->sceneID_ = OBJECTID_UNKNOWN; |
---|
[5781] | 84 | this->gametype_ = 0; |
---|
| 85 | } |
---|
[1505] | 86 | } |
---|
| 87 | |
---|
| 88 | /** |
---|
| 89 | @brief Destructor |
---|
| 90 | */ |
---|
| 91 | BaseObject::~BaseObject() |
---|
| 92 | { |
---|
[2662] | 93 | if (this->isInitialized()) |
---|
| 94 | { |
---|
[5929] | 95 | for (std::map<BaseObject*, std::string>::const_iterator it = this->eventSources_.begin(); it != this->eventSources_.end(); ) |
---|
| 96 | this->removeEventSource((it++)->first); |
---|
[5781] | 97 | |
---|
[5929] | 98 | for (std::set<BaseObject*>::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ) |
---|
| 99 | (*(it++))->removeEventSource(this); |
---|
[5781] | 100 | |
---|
[5929] | 101 | for (std::map<std::string, EventState*>::const_iterator it = this->eventStates_.begin(); it != this->eventStates_.end(); ++it) |
---|
| 102 | delete it->second; |
---|
[2662] | 103 | } |
---|
[1505] | 104 | } |
---|
[5781] | 105 | |
---|
| 106 | /** |
---|
| 107 | @brief XML loading and saving. |
---|
| 108 | @param xmlelement The XML-element |
---|
| 109 | @param loading Loading (true) or saving (false) |
---|
| 110 | */ |
---|
| 111 | void BaseObject::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 112 | { |
---|
| 113 | XMLPortParam(BaseObject, "name", setXMLName, getName, xmlelement, mode); |
---|
| 114 | XMLPortParam(BaseObject, "visible", setVisible, isVisible, xmlelement, mode); |
---|
| 115 | XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode); |
---|
| 116 | XMLPortParam(BaseObject, "mainstate", setMainStateName, getMainStateName, xmlelement, mode); |
---|
[6524] | 117 | XMLPortParamTemplate(BaseObject, "template", addTemplate, getSingleTemplate, xmlelement, mode, const std::string&); |
---|
| 118 | |
---|
[5781] | 119 | XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*); |
---|
[5929] | 120 | XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode); |
---|
[6417] | 121 | |
---|
[5929] | 122 | Element* events = 0; |
---|
| 123 | if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject) |
---|
| 124 | events = xmlelement.FirstChildElement("events", false); |
---|
| 125 | else if (mode == XMLPort::SaveObject) |
---|
| 126 | {} |
---|
[5781] | 127 | if (events) |
---|
[5929] | 128 | this->XMLEventPort(*events, mode); |
---|
| 129 | } |
---|
[5781] | 130 | |
---|
[5929] | 131 | /** |
---|
| 132 | @brief Defines the possible event states of this object and parses eventsources from an XML file. |
---|
| 133 | @param xmlelement The XML-element |
---|
| 134 | @param loading Loading (true) or saving (false) |
---|
| 135 | */ |
---|
| 136 | void BaseObject::XMLEventPort(Element& xmlelement, XMLPort::Mode mode) |
---|
| 137 | { |
---|
| 138 | XMLPortEventState(BaseObject, BaseObject, "activity", setActive, xmlelement, mode); |
---|
| 139 | XMLPortEventState(BaseObject, BaseObject, "visibility", setVisible, xmlelement, mode); |
---|
| 140 | XMLPortEventState(BaseObject, BaseObject, "mainstate", setMainState, xmlelement, mode); |
---|
[6417] | 141 | |
---|
[5929] | 142 | this->bRegisteredEventStates_ = true; |
---|
[5781] | 143 | } |
---|
| 144 | |
---|
| 145 | /** |
---|
| 146 | @brief Loads the name of the object through XML and calls all XMLNameListener. |
---|
| 147 | @param name The name of the object |
---|
| 148 | */ |
---|
| 149 | void BaseObject::setXMLName(const std::string& name) |
---|
| 150 | { |
---|
| 151 | this->setName(name); |
---|
| 152 | |
---|
| 153 | for (ObjectList<XMLNameListener>::iterator it = ObjectList<XMLNameListener>::begin(); it != ObjectList<XMLNameListener>::end(); ++it) |
---|
| 154 | it->loadedNewXMLName(this); |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | /** |
---|
| 158 | @brief Returns the levelfile that loaded this object. |
---|
| 159 | @return The levelfile |
---|
| 160 | */ |
---|
| 161 | const std::string& BaseObject::getFilename() const |
---|
| 162 | { |
---|
| 163 | if (this->file_) |
---|
| 164 | return this->file_->getFilename(); |
---|
| 165 | else |
---|
| 166 | return BLANKSTRING; |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | /** |
---|
| 170 | @brief Adds a Template to the object. |
---|
| 171 | @param name The name of the Template |
---|
| 172 | */ |
---|
| 173 | void BaseObject::addTemplate(const std::string& name) |
---|
| 174 | { |
---|
| 175 | Template* temp = Template::getTemplate(name); |
---|
| 176 | if (temp) |
---|
| 177 | this->addTemplate(temp); |
---|
| 178 | else |
---|
| 179 | COUT(1) << "Error: \"" << name << "\" is not a valid Template name (in class: " << this->getIdentifier()->getName() << ", name: " << this->getName() << ")." << std::endl; |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | /** |
---|
| 183 | @brief Adds a Template to the object. |
---|
| 184 | @param temp The Template |
---|
| 185 | */ |
---|
| 186 | void BaseObject::addTemplate(Template* temp) |
---|
| 187 | { |
---|
| 188 | this->templates_.insert(temp); |
---|
| 189 | temp->applyOn(this); |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | /** |
---|
[6524] | 193 | @brief Returns the name of the first Template. |
---|
| 194 | @return The name as string. |
---|
| 195 | */ |
---|
| 196 | const std::string& BaseObject::getSingleTemplate(void) const |
---|
| 197 | { |
---|
| 198 | if(this->templates_.empty()) |
---|
| 199 | return BLANKSTRING; |
---|
| 200 | |
---|
| 201 | return (*this->templates_.begin())->getName(); |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | /** |
---|
[5781] | 205 | @brief Returns the Template with the given index. |
---|
| 206 | @param index The index |
---|
| 207 | */ |
---|
| 208 | Template* BaseObject::getTemplate(unsigned int index) const |
---|
| 209 | { |
---|
| 210 | unsigned int i = 0; |
---|
| 211 | for (std::set<Template*>::const_iterator it = this->templates_.begin(); it != this->templates_.end(); ++it) |
---|
| 212 | { |
---|
| 213 | if (i == index) |
---|
| 214 | return (*it); |
---|
| 215 | i++; |
---|
| 216 | } |
---|
| 217 | return 0; |
---|
| 218 | } |
---|
| 219 | |
---|
[5929] | 220 | /** |
---|
| 221 | @brief Adds a new event source for a specific state. |
---|
| 222 | @param source The object which sends events to this object |
---|
| 223 | @param state The state of this object which will be affected by the events |
---|
| 224 | */ |
---|
| 225 | void BaseObject::addEventSource(BaseObject* source, const std::string& state) |
---|
[5781] | 226 | { |
---|
[5929] | 227 | this->eventSources_[source] = state; |
---|
| 228 | source->registerEventListener(this); |
---|
[5781] | 229 | } |
---|
| 230 | |
---|
[5929] | 231 | /** |
---|
| 232 | @brief Removes an eventsource (but doesn't unregister itself at the source). |
---|
| 233 | */ |
---|
| 234 | void BaseObject::removeEventSource(BaseObject* source) |
---|
[5781] | 235 | { |
---|
[5929] | 236 | this->eventSources_.erase(source); |
---|
| 237 | source->unregisterEventListener(this); |
---|
[5781] | 238 | } |
---|
| 239 | |
---|
[5929] | 240 | /** |
---|
| 241 | @brief Returns an eventsource with a given index. |
---|
| 242 | */ |
---|
| 243 | BaseObject* BaseObject::getEventSource(unsigned int index, const std::string& state) const |
---|
[5781] | 244 | { |
---|
| 245 | unsigned int i = 0; |
---|
[5929] | 246 | for (std::map<BaseObject*, std::string>::const_iterator it = this->eventSources_.begin(); it != this->eventSources_.end(); ++it) |
---|
[5781] | 247 | { |
---|
[5929] | 248 | if (it->second != state) |
---|
| 249 | continue; |
---|
[6417] | 250 | |
---|
[5781] | 251 | if (i == index) |
---|
[5929] | 252 | return it->first; |
---|
[5781] | 253 | ++i; |
---|
| 254 | } |
---|
| 255 | return 0; |
---|
| 256 | } |
---|
| 257 | |
---|
[5929] | 258 | /** |
---|
| 259 | @brief Adds an object which listens to the events of this object. The events are sent to the other objects mainstate. |
---|
| 260 | */ |
---|
| 261 | void BaseObject::addEventListener(BaseObject* listener) |
---|
[5781] | 262 | { |
---|
[5929] | 263 | this->eventListenersXML_.insert(listener); |
---|
| 264 | listener->addEventSource(this, "mainstate"); |
---|
| 265 | } |
---|
[6417] | 266 | |
---|
[5929] | 267 | /** |
---|
| 268 | @brief Returns an event listener with a given index. |
---|
| 269 | */ |
---|
| 270 | BaseObject* BaseObject::getEventListener(unsigned int index) const |
---|
| 271 | { |
---|
| 272 | unsigned int i = 0; |
---|
| 273 | for (std::set<BaseObject*>::const_iterator it = this->eventListenersXML_.begin(); it != this->eventListenersXML_.end(); ++it) |
---|
[5781] | 274 | { |
---|
[5929] | 275 | if (i == index) |
---|
| 276 | return *it; |
---|
| 277 | ++i; |
---|
| 278 | } |
---|
| 279 | return 0; |
---|
| 280 | } |
---|
| 281 | |
---|
| 282 | /** |
---|
| 283 | @brief Adds a new event-state to the object. Event-states are states which can be changed by events. |
---|
| 284 | @param name The name of the event |
---|
| 285 | @param state The object containing information about the event-state |
---|
| 286 | */ |
---|
| 287 | void BaseObject::addEventState(const std::string& name, EventState* state) |
---|
| 288 | { |
---|
| 289 | std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(name); |
---|
| 290 | if (it != this->eventStates_.end()) |
---|
| 291 | { |
---|
[6417] | 292 | COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << std::endl; |
---|
[5781] | 293 | delete (it->second); |
---|
| 294 | } |
---|
| 295 | |
---|
[5929] | 296 | this->eventStates_[name] = state; |
---|
[5781] | 297 | } |
---|
| 298 | |
---|
[5929] | 299 | /** |
---|
| 300 | @brief Returns the event-state with the given name. |
---|
| 301 | */ |
---|
| 302 | EventState* BaseObject::getEventState(const std::string& name) const |
---|
[5781] | 303 | { |
---|
[5929] | 304 | std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(name); |
---|
| 305 | if (it != this->eventStates_.end()) |
---|
[6417] | 306 | return (it->second); |
---|
[5781] | 307 | else |
---|
| 308 | return 0; |
---|
| 309 | } |
---|
| 310 | |
---|
[5929] | 311 | /** |
---|
| 312 | @brief Fires an event (without a state). |
---|
| 313 | */ |
---|
| 314 | void BaseObject::fireEvent(const std::string& name) |
---|
[5781] | 315 | { |
---|
[5929] | 316 | this->fireEvent(true, name); |
---|
| 317 | this->fireEvent(false, name); |
---|
[5781] | 318 | } |
---|
| 319 | |
---|
[5929] | 320 | /** |
---|
| 321 | @brief Fires an event which activates or deactivates a state. |
---|
| 322 | */ |
---|
| 323 | void BaseObject::fireEvent(bool activate, const std::string& name) |
---|
[5781] | 324 | { |
---|
[5929] | 325 | this->fireEvent(activate, this, name); |
---|
[5781] | 326 | } |
---|
| 327 | |
---|
[5929] | 328 | /** |
---|
| 329 | @brief Fires an event which activates or deactivates a state with agiven originator (the object which triggered the event). |
---|
| 330 | */ |
---|
| 331 | void BaseObject::fireEvent(bool activate, BaseObject* originator, const std::string& name) |
---|
[5781] | 332 | { |
---|
[5929] | 333 | Event event(activate, originator, name); |
---|
[5781] | 334 | |
---|
[5929] | 335 | for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it) |
---|
[5781] | 336 | { |
---|
[5929] | 337 | event.statename_ = (*it)->eventSources_[this]; |
---|
| 338 | (*it)->processEvent(event); |
---|
[5781] | 339 | } |
---|
| 340 | } |
---|
| 341 | |
---|
[5929] | 342 | /** |
---|
| 343 | @brief Fires an event, using the Event struct. |
---|
| 344 | */ |
---|
[5781] | 345 | void BaseObject::fireEvent(Event& event) |
---|
| 346 | { |
---|
[5929] | 347 | for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it) |
---|
| 348 | (*it)->processEvent(event); |
---|
[5781] | 349 | } |
---|
| 350 | |
---|
[5929] | 351 | /** |
---|
| 352 | @brief Processing an event by calling the right main state. |
---|
| 353 | @param event The event struct which contains the information about the event |
---|
| 354 | */ |
---|
[5781] | 355 | void BaseObject::processEvent(Event& event) |
---|
| 356 | { |
---|
[5929] | 357 | this->registerEventStates(); |
---|
[6417] | 358 | |
---|
[5929] | 359 | std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_); |
---|
| 360 | if (it != this->eventStates_.end()) |
---|
| 361 | it->second->process(event, this); |
---|
[6417] | 362 | else if (!event.statename_.empty()) |
---|
[5929] | 363 | COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl; |
---|
| 364 | else |
---|
| 365 | COUT(2) << "Warning: Event with invalid source sent to object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl; |
---|
[5781] | 366 | } |
---|
| 367 | |
---|
[5929] | 368 | /** |
---|
| 369 | @brief Sets the main state of the object to a given boolean value. |
---|
[6417] | 370 | |
---|
[5929] | 371 | Note: The main state of an object can be set with the @ref setMainStateName function. |
---|
| 372 | It's part of the eventsystem and used for event forwarding (when the target object can't specify a specific state, |
---|
| 373 | the main state is used by default). |
---|
| 374 | */ |
---|
| 375 | void BaseObject::setMainState(bool state) |
---|
[5781] | 376 | { |
---|
[5929] | 377 | if (this->mainStateFunctor_) |
---|
[5781] | 378 | { |
---|
[5929] | 379 | if (this->mainStateFunctor_->getParamCount() == 0) |
---|
| 380 | { |
---|
| 381 | if (state) |
---|
| 382 | (*this->mainStateFunctor_)(); |
---|
| 383 | } |
---|
| 384 | else |
---|
| 385 | { |
---|
| 386 | (*this->mainStateFunctor_)(state); |
---|
| 387 | } |
---|
[5781] | 388 | } |
---|
| 389 | else |
---|
| 390 | COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl; |
---|
| 391 | } |
---|
| 392 | |
---|
[5929] | 393 | /** |
---|
| 394 | @brief This function gets called if the main state name of the object changes. |
---|
| 395 | */ |
---|
| 396 | void BaseObject::changedMainStateName() |
---|
[5781] | 397 | { |
---|
[5929] | 398 | this->mainStateFunctor_ = 0; |
---|
| 399 | |
---|
[6417] | 400 | if (!this->mainStateName_.empty()) |
---|
[5781] | 401 | { |
---|
[5929] | 402 | this->registerEventStates(); |
---|
[6417] | 403 | |
---|
[5929] | 404 | std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_); |
---|
| 405 | if (it != this->eventStates_.end() && it->second->getFunctor()) |
---|
| 406 | { |
---|
| 407 | if (it->second->getFunctor()->getParamCount() <= 1) |
---|
| 408 | this->mainStateFunctor_ = it->second->getFunctor(); |
---|
| 409 | else |
---|
| 410 | COUT(2) << "Warning: Can't use \"" << this->mainStateName_ << "\" as MainState because it needs a second argument." << std::endl; |
---|
| 411 | } |
---|
| 412 | else |
---|
| 413 | COUT(2) << "Warning: \"" << this->mainStateName_ << "\" is not a valid MainState." << std::endl; |
---|
[5781] | 414 | } |
---|
[5929] | 415 | } |
---|
[6417] | 416 | |
---|
[5929] | 417 | /** |
---|
| 418 | @brief Calls XMLEventPort with an empty XML-element to register the event states if necessary. |
---|
| 419 | */ |
---|
| 420 | void BaseObject::registerEventStates() |
---|
| 421 | { |
---|
| 422 | if (!this->bRegisteredEventStates_) |
---|
[5781] | 423 | { |
---|
[5929] | 424 | Element xmlelement; |
---|
| 425 | this->XMLEventPort(xmlelement, XMLPort::NOP); |
---|
[5781] | 426 | } |
---|
| 427 | } |
---|
[6417] | 428 | |
---|
[5929] | 429 | /** |
---|
| 430 | @brief Manually loads all event states, even if the class doesn't officially support them. This is needed by some classes like @ref EventDispatcher or @ref EventTarget. |
---|
| 431 | */ |
---|
| 432 | void BaseObject::loadAllEventStates(Element& xmlelement, XMLPort::Mode mode, BaseObject* object, Identifier* identifier) |
---|
| 433 | { |
---|
| 434 | Element* events = xmlelement.FirstChildElement("events", false); |
---|
| 435 | if (events) |
---|
| 436 | { |
---|
| 437 | // get the list of all states present |
---|
| 438 | std::list<std::string> eventnames; |
---|
| 439 | if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject) |
---|
| 440 | { |
---|
| 441 | for (ticpp::Iterator<ticpp::Element> child = events->FirstChildElement(false); child != child.end(); child++) |
---|
| 442 | eventnames.push_back(child->Value()); |
---|
| 443 | } |
---|
| 444 | else if (mode == XMLPort::SaveObject) |
---|
| 445 | { |
---|
| 446 | } |
---|
[5781] | 447 | |
---|
[5929] | 448 | // iterate through all states and get the event sources |
---|
| 449 | for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it) |
---|
| 450 | { |
---|
[6417] | 451 | const std::string& statename = (*it); |
---|
[5929] | 452 | |
---|
| 453 | // if the event state is already known, continue with the next state |
---|
| 454 | orxonox::EventState* eventstate = object->getEventState(statename); |
---|
| 455 | if (eventstate) |
---|
| 456 | continue; |
---|
| 457 | |
---|
| 458 | XMLPortClassObjectContainer<BaseObject, BaseObject>* container = (XMLPortClassObjectContainer<BaseObject, BaseObject>*)(identifier->getXMLPortObjectContainer(statename)); |
---|
| 459 | if (!container) |
---|
| 460 | { |
---|
[6417] | 461 | ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')'); |
---|
| 462 | ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')'); |
---|
[5929] | 463 | setfunctor->setDefaultValue(1, statename); |
---|
| 464 | getfunctor->setDefaultValue(1, statename); |
---|
| 465 | |
---|
| 466 | container = new XMLPortClassObjectContainer<BaseObject, BaseObject>(statename, identifier, setfunctor, getfunctor, false, true); |
---|
| 467 | identifier->addXMLPortObjectContainer(statename, container); |
---|
| 468 | } |
---|
| 469 | container->port(object, *events, mode); |
---|
| 470 | } |
---|
| 471 | } |
---|
[5781] | 472 | } |
---|
[1505] | 473 | } |
---|