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/AsyncWorkerBase.h

    r89 r162  
    1616
    1717//#include <boost/noncopyable.hpp>
     18#include <Pacpus/PacpusTools/PacpusToolsConfig.h>
    1819#include <QObject>
    1920
    2021namespace pacpus
    2122{
    22   /**
    23    * @brief A simple base class for asynchronous workers able to partake in the
    24    * Qt slot / signal mechanism
    25    *
    26    * This class represents an asynchronous event-based worker able to receive and
    27    * send Qt signals to other workers or threads. The rationale is to be able to
    28    * define stateful objects that perform calculations asynchronously, triggered
    29    * by external user-defined messages.
    30    */
    31   class AsyncWorkerBase
     23
     24/// A simple base class for asynchronous workers able to partake in the
     25/// Qt slot / signal mechanism
     26///
     27/// This class represents an asynchronous event-based worker able to receive and
     28/// send Qt signals to other workers or threads. The rationale is to be able to
     29/// define stateful objects that perform calculations asynchronously, triggered
     30/// by external user-defined messages.
     31class PACPUSTOOLS_API AsyncWorkerBase
    3232    : public QObject
    3333    //, private boost::noncopyable
    34   {
     34{
    3535    Q_OBJECT
    36       Q_DISABLE_COPY(AsyncWorkerBase)
    37     public:
    38       /** Constructor. */
     36    Q_DISABLE_COPY(AsyncWorkerBase)
     37
     38public:
     39    /// Constructor.
    3940      AsyncWorkerBase();
    4041
    41       /** Destructor. */
    42       virtual ~AsyncWorkerBase();
     42    /// Destructor.
     43    virtual ~AsyncWorkerBase();
    4344
    44       /** Starts the worker by creating a new thread for it, and calling the setup() virtual method. */
    45       void start();
     45    /// Starts the worker by creating a new thread for it, and calling the setup() virtual method. */
     46    void start();
    4647
    47       /** Terminates the worker as soon as there are no more requests pending and its current processing
    48        *  is finished.
    49        *
    50        *        This method tries to end the worker gracefully. All pending signals sent before the stop() request will
    51        *        be honored.
    52        *        It is safe to call this method from any thread.
    53        *
    54        *  @param autoDelete if true, deletes the worker as soon as its event loop has finished processing.
    55        */
    56       void stop(bool autoDelete);
     48    /// Terminates the worker as soon as there are no more requests pending and its current processing
     49    /// is finished.
     50    ///
     51    /// This method tries to end the worker gracefully. All pending signals sent before the stop() request will
     52    /// be honored.
     53    /// It is safe to call this method from any thread.
     54    ///
     55    ///  @param autoDelete if true, deletes the worker as soon as its event loop has finished processing.
     56    void stop(bool autoDelete);
    5757
    58       /** Returns true if the worker is active. */
    59       bool isActive() const { return active_; }
     58    /// @returns @b true if the worker is active, @b false otherwise.
     59    bool isActive() const
     60    {
     61        return active_;
     62    }
    6063
    6164    Q_SIGNALS:
     
    7376       virtual void cleanup();
    7477
    75        /** Returns true if the worker is stopping. */
     78    /// Returns true if the worker is stopping.
    7679       bool isStopping() const { return stopping_; }
    7780
     
    8386
    8487    private:
    85       /*! \brief Ends the worker, asking the underlying thread to terminate
    86        *
    87        * This method signals the end of processing and requests the underlying thread to terminate. Actual termination
    88        * will occur as soon as all pending signals (including those that may come from other workers during the
    89        * finish request handling) have been processed.
    90        */
     88    /// Ends the worker, asking the underlying thread to terminate
     89    ///
     90    /// This method signals the end of processing and requests the underlying thread to terminate. Actual termination
     91    /// will occur as soon as all pending signals (including those that may come from other workers during the
     92    /// finish request handling) have been processed.
    9193      void finish();
    9294
     
    9597      bool stopping_;
    9698  };
     99
    97100} // namespace pacpus
    98101
Note: See TracChangeset for help on using the changeset viewer.