Changeset 7284 for code/trunk/src/libraries/tools
- Timestamp:
- Aug 31, 2010, 3:37:40 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/tools/Timer.cc
r6417 r7284 33 33 #include "util/Clock.h" 34 34 #include "core/CoreIncludes.h" 35 #include "core/ ConsoleCommand.h"36 #include "core/ CommandExecutor.h"37 #include "core/ Functor.h"35 #include "core/command/ConsoleCommand.h" 36 #include "core/command/CommandExecutor.h" 37 #include "core/command/Functor.h" 38 38 39 39 namespace orxonox 40 40 { 41 SetConsoleCommand ShortcutExtern(delay);42 SetConsoleCommand ShortcutExtern(killdelays);41 SetConsoleCommand("delay", &delay).argumentCompleter(1, autocompletion::command()); 42 SetConsoleCommand("killdelays", &killdelays); 43 43 44 44 static std::set<Timer*> delaytimerset; … … 54 54 delaytimerset.insert(delaytimer); 55 55 56 ExecutorStatic*delayexecutor = createExecutor(createFunctor(&executeDelayedCommand));56 const ExecutorStaticPtr& delayexecutor = createExecutor(createFunctor(&executeDelayedCommand)); 57 57 delayexecutor->setDefaultValues(delaytimer, command); 58 58 delaytimer->setTimer(delay, false, delayexecutor); … … 97 97 @param exeuctor A executor of the function to call 98 98 */ 99 Timer::Timer(float interval, bool bLoop, Executor*executor, bool bKillAfterCall)99 Timer::Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall) 100 100 { 101 101 this->init(); … … 103 103 104 104 this->setTimer(interval, bLoop, executor, bKillAfterCall); 105 }106 107 /**108 @brief Deletes the executor.109 */110 Timer::~Timer()111 {112 this->deleteExecutor();113 105 } 114 106 … … 138 130 if (temp) 139 131 this->destroy(); 140 }141 142 /**143 @brief Deletes the executor.144 */145 void Timer::deleteExecutor()146 {147 if (this->executor_)148 delete this->executor_;149 132 } 150 133 -
code/trunk/src/libraries/tools/Timer.h
r6417 r7284 44 44 45 45 source.cc: 46 include "core/Executor.h"46 #include "core/command/Executor.h" 47 47 48 48 ClassName::ClassName() … … 63 63 #include "tools/ToolsPrereqs.h" 64 64 65 #include "core/Executor.h"66 65 #include "core/OrxonoxClass.h" 66 #include "core/command/Executor.h" 67 67 #include "tools/interfaces/TimeFactorListener.h" 68 68 … … 78 78 public: 79 79 Timer(); 80 ~Timer();81 80 82 Timer(float interval, bool bLoop, Executor*executor, bool bKillAfterCall = false);81 Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false); 83 82 84 83 /** … … 89 88 @param executor A executor of the function to call 90 89 */ 91 void setTimer(float interval, bool bLoop, Executor*executor, bool bKillAfterCall = false)90 void setTimer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false) 92 91 { 93 this->deleteExecutor();94 95 92 this->setInterval(interval); 96 93 this->bLoop_ = bLoop; … … 103 100 104 101 void run(); 105 void deleteExecutor();106 102 107 103 /** @brief Starts the Timer: Function-call after 'interval' seconds. */ … … 141 137 void init(); 142 138 143 Executor *executor_; //!< The executor of the function that should be called when the time expires139 ExecutorPtr executor_; //!< The executor of the function that should be called when the time expires 144 140 145 long long interval_; //!< The time-interval in micro seconds146 bool bLoop_; //!< If true, the function gets called every 'interval' seconds147 bool bActive_; //!< If true, the Timer ticks and calls the function if the time's up148 bool bKillAfterCall_; //!< If true the timer gets deleted after it called the function141 long long interval_; //!< The time-interval in micro seconds 142 bool bLoop_; //!< If true, the function gets called every 'interval' seconds 143 bool bActive_; //!< If true, the Timer ticks and calls the function if the time's up 144 bool bKillAfterCall_; //!< If true the timer gets deleted after it called the function 149 145 150 long long time_; //!< Internal variable, counting the time till the next function-call146 long long time_; //!< Internal variable, counting the time till the next function-call 151 147 }; 152 148 }
Note: See TracChangeset
for help on using the changeset viewer.