nouveau fichier : include/AttributeProfiles.hpp

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
This commit is contained in:
Git Merciol 2018-02-18 18:50:53 +01:00
parent 2933efb9d9
commit 9a76443603
6 changed files with 152 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#ifndef _OTB_TRISKELE_ATTRIBUTE_PROFILES_HPP
#define _OTB_TRISKELE_ATTRIBUTE_PROFILES_HPP
#include "Tree.hpp"
namespace otb {
namespace triskele {
template<typename PixelT>
class AttributeProfiles {
public:
inline AttributeProfiles (const Tree &tree);
inline ~AttributeProfiles ();
inline void updateTranscient ();
inline PixelT *getValues ();
protected:
const Tree &tree;
DimNodeId leafCount;
PixelT *values;
inline void free ();
inline void book (const DimImg &leafCount);
};
#include "AttributeProfiles.tpp"
} // triskele
} // otb
#endif // _OTB_TRISKELE_ATTRIBUTE_PROFILES_HPP

View File

@ -0,0 +1,51 @@
#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

View File

@ -0,0 +1,20 @@
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_HPP
#define _OTB_TRISKELE_AREA_ATTRIBUTES_HPP
#include "triskeleBase.hpp"
#include "CompAttribute.hpp"
namespace otb {
namespace triskele {
class AreaAttributes : public CompAttribute<double> {
public:
inline AreaAttributes (const Tree &tree);
inline ~AreaAttributes ();
};
#include "AreaAttributes.tpp"
} // triskele
} // otb
#endif // _OTB_TRISKELE_AREA_ATTRIBUTES_HPP

View File

@ -0,0 +1,13 @@
#ifndef _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
#define _OTB_TRISKELE_AREA_ATTRIBUTES_TPP
inline
AreaAttributes::AreaAttributes (const Tree &tree)
: CompAttribute<double> (tree) {
}
inline
AreaAttributes::~AreaAttributes () {
}
#endif // _OTB_TRISKELE_AREA_ATTRIBUTES_TPP

View File

@ -0,0 +1,22 @@
#ifndef _OTB_TRISKELE_WEIGHT_ATTRIBUTES_HPP
#define _OTB_TRISKELE_WEIGHT_ATTRIBUTES_HPP
#include "triskeleBase.hpp"
#include "CompAttribute.hpp"
namespace otb {
namespace triskele {
/** Attribute */
template<typename WeightT>
class WeightAttributes : public CompAttribute<WeightT> {
public:
inline WeightAttributes (const Tree &tree);
inline ~WeightAttributes ();
};
#include "WeightAttributes.tpp"
} // triskele
} // otb
#endif // _OTB_TRISKELE_WEIGHT_ATTRIBUTES_HPP

View File

@ -0,0 +1,15 @@
#ifndef _OTB_TRISKELE_WEIGHT_ATTRIBUTES_TPP
#define _OTB_TRISKELE_WEIGHT_ATTRIBUTES_TPP
template<typename WeightT>
inline
WeightAttributes<WeightT>::WeightAttributes (const Tree &tree)
: CompAttribute<WeightT> (tree) {
}
template<typename WeightT>
inline
WeightAttributes<WeightT>::~WeightAttributes () {
}
#endif // _OTB_TRISKELE_WEIGHT_ATTRIBUTES_TPP