Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
HuginBase::ImageVariable< Type > Class Template Reference

An ImageVariable stores a value that can be linked to other ImageVariables of the same type. More...

#include <ImageVariable.h>

Public Member Functions

 ImageVariable ()
 constructor More...
 
 ImageVariable (Type data)
 construct with a given initial data value More...
 
 ImageVariable (ImageVariable< Type > *link)
 Construct linked with something else. More...
 
 ImageVariable (const ImageVariable &source)
 Copy constructor. More...
 
 ~ImageVariable ()
 destructor More...
 
Type getData () const
 get the variable's value More...
 
void setData (const Type data)
 Set the variable groups' value. More...
 
void linkWith (ImageVariable< Type > *link)
 Create a link. More...
 
void removeLinks ()
 remove all links More...
 
bool isLinked () const
 Find out if there are other linked variables. More...
 
bool isLinkedWith (const ImageVariable< Type > *otherVariable) const
 Find out if this variable is linked to a given variable. More...
 

Protected Attributes

std::shared_ptr< Type > m_ptr
 

Detailed Description

template<class Type>
class HuginBase::ImageVariable< Type >

An ImageVariable stores a value that can be linked to other ImageVariables of the same type.

When you link ImageVariables, setting one using setData sets all the other linked ImageVariables. Then when reading the ImageVariables data with getData you get the last value set on any of the linked ImageVariables.

Template Parameters
TypeThe type of the data value to store with this variable. It is the return type for getData and the parameter type for setData.
Todo:
These will probably be copied when creating the Undo/redo data, but their pointers will remain the same. Therefore when copying a SrcPanoImg, we should offset all the pointers by the difference between the old and new SrcPanoImg, so the links are relatively the same.

Definition at line 48 of file ImageVariable.h.

Constructor & Destructor Documentation

template<class Type >
HuginBase::ImageVariable< Type >::ImageVariable ( )

constructor

Definition at line 140 of file ImageVariable.h.

template<class Type >
HuginBase::ImageVariable< Type >::ImageVariable ( Type  data)
explicit

construct with a given initial data value

Definition at line 145 of file ImageVariable.h.

template<class Type >
HuginBase::ImageVariable< Type >::ImageVariable ( ImageVariable< Type > *  link)
explicit

Construct linked with something else.

Sets the data from the linked item. Behaves like linkWith.

See Also
linkWith
Parameters
linkImageVariable which to link with. It provides the data for the newly constructed variable.

Definition at line 150 of file ImageVariable.h.

template<class Type >
HuginBase::ImageVariable< Type >::ImageVariable ( const ImageVariable< Type > &  source)

Copy constructor.

Generally copied for a getSrcImage call, so make the copy independant from the other image variables.

Definition at line 155 of file ImageVariable.h.

template<class Type >
HuginBase::ImageVariable< Type >::~ImageVariable ( )

destructor

Definition at line 162 of file ImageVariable.h.

Member Function Documentation

template<class Type >
Type HuginBase::ImageVariable< Type >::getData ( ) const
template<class Type >
bool HuginBase::ImageVariable< Type >::isLinked ( ) const

Find out if there are other linked variables.

Returns
true if there are any other variables linked with this one, false otherwise.

Definition at line 203 of file ImageVariable.h.

template<class Type >
bool HuginBase::ImageVariable< Type >::isLinkedWith ( const ImageVariable< Type > *  otherVariable) const

Find out if this variable is linked to a given variable.

Find if this variable has been linked (either directly or indirectly) with the variable pointed to by otherVariable.

Parameters
otherVariablethe variable to check linkage with.
Returns
true if this variable is linked with otherVariable, false otherwise.

Definition at line 209 of file ImageVariable.h.

References HuginBase::ImageVariable< Type >::m_ptr.

template<class Type >
void HuginBase::ImageVariable< Type >::linkWith ( ImageVariable< Type > *  link)

Create a link.

After making a link to another variable, this variable, and any variables we link link to, will now have the passed in variable's data. Calling setData(data) on either variable, or any variable previously linked with either variable, sets the return value for both variable's getData() function, and the getData function of variables previously linked with either variable. (i.e. Links are bidirectional and accumlative)

Parameters
linka pointer to the variable to link with.

Definition at line 181 of file ImageVariable.h.

References DEBUG_INFO, and HuginBase::ImageVariable< Type >::m_ptr.

template<class Type >
void HuginBase::ImageVariable< Type >::removeLinks ( )

remove all links

After calling this, setData will only change the value of this ImageVariable.

Definition at line 197 of file ImageVariable.h.

template<class Type >
void HuginBase::ImageVariable< Type >::setData ( const Type  data)

Set the variable groups' value.

Calling this sets the value returned by getData for this ImageVariable and any ImageVariables linked to this one.

Parameters
datathe data to be set for this group.

Definition at line 175 of file ImageVariable.h.

References data.

Referenced by HuginBase::PTOVariableConverterSingle< code1, code2, code3, T >::setValueFromVariable(), and HuginBase::PTOVariableConverterFDiff2D< code_x1, code_y1, code_x2, code_y2 >::setValueFromVariable().

Member Data Documentation

template<class Type>
std::shared_ptr<Type> HuginBase::ImageVariable< Type >::m_ptr
protected

The documentation for this class was generated from the following file: