abstractprocessor.h 2.38 KB
Newer Older
schultezub's avatar
schultezub committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef PROCESSOR_H__
#define PROCESSOR_H__

#include "tgt/logmanager.h"
#include "core/datastructures/datacontainer.h"

namespace TUMVis {

    /**
     * Abstract base class for TUMVis Processors.
     * 
     * \sa AbstractPipeline
     */
    class AbstractProcessor {
    public:
16
17
18
19
20
21
        enum InvalidationLevel {
            VALID               = 0,
            INVALID_RESULT      = 1 << 0,
            INVALID_SHADER      = 1 << 1,
        };

schultezub's avatar
schultezub committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
        /**
         * Creates a AbstractProcessor.
         */
        AbstractProcessor();

        /**
         * Virtual Destructor
         **/
        virtual ~AbstractProcessor();


        /**
         * Execute this processor.
         **/
        virtual void process() = 0;

        /**
         * Adds the given DataHandle \a data, accessible by the key \name, to this DataContainer.
         * Already existing DataHandles with the same key will be removed from this DataContainer.
         *
         * \param   name    Key for accessing the DataHandle within this DataContainer
         * \param   data    DataHandle to add.
         **/
        virtual void addDataHandle(const std::string& name, const DataHandle* dh);

        /**
         * Returns the local DataContainer of this Processor.
         * \returns Processor::_data
         **/
        const DataContainer& getDataContainer() const;

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
        /**
         * Returns the invalidation level of this processor.
         * Remind, that this is internally handled as a integer bit-set, so make sure to test via logic or.
         * \return Integer representation of _invalidationLevel
         */
        int getInvalidationLevel() const;

        /**
         * Update the processor's invalidation level by \a il.
         * If \a il is VALID, the processor's invalidation level will be set to VALID.
         * If \a il is one of the INVALID_X state, the processor's corresponding flag will be set.
         * \param il    Invalidation level to set.
         */
        void setInvalidationLevel(InvalidationLevel il);

schultezub's avatar
schultezub committed
68
69
    protected:
        DataContainer _data;                    ///< DataContainer containing local working set of data for this Processor
70
        int _invalidationLevel;                 ///< Invalidation level of this processor
schultezub's avatar
schultezub committed
71
72
73
74
75
76
77

        static const std::string loggerCat_;
    };

}

#endif // PROCESSOR_H__