Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

abstractproperty.h 7.3 KB
Newer Older
1
2
// ================================================================================================
// 
schultezub's avatar
schultezub committed
3
// This file is part of the CAMPVis Software Framework.
4
5
// 
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
schultezub's avatar
schultezub committed
6
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
7
//      Chair for Computer Aided Medical Procedures
8
9
//      Technische Universität München
//      Boltzmannstr. 3, 85748 Garching b. München, Germany
schultezub's avatar
schultezub committed
10
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
// 
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
// 
// ================================================================================================

schultezub's avatar
schultezub committed
30
31
32
#ifndef ABSTRACTPROPERTY_H__
#define ABSTRACTPROPERTY_H__

schultezub's avatar
schultezub committed
33
#include "sigslot/sigslot.h"
34
35
#include <tbb/atomic.h>
#include <tbb/spin_mutex.h>
schultezub's avatar
schultezub committed
36
#include "tgt/logmanager.h"
37
#include "core/pipeline/abstractprocessor.h"
schultezub's avatar
schultezub committed
38

39
#include <set>
schultezub's avatar
schultezub committed
40
41
#include <string>

schultezub's avatar
schultezub committed
42
namespace campvis {
schultezub's avatar
schultezub committed
43
    /**
schultezub's avatar
schultezub committed
44
     * Abstract base class for CAMPVis Property.
schultezub's avatar
schultezub committed
45
46
     * 
     * \todo    Add PropertyWidgets, add clone()?
47
     *          Think about a reasonable locking mechanism and implement that
schultezub's avatar
schultezub committed
48
     */
49
    class AbstractProperty : public sigslot::has_slots<> {
schultezub's avatar
schultezub committed
50
51
52
53
54
    public:
        /**
         * Creates a new AbstractProperty
         * \param name      Property name (unchangable!)
         * \param title     Property title (e.g. used for GUI)
55
         * \param invalidationLevel  Invalidation level that this property triggers
schultezub's avatar
schultezub committed
56
         */
57
        AbstractProperty(const std::string& name, const std::string& title, int invalidationLevel = AbstractProcessor::INVALID_RESULT);
schultezub's avatar
schultezub committed
58
59
60
61
62
63
64

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


schultezub's avatar
schultezub committed
65
66
67
68
69
70
71
72
73
74
75
76
        /**
         * Initializes the property.
         * Everything that requires a valid OpenGL context or is otherwise expensive gets in here.
         */
        virtual void init();
        
        /**
         * Deinitializes this property.
         * Everything that requires a valid OpenGL context gets in here instead into the dtor.
         */
        virtual void deinit();

schultezub's avatar
schultezub committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
        /**
         * Returns the property name.
         * \return  _name
         */
        const std::string& getName();

        /**
         * Returns the property title (e.g. used for GUI).
         * \return  _title
         */
        const std::string& getTitle();

        /**
         * Returns the invalidation level that this property triggers.
         * \return  _invalidationLevel
         */
93
        int getInvalidationLevel() const;
schultezub's avatar
schultezub committed
94
95
96
97
98

        /**
         * Sets the invalidation level that this property triggers.
         * \param il    New invalidation level that this property triggers.
         */
99
        void setInvalidationLevel(AbstractProcessor::InvalidationLevel il);
schultezub's avatar
schultezub committed
100

101
102
103
104
105
106
107
108
109
110
111
        /**
         * Returns whether this proberty shall be visible in the GUI.
         * \return  _isVisible
         */
        bool isVisible() const;

        /**
         * Sets whether this property shall be visible in the GUI.
         * \param isVisible new visibility flag
         */
        void setVisible(bool isVisible);
schultezub's avatar
schultezub committed
112

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
        /**
         * Adds the given property \a prop to the set of shared properties.
         * All shared properties will be changed when this property changes.
         * Overload in subclasses to make sure that shared properties are of the same type.
         * \note        Make sure not to build circular sharing or you will encounter endless loops!
         * \param prop  Property to add.
         */
        virtual void addSharedProperty(AbstractProperty* prop);

        /**
         * Removes the given property \a prop from the set of shared properties.
         * \param prop  Property to remove.
         */
        void removeSharedProperty(AbstractProperty* prop);

        /**
         * Returns the list of shared properties, which will be changed when this property changes.
         * \note    Property sharing only works in one direction, i.e. shared properties act as child properties.
         *          Make sure not to build circular sharing structures or you will encounter endless loops.
         * \return  _sharedProperties
         */
        const std::set<AbstractProperty*>& getSharedProperties() const;


schultezub's avatar
schultezub committed
137
138
139
140
141
142
143
144
145
146
147
148
149
        /**
         * Locks the property and marks it as "in use". Overwrite if necessary.
         * \sa  AbstractProperty::unlock
         */
        virtual void lock();

        /**
         * Unlocks the property and marks it as "not in use". Overwrite if necessary.
         * \sa  AbstractProperty::lock
         */
        virtual void unlock();


schultezub's avatar
schultezub committed
150
151
152
        /// Signal emitted, when the property changes.
        sigslot::signal1<const AbstractProperty*> s_changed;

153
154
155
        /// Signal emitted, when the visibility of this property changed
        sigslot::signal1<const AbstractProperty*> s_visibilityChanged;

schultezub's avatar
schultezub committed
156
    protected:
157
158

        void onChanged(const AbstractProperty* prop);
schultezub's avatar
schultezub committed
159
        
schultezub's avatar
schultezub committed
160
161
162
        // DO NOT REMOVE THE CONSTNESS OF _name. PropertyCollection relies on it!
        const std::string _name;                ///< Property name (unchangable on purpose!)
        std::string _title;                     ///< Property title (e.g. used for GUI)
163
        int _invalidationLevel;                 ///< Invalidation level that this property triggers
164
        tbb::atomic<bool> _isVisible;           ///< Flag whether this property shall be visible in the GUI
schultezub's avatar
schultezub committed
165

166
        tbb::atomic<int> _inUse;                ///< flag whether property is currently in use and values are written to back buffer
schultezub's avatar
schultezub committed
167
168
        tbb::spin_mutex _localMutex;            ///< Mutex used when altering local members

169
170
171
172
173
174
175
        /**
         * List of shared properties that will be changed when this property changes.
         * \note    Property sharing only works in one direction, i.e. shared properties act as child properties.
         *          Make sure not to build circular sharing structures or you will encounter endless loops.
         */
        std::set<AbstractProperty*> _sharedProperties;

schultezub's avatar
schultezub committed
176
177
178
179
180
181
        static const std::string loggerCat_;
    };

}

#endif // ABSTRACTPROPERTY_H__