Ignore:
Timestamp:
08/01/13 16:46:07 (11 years ago)
Author:
Marek Kurdej
Message:

Update: merged changes from trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0-beta1/include/Pacpus/PacpusTools/PeriodicWorker.h

    r89 r162  
    1515#define DEF_PACPUS_PERIODIC_WORKER_H
    1616
    17 // Includes, pacpus.
    1817#include <Pacpus/PacpusTools/AsyncWorkerBase.h>
     18#include <Pacpus/PacpusTools/PacpusToolsConfig.h>
    1919
    2020class QTimer;
     
    2222namespace pacpus
    2323{
    24   /** PeriodicWorker
    25    * @brief A simple base class for periodic worker.
    26    *
    27    * @example
    28    *    class MyWorker
    29    *      : public PeriodicWorkder
    30    *    {
    31    *      public:
    32    *        void doWork() { std::cout << "Hey, I'm working!" << std::endl; }
    33    *    };
    34    *
    35    *    // Do its work every second.
    36    *    MyWorker worker;
    37    *    worker.startWork(1000);
    38    */
    39   class PeriodicWorker
     24
     25/// @brief A simple base class for periodic worker.
     26///
     27/// @example
     28/// To use the PeriodicWorker, simply inherit from this class when creating your worker.
     29/// ~~~
     30/// class MyWorker
     31///     : public PeriodicWorkder
     32/// {
     33/// public:
     34///     void doWork() { std::cout << "Hey, I'm working!" << std::endl; }
     35/// };
     36///
     37/// // Do its work every second.
     38/// MyWorker worker;
     39/// worker.startWork(1000);
     40/// ~~~
     41class PACPUSTOOLS_API PeriodicWorker
    4042    : public AsyncWorkerBase
    4143  {
     
    4850      virtual ~PeriodicWorker();
    4951     
    50       /** Start the periodic worker.
    51        * @param msec Period in mseconds.
    52        */
     52    /// Start the periodic worker.
     53    /// @param msec Period in mseconds.
    5354      void startWork(int msec);
    5455     
    55       /** Stop the periodic worker, but do not delete it. */
     56    /// Stop the periodic worker, but do not delete it.
    5657      void stopWork();
    5758     
    58     public slots:
    59       /** Do the work.
    60        * This method need to be implemented in the subclasses, it will be called
    61        * each time the timer has reached its period.
    62        */
     59    public Q_SLOTS:
     60        /// Do the work.
     61        /// This method need to be implemented in the subclasses, it will be called
     62        /// each time the timer has reached its period.
    6363      virtual void doWork() = 0;
    6464     
     
    6666      QTimer* mHeartbeat;
    6767  };
    68 }
     68
     69} // namespace pacpus
    6970
    7071#endif // DEF_PACPUS_PERIODIC_WORKER_H
Note: See TracChangeset for help on using the changeset viewer.