Changeset 7200 for code/branches/consolecommands3/src/libraries/core
- Timestamp:
- Aug 22, 2010, 12:27:53 AM (14 years ago)
- Location:
- code/branches/consolecommands3/src/libraries/core
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/core/BaseObject.cc
r7163 r7200 477 477 if (!container) 478 478 { 479 ExecutorMember<BaseObject>*setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')');480 ExecutorMember<BaseObject>*getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')');479 const ExecutorMemberPtr<BaseObject>& setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')'); 480 const ExecutorMemberPtr<BaseObject>& getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')'); 481 481 setfunctor->setDefaultValue(1, statename); 482 482 getfunctor->setDefaultValue(1, statename); -
code/branches/consolecommands3/src/libraries/core/EventIncludes.h
r7163 r7200 76 76 77 77 #define XMLPortEventStateIntern(name, classname, statename, xmlelement, mode) \ 78 static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \ 79 static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \ 78 static orxonox::ExecutorMemberPtr<classname> xmlsetfunctor##name = orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')').cast<orxonox::ExecutorMember<classname> >(); \ 79 static orxonox::ExecutorMemberPtr<classname> xmlgetfunctor##name = orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')').cast<orxonox::ExecutorMember<classname> >(); \ 80 xmlsetfunctor##name->setDefaultValue(1, statename); \ 81 xmlgetfunctor##name->setDefaultValue(1, statename); \ 80 82 XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true) 81 83 -
code/branches/consolecommands3/src/libraries/core/Executor.cc
r7198 r7200 191 191 } 192 192 193 Executor& Executor::setDefaultValues(const MultiType& param1) 194 { 195 this->defaultValue_[0] = param1; 196 197 return (*this); 198 } 199 200 Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2) 201 { 202 this->defaultValue_[0] = param1; 203 this->defaultValue_[1] = param2; 204 205 return (*this); 206 } 207 208 Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3) 193 void Executor::setDefaultValues(const MultiType& param1) 194 { 195 this->defaultValue_[0] = param1; 196 } 197 198 void Executor::setDefaultValues(const MultiType& param1, const MultiType& param2) 199 { 200 this->defaultValue_[0] = param1; 201 this->defaultValue_[1] = param2; 202 } 203 204 void Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3) 209 205 { 210 206 this->defaultValue_[0] = param1; 211 207 this->defaultValue_[1] = param2; 212 208 this->defaultValue_[2] = param3; 213 214 return (*this); 215 } 216 217 Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) 209 } 210 211 void Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4) 218 212 { 219 213 this->defaultValue_[0] = param1; … … 221 215 this->defaultValue_[2] = param3; 222 216 this->defaultValue_[3] = param4; 223 224 return (*this); 225 } 226 227 Executor& Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) 217 } 218 219 void Executor::setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) 228 220 { 229 221 this->defaultValue_[0] = param1; … … 232 224 this->defaultValue_[3] = param4; 233 225 this->defaultValue_[4] = param5; 234 235 return (*this); 236 } 237 238 Executor& Executor::setDefaultValue(unsigned int index, const MultiType& param) 226 } 227 228 void Executor::setDefaultValue(unsigned int index, const MultiType& param) 239 229 { 240 230 if (index < MAX_FUNCTOR_ARGUMENTS) 241 231 this->defaultValue_[index] = param; 242 243 return (*this);244 232 } 245 233 -
code/branches/consolecommands3/src/libraries/core/Executor.h
r7198 r7200 81 81 { return this->name_; } 82 82 83 Executor&setDefaultValues(const MultiType& param1);84 Executor&setDefaultValues(const MultiType& param1, const MultiType& param2);85 Executor&setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3);86 Executor&setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4);87 Executor&setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5);88 Executor&setDefaultValue(unsigned int index, const MultiType& param);83 void setDefaultValues(const MultiType& param1); 84 void setDefaultValues(const MultiType& param1, const MultiType& param2); 85 void setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3); 86 void setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4); 87 void setDefaultValues(const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5); 88 void setDefaultValue(unsigned int index, const MultiType& param); 89 89 90 90 inline MultiType getDefaultValue(unsigned int index) const … … 169 169 170 170 this->functorMember_->setObject(object); 171 const MultiType& result = Executor::parse(params, success, delimiter);171 const MultiType& result = this->Executor::parse(params, success, delimiter); 172 172 this->functorMember_->setObjects(objects); 173 173 … … 180 180 181 181 this->functorMember_->setObject(object); 182 const MultiType& result = Executor::parse(params, success, delimiter);182 const MultiType& result = this->Executor::parse(params, success, delimiter); 183 183 this->functorMember_->setObjects(objects); 184 184 … … 190 190 }; 191 191 192 inline Executor *createExecutor(const FunctorPtr& functor, const std::string& name = "")192 inline ExecutorPtr createExecutor(const FunctorPtr& functor, const std::string& name = "") 193 193 { 194 194 return new Executor(functor, name); … … 196 196 197 197 template <class T> 198 inline ExecutorMember <T>*createExecutor(const FunctorMemberPtr<T>& functor, const std::string& name = "")198 inline ExecutorMemberPtr<T> createExecutor(const FunctorMemberPtr<T>& functor, const std::string& name = "") 199 199 { 200 200 return new ExecutorMember<T>(functor, name); 201 201 } 202 202 203 inline ExecutorStatic *createExecutor(const FunctorStaticPtr& functor, const std::string& name = "")203 inline ExecutorStaticPtr createExecutor(const FunctorStaticPtr& functor, const std::string& name = "") 204 204 { 205 205 return new ExecutorStatic(functor, name); -
code/branches/consolecommands3/src/libraries/core/Thread.cc
r6417 r7200 75 75 } 76 76 77 bool Thread::evaluateExecutor( Executor*executor )77 bool Thread::evaluateExecutor( const ExecutorPtr& executor ) 78 78 { 79 79 this->isWorkingMutex_->lock(); … … 92 92 { 93 93 //this->executorMutex_->lock(); 94 Executor *executor = this->executor_;94 ExecutorPtr executor = this->executor_; 95 95 //this->executorMutex_->unlock(); 96 96 if( executor ) … … 98 98 (*executor)(); 99 99 this->executorMutex_->lock(); 100 delete this->executor_;101 100 this->executor_ = 0; 102 101 this->executorMutex_->unlock(); -
code/branches/consolecommands3/src/libraries/core/Thread.h
r6417 r7200 46 46 bool isWorking(); 47 47 void waitUntilFinished(); 48 bool evaluateExecutor( Executor*executor );48 bool evaluateExecutor( const ExecutorPtr& executor ); 49 49 50 50 private: 51 51 void threadLoop(); 52 52 53 Executor *executor_;53 ExecutorPtr executor_; 54 54 bool isWorking_; 55 55 bool stopThread_; 56 56 boost::thread* workerThread_; 57 57 boost::mutex* executorMutex_; 58 boost::mutex* 58 boost::mutex* isWorkingMutex_; 59 59 boost::mutex* stopThreadMutex_; 60 60 }; -
code/branches/consolecommands3/src/libraries/core/ThreadPool.cc
r6417 r7200 81 81 } 82 82 83 bool ThreadPool::passFunction( Executor*executor, bool addThread )83 bool ThreadPool::passFunction( const ExecutorPtr& executor, bool addThread ) 84 84 { 85 85 std::vector<Thread*>::iterator it; -
code/branches/consolecommands3/src/libraries/core/ThreadPool.h
r6417 r7200 46 46 unsigned int setNrOfThreads( unsigned int nr ); 47 47 48 bool passFunction( Executor*executor, bool addThread=false );48 bool passFunction( const ExecutorPtr& executor, bool addThread=false ); 49 49 void synchronise(); 50 50 -
code/branches/consolecommands3/src/libraries/core/XMLPort.h
r7189 r7200 75 75 */ 76 76 #define XMLPortParam(classname, paramname, loadfunction, savefunction, xmlelement, mode) \ 77 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \78 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \77 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 78 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 79 79 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode) 80 80 … … 94 94 #define XMLPortParamVariable(classname, paramname, variable, xmlelement, mode) \ 95 95 XMLPortVariableHelperClass xmlcontainer##variable##dummy(static_cast<void*>(&variable)); \ 96 static ExecutorMember <orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##loadexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getLoader(variable)), std::string( #classname ) + "::" + #variable + "loader")); \97 static ExecutorMember <orxonox::XMLPortVariableHelperClass>* xmlcontainer##variable##saveexecutor = static_cast<ExecutorMember<orxonox::XMLPortVariableHelperClass>*>(orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getSaver (variable)), std::string( #classname ) + "::" + #variable + "saver" )); \96 static ExecutorMemberPtr<orxonox::XMLPortVariableHelperClass> xmlcontainer##variable##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getLoader(variable)), std::string( #classname ) + "::" + #variable + "loader"); \ 97 static ExecutorMemberPtr<orxonox::XMLPortVariableHelperClass> xmlcontainer##variable##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(orxonox::XMLPortVariableHelperClass::getSaver (variable)), std::string( #classname ) + "::" + #variable + "saver" ); \ 98 98 XMLPortParamGeneric(xmlcontainer##variable, classname, orxonox::XMLPortVariableHelperClass, &xmlcontainer##variable##dummy, paramname, xmlcontainer##variable##loadexecutor, xmlcontainer##variable##saveexecutor, xmlelement, mode) 99 99 … … 110 110 */ 111 111 #define XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, ...) \ 112 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \113 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \112 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 113 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 114 114 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode) 115 115 … … 129 129 */ 130 130 #define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, mode) \ 131 static ExecutorMember <classname>*xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \131 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 132 132 XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, xmlcontainer##loadfunction##0##loadexecutor, 0, xmlelement, mode) 133 133 /** … … 135 135 */ 136 136 #define XMLPortParamLoadOnlyTemplate(classname, paramname, loadfunction, xmlelement, mode, ...) \ 137 static ExecutorMember <classname>*xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \137 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##0##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 138 138 XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, xmlcontainer##loadfunction##0##loadexecutor, 0, xmlelement, mode) 139 139 … … 161 161 */ 162 162 #define XMLPortParamExtern(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode) \ 163 static ExecutorMember <externclass>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \164 static ExecutorMember <externclass>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \163 static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \ 164 static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \ 165 165 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode); 166 166 /** … … 168 168 */ 169 169 #define XMLPortParamExternTemplate(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode, ...) \ 170 static ExecutorMember <externclass>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \171 static ExecutorMember <externclass>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \170 static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<externclass, __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction); \ 171 static ExecutorMemberPtr<externclass> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction); \ 172 172 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode); 173 173 … … 249 249 */ 250 250 #define XMLPortObjectExtended(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \ 251 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \252 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \251 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 252 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 253 253 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore) 254 254 /** … … 256 256 */ 257 257 #define XMLPortObjectExtendedTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \ 258 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \259 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \258 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 259 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 260 260 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore) 261 261 … … 267 267 */ 268 268 #define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode) \ 269 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \270 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \269 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 270 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 271 271 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, false, true) 272 272 /** … … 274 274 */ 275 275 #define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, ...) \ 276 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \277 static ExecutorMember <classname>*xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \276 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##loadexecutor = orxonox::createExecutor(orxonox::createFunctor<classname, __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction); \ 277 static ExecutorMemberPtr<classname> xmlcontainer##loadfunction##savefunction##saveexecutor = orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction); \ 278 278 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, xmlcontainer##loadfunction##savefunction##loadexecutor, xmlcontainer##loadfunction##savefunction##saveexecutor, xmlelement, mode, false, true) 279 279 … … 348 348 349 349 public: 350 XMLPortClassParamContainer(const std::string& paramname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>*saveexecutor)350 XMLPortClassParamContainer(const std::string& paramname, Identifier* identifier, const ExecutorMemberPtr<T>& loadexecutor, const ExecutorMemberPtr<T>& saveexecutor) 351 351 { 352 352 this->paramname_ = paramname; … … 358 358 ~XMLPortClassParamContainer() 359 359 { 360 assert(this->loadexecutor_);361 delete this->loadexecutor_;362 if (this->saveexecutor_)363 delete this->saveexecutor_;364 360 } 365 361 … … 479 475 480 476 private: 481 ExecutorMember <T>*loadexecutor_;482 ExecutorMember <T>*saveexecutor_;477 ExecutorMemberPtr<T> loadexecutor_; 478 ExecutorMemberPtr<T> saveexecutor_; 483 479 ParseParams parseParams_; 484 480 }; … … 522 518 { 523 519 public: 524 XMLPortClassObjectContainer(const std::string& sectionname, Identifier* identifier, ExecutorMember<T>* loadexecutor, ExecutorMember<T>*saveexecutor, bool bApplyLoaderMask, bool bLoadBefore)520 XMLPortClassObjectContainer(const std::string& sectionname, Identifier* identifier, const ExecutorMemberPtr<T>& loadexecutor, const ExecutorMemberPtr<T>& saveexecutor, bool bApplyLoaderMask, bool bLoadBefore) 525 521 { 526 522 this->sectionname_ = sectionname; … … 536 532 ~XMLPortClassObjectContainer() 537 533 { 538 assert(this->loadexecutor_);539 delete this->loadexecutor_;540 if (this->saveexecutor_)541 delete this->saveexecutor_;542 534 } 543 535 … … 553 545 554 546 private: 555 ExecutorMember <T>*loadexecutor_;556 ExecutorMember <T>*saveexecutor_;547 ExecutorMemberPtr<T> loadexecutor_; 548 ExecutorMemberPtr<T> saveexecutor_; 557 549 }; 558 550
Note: See TracChangeset
for help on using the changeset viewer.