18 #ifndef __itkFunctorHashTable_h 19 #define __itkFunctorHashTable_h 34 template <
class TFunctor,
class TParameters,
class TFunctorValue =
double,
class THash=utl_hash<TParameters> >
59 typedef utl_unordered_map<ParametersType,FunctorValueType, HashType >
HashTableType;
65 itkGetMacro(Hash, HashTablePointer);
69 return m_Hash->size();
74 return m_Hash->size()>0;
79 HashTableIterator iter = m_Hash->find(param);
80 if ( iter!= m_Hash->end() )
90 FunctorValueType val = m_Functor(param);
91 m_Hash->insert(std::pair<ParametersType, FunctorValueType> (param, val));
99 m_Hash(new HashTableType())
106 Superclass::PrintSelf(os, indent);
111 typename LightObject::Pointer loPtr = Superclass::InternalClone();
112 typename Self::Pointer rval =
dynamic_cast<Self *
>(loPtr.GetPointer());
115 itkExceptionMacro(<<
"downcast to type " << this->GetNameOfClass()<<
" failed.");
117 rval->m_Hash = m_Hash;
128 void operator=(
const Self&);
SmartPointer< const Self > ConstPointer
std::vector< double > STDVectorType
FunctorTableBase< TFunctor, TParameters, TFunctorValue > Superclass
use FunctorHashTable to accelerate evaluation of functions.
SmartPointer< Self > Pointer
Superclass::STDVectorPointer STDVectorPointer
Superclass::ParametersType ParametersType
Superclass::STDVectorType STDVectorType
Superclass::FunctorType FunctorType
utl_unordered_map< ParametersType, FunctorValueType, HashType > HashTableType
unsigned long GetTableSize() const
TFunctorValue FunctorValueType
LightObject::Pointer InternalClone() const ITK_OVERRIDE
FunctorValueType GetFunctionValue(const ParametersType ¶m)
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
HashTableType::iterator HashTableIterator
utl_shared_ptr< HashTableType > HashTablePointer
Superclass::FunctorValueType FunctorValueType
virtual ~FunctorHashTable()
utl_shared_ptr< STDVectorType > STDVectorPointer
TParameters ParametersType
use FunctorTableBase to accelerate evaluation of functions.
bool IsTableBuilt() const