nouveau fichier : include/AttributeProfiles.tpp nouveau fichier : include/Attributes/AreaAttributes.hpp nouveau fichier : include/Attributes/AreaAttributes.tpp nouveau fichier : include/Attributes/WeightAttributes.hpp nouveau fichier : include/Attributes/WeightAttributes.tpp
52 lines
1.0 KiB
C++
52 lines
1.0 KiB
C++
#ifndef _OTB_TRISKELE_ATTRIBUTE_PROFILES_TPP
|
|
#define _OTB_TRISKELE_ATTRIBUTE_PROFILES_TPP
|
|
|
|
template<typename PixelT>
|
|
inline
|
|
AttributeProfiles<PixelT>::AttributeProfiles (const Tree &tree)
|
|
: tree (tree),
|
|
leafCount (0),
|
|
values (nullptr) {
|
|
updateTranscient ();
|
|
}
|
|
|
|
template<typename PixelT>
|
|
inline
|
|
AttributeProfiles<PixelT>::~AttributeProfiles () {
|
|
free ();
|
|
}
|
|
|
|
template<typename PixelT>
|
|
inline void
|
|
AttributeProfiles<PixelT>::updateTranscient () {
|
|
book (tree.getLeafCount ());
|
|
}
|
|
|
|
template<typename PixelT>
|
|
inline PixelT *
|
|
AttributeProfiles<PixelT>::getValues () {
|
|
return values;
|
|
}
|
|
|
|
template<typename PixelT>
|
|
inline void
|
|
AttributeProfiles<PixelT>::free () {
|
|
if (values)
|
|
delete[] values;
|
|
values = nullptr;
|
|
}
|
|
|
|
template<typename PixelT>
|
|
inline void
|
|
AttributeProfiles<PixelT>::book (const DimImg &leafCount) {
|
|
if (this->leafCount == leafCount)
|
|
return;
|
|
free ();
|
|
if (!leafCount)
|
|
return;
|
|
this->leafCount = leafCount;
|
|
values = new PixelT[leafCount*2];
|
|
}
|
|
|
|
#endif // _OTB_TRISKELE_ATTRIBUTE_PROFILES_TPP
|