pipelineevaluator.h 1.55 KB
Newer Older
1
2
3
4
5
#ifndef PIPELINEEVALUATOR_H__
#define PIPELINEEVALUATOR_H__

#include "sigslot/sigslot.h"
#include "core/pipeline/abstractpipeline.h"
6
#include "core/tools/runnable.h"
7
8
9
10
11
#include "tbb/include/tbb/compat/condition_variable"

namespace TUMVis {

    /**
12
13
14
     * The PipelineEvaluator evaluates its pipeline in its own thread.
     * Evaluation is implemented using condidional wait - hence the pipeline is only evaluated when
     * \a pipeline emits the s_PipelineInvalidated signal.
15
     * 
16
     * \sa  Runnable
17
     */
18
    class PipelineEvaluator : public Runnable, public sigslot::has_slots<> {
19
    public:
20
21
22
23
        /**
         * Creates a new PipelineEvaluator for the given pipeline \a pipeline.
         * \param   pipeline    Pipeline to evaluate
         */
24
25
        PipelineEvaluator(AbstractPipeline* pipeline);

26
27
28
        /**
         * Destructor, stops and waits for the evaluation thread if it's still running.
         */
29
        virtual ~PipelineEvaluator();
30

31
32
33
34
35
36
37
38
39
40
41
42
        /// \see Runnable::stop
        void stop();
        
        /**
         * Performs the pipeline evaluation using conditional wait.
         * \sa Runnable::run
         */
        void run();

        /**
         * Slot for notifications when the pipeline was invalidated.
         */
43
44
45
        void OnPipelineInvalidated();

    protected:
46
47
        AbstractPipeline* _pipeline;                    ///< Pipeline to evaluate
        std::condition_variable _evaluationCondition;   ///< conditional wait condition
48
49
50
51
52
    };

}

#endif // PIPELINEEVALUATOR_H__