Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 22, 2010, 12:27:53 AM (14 years ago)
Author:
landauf
Message:

createExecutor() now returns a SharedPtr instead of a pointer. Adapted code that uses createExecutor() accordingly.

Location:
code/branches/consolecommands3/src/libraries/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/tools/Timer.cc

    r6417 r7200  
    5454        delaytimerset.insert(delaytimer);
    5555
    56         ExecutorStatic* delayexecutor = createExecutor(createFunctor(&executeDelayedCommand));
     56        const ExecutorStaticPtr& delayexecutor = createExecutor(createFunctor(&executeDelayedCommand));
    5757        delayexecutor->setDefaultValues(delaytimer, command);
    5858        delaytimer->setTimer(delay, false, delayexecutor);
     
    9797        @param exeuctor A executor of the function to call
    9898    */
    99     Timer::Timer(float interval, bool bLoop, Executor* executor, bool bKillAfterCall)
     99    Timer::Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall)
    100100    {
    101101        this->init();
     
    103103
    104104        this->setTimer(interval, bLoop, executor, bKillAfterCall);
    105     }
    106 
    107     /**
    108         @brief Deletes the executor.
    109     */
    110     Timer::~Timer()
    111     {
    112         this->deleteExecutor();
    113105    }
    114106
     
    138130        if (temp)
    139131            this->destroy();
    140     }
    141 
    142     /**
    143         @brief Deletes the executor.
    144     */
    145     void Timer::deleteExecutor()
    146     {
    147       if (this->executor_)
    148           delete this->executor_;
    149132    }
    150133
  • code/branches/consolecommands3/src/libraries/tools/Timer.h

    r6417 r7200  
    7878        public:
    7979            Timer();
    80             ~Timer();
    8180
    82             Timer(float interval, bool bLoop, Executor* executor, bool bKillAfterCall = false);
     81            Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false);
    8382
    8483            /**
     
    8988                @param executor A executor of the function to call
    9089            */
    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)
    9291            {
    93                 this->deleteExecutor();
    94 
    9592                this->setInterval(interval);
    9693                this->bLoop_ = bLoop;
     
    103100
    104101            void run();
    105             void deleteExecutor();
    106102
    107103            /** @brief Starts the Timer: Function-call after 'interval' seconds. */
     
    141137            void init();
    142138
    143             Executor* executor_;  //!< The executor of the function that should be called when the time expires
     139            ExecutorPtr executor_;  //!< The executor of the function that should be called when the time expires
    144140
    145             long long interval_;  //!< The time-interval in micro seconds
    146             bool bLoop_;          //!< If true, the function gets called every 'interval' seconds
    147             bool bActive_;        //!< If true, the Timer ticks and calls the function if the time's up
    148             bool bKillAfterCall_; //!< If true the timer gets deleted after it called the function
     141            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
    149145
    150             long long time_;      //!< Internal variable, counting the time till the next function-call
     146            long long time_;        //!< Internal variable, counting the time till the next function-call
    151147    };
    152148}
Note: See TracChangeset for help on using the changeset viewer.