Hugin trunk 0.1
Loading...
Searching...
No Matches
ImageVariable.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#ifndef _PANODATA_IMAGEVARIABLE_H
25#define _PANODATA_IMAGEVARIABLE_H
26#include <memory>
27
28
29namespace HuginBase
30{
31
47template <class Type>
49{
50public:
53
55 explicit ImageVariable(Type data);
56
66
73
76
78 Type getData() const;
79
87 void setData(const Type data);
88
102
108 void removeLinks();
109
115 bool isLinked() const;
116
128
129protected:
130 std::shared_ptr<Type> m_ptr;
131}; // ImageVariable class
132
134// Public member functions //
136
137// Constructors
138
139template <class Type>
141{
142}
143
144template <class Type>
145ImageVariable<Type>::ImageVariable(Type data) : m_ptr(new Type(data))
146{
147}
148
149template <class Type>
153
154template <class Type>
158
159// Destructor
160
161template <class Type>
165
166// Other public member functions
167
168template <class Type>
170{
171 return *m_ptr;
172}
173
174template <class Type>
175void ImageVariable<Type>::setData(const Type data)
176{
177 *m_ptr = data;
178}
179
180template <class Type>
182{
183 // We need to first check that we aren't linked already.
184 if (m_ptr == link->m_ptr)
185 {
186 DEBUG_INFO("Attempt to link already linked variables");
187 return;
188 }
189 else
190 {
191
192 m_ptr = link->m_ptr;
193 }
194}
195
196template <class Type>
198{
199 m_ptr.reset(new Type(*m_ptr));
200}
201
202template <class Type>
204{
205 return m_ptr.use_count() > 1;
206}
207
208template <class Type>
210{
211 // return true if we can find a link with the given item.
212 return m_ptr == otherVariable->m_ptr;
213}
214
215} // HuginBase namespace
216
217#endif // ndef _PANODATA_IMAGEVARIABLE_H
An ImageVariable stores a value that can be linked to other ImageVariables of the same type.
bool isLinkedWith(const ImageVariable< Type > *otherVariable) const
Find out if this variable is linked to a given variable.
Type getData() const
get the variable's value
void setData(const Type data)
Set the variable groups' value.
void linkWith(ImageVariable< Type > *link)
Create a link.
void removeLinks()
remove all links
bool isLinked() const
Find out if there are other linked variables.
std::shared_ptr< Type > m_ptr
#define DEBUG_INFO(msg)
Definition utils.h:69
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41