36#ifndef STK_IMIXTUREMANAGER_H
37#define STK_IMIXTUREMANAGER_H
68template<
class Derived>
132 {this->
asDerived().getMissingValuesImpl(p_mixture, missing);}
138 { this->
asDerived().getParametersImpl(p_mixture, data);}
144 { this->
asDerived().setParametersImpl(p_mixture, data);}
164 {
return this->
asDerived().createMixtureImpl(modelName, idData, nbCluster);}
171template<
class Derived>
177#ifdef STK_MIXTURE_VERY_VERBOSE
178 stk_cout <<
_T(
"In IMixtureManager::getIdModel, fail to get idData = ") << idData <<
_T(
"\n");
182#ifdef STK_MIXTURE_VERY_VERBOSE
183 stk_cout <<
_T(
"In IMixtureManager::getIdModel, success to get idData = ") << idData <<
_T(
"\n");
184 stk_cout <<
_T(
"In IMixtureManager::getIdModel, modelName = ") << modelName <<
_T(
"\n");
190template<
class Derived>
195template<
class Derived>
198 typedef std::vector<IDataBridge*>::iterator DataIterator;
199 for (DataIterator it =
v_data_.begin() ; it !=
v_data_.end(); ++it)
206template<
class Derived>
210 if (!
p_handler_->getIdModelName( idData, modelName))
212#ifdef STK_MIXTURE_VERY_VERBOSE
213 stk_cout <<
_T(
"In IMixtureManager::getIdModelName, fail to get idData = ") << idData <<
_T(
"\n");
216#ifdef STK_MIXTURE_VERY_VERBOSE
217 stk_cout <<
_T(
"In IMixtureManager::getIdModeName, success to get idData = ") << idData <<
_T(
"\n");
218 stk_cout <<
_T(
"In IMixtureManager::getIdModel, modelName = ") << modelName <<
_T(
"\n");
229template<
class Derived>
233 if (!
p_handler_->getIdModelName( idData, modelName)) {
return 0;};
242template<
class Derived>
248template<
class Derived>
251 typedef std::vector<IDataBridge*>::iterator DataIterator;
252 for (DataIterator it =
v_data_.begin(); it !=
v_data_.end(); ++it)
253 {
if ((*it)->idData() == idData) {
delete (*it);
v_data_.erase(it);
break;}}
260template<
class Derived>
263 typedef std::vector<IDataBridge*>::const_iterator ConstDataIterator;
264 for (ConstDataIterator it =
v_data_.begin(); it !=
v_data_.end(); ++it)
265 {
if ((*it)->idData() == idData)
return (*it);}
273template<
class Derived>
In this file, we define the final class Array2D.
In this file we define the data wrapper class.
define the main interface for linking specific mixture model to the composer.
#define STKRUNTIME_ERROR_1ARG(Where, Arg, Error)
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Interface class wrapping a data set.
hidden::MixtureManagerTraits< CategoricalMixtureManager >::MissingIndexes MissingIndexes
void getMissingValues(IMixture *p_mixture, MissingValues &missing) const
get the missing values
Clust::Mixture getIdModel(String const &idData) const
Utility function allowing to find the idModel from the idData.
hidden::MixtureManagerTraits< CategoricalMixtureManager >::Type Type
hidden::MixtureManagerTraits< CategoricalMixtureManager >::DataHandler DataHandler
void registerDataBridge(IDataBridge *p_data)
register a data bridge to the IMixtureManager.
Data const & getData(String const &idData) const
get the wrapper for any kind of data set using its Id
IMixtureManager(DataHandler const *const p_handler)
Default constructor, need an instance of a DataHandler.
~IMixtureManager()
destructor
void setParameters(IMixture *p_mixture, ArrayXX const &data) const
set the parameters from an IMixture.
String getIdModelName(String const &idData) const
Utility function allowing to find the idModel name from the idData.
DataHandler const *const p_handler() const
IMixture * createMixture(String const &idData, int nbCluster)
create a mixture and initialize it.
void releaseDataBridge(String const &idData)
release a data bridge from v_data_.
IMixture * createMixture(String const &modelName, String const &idData, int nbCluster)
create a concrete mixture and initialize it.
hidden::MixtureManagerTraits< CategoricalMixtureManager >::MissingValues MissingValues
hidden::MixtureManagerTraits< CategoricalMixtureManager >::DataBridgeType DataBridgeType
hidden::MixtureManagerTraits< CategoricalMixtureManager >::Data Data
IDataBridge * getDataBridge(String const &idData) const
Utility lookup function allowing to find a DataBridge from its idData.
DataHandler const *const p_handler_
std::vector< IDataBridge * > v_data_
void getParameters(IMixture *p_mixture, ArrayXX &data) const
get the parameters from an IMixture.
Interface base class for all the mixture models that will be processed by the composer.
IRecursiveTemplate()
constructor.
Derived & asDerived()
static cast : return a reference of this with a cast to the derived class.
Array2D< Real > ArrayXX
Specialization of the Array2D class for Real values.
Mixture stringToMixture(String const &type)
Convert a String to a Mixture.
Mixture
list of the mixtures that can be used by the composer
std::basic_string< Char > String
STK fundamental type of a String.
The namespace STK is the main domain space of the Statistical ToolKit project.
Main class for the mixture managers traits policy.