Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0c9d77ca authored by hhakim's avatar hhakim
Browse files

Remove ConstraintGeneric::get_type definition (really messy for nothing) and...

Remove ConstraintGeneric::get_type definition (really messy for nothing) and set the function as pure virtual for simple implementations in subclasses.
parent 2db31be7
No related branches found
No related tags found
No related merge requests found
Pipeline #834056 skipped
......@@ -96,6 +96,7 @@ namespace Faust
FPP2 get_parameter() const {return m_parameter;};
virtual void set_default_parameter();
const char* get_type() const;
virtual void check_constraint_name()const;
virtual void project(Faust::MatDense<FPP,DEVICE> & mat)const;
virtual MatGeneric<FPP,DEVICE>* project_gen(MatDense<FPP,DEVICE> & mat)const;
......
......@@ -166,6 +166,13 @@ Faust::MatGeneric<FPP,DEVICE>* Faust::ConstraintFPP<FPP,DEVICE, FPP2>::project_g
}
}
template<typename FPP,FDevice DEVICE, typename FPP2>
const char* Faust::ConstraintFPP<FPP,DEVICE, FPP2>::get_type() const
{
return "FAUST_REAL";
}
template<typename FPP,FDevice DEVICE, typename FPP2>
void Faust::ConstraintFPP<FPP,DEVICE,FPP2>::Display() const
{
......
......@@ -101,8 +101,7 @@ namespace Faust
template<typename FPP,FDevice DEVICE, typename FPP2=double>
const char* get_type() const;
virtual const char* get_type() const=0;
const char* get_constraint_name()const;
const faust_constraint_name get_constraint_type() const;
template<typename FPP,FDevice DEVICE, typename FPP2=double>
......
......@@ -54,122 +54,6 @@ template<typename FPP,FDevice DEVICE,typename FPP2> class ConstraintFPP;
template<typename FPP,FDevice DEVICE> class ConstraintMat;
template<typename FPP,FDevice DEVICE,typename FPP2> class faust_ConstraintType;
template<typename FPP, FDevice DEVICE, typename FPP2>
const char* Faust::ConstraintGeneric::get_type() const
{
switch(m_constraintName)
{
case CONSTRAINT_NAME_SP:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSp)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSp)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSp)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_SPCOL:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSpcol)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSpcol)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSpcol)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_SPLIN:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSplin)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSplin)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSplin)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_NORMCOL:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeNormcol)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeNormcol)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeNormcol)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_SPLINCOL:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSplincol)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSplincol)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSplincol)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_CONST:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeConst)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeConst)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeConst)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_SP_POS:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSpPos)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSpPos)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSpPos)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_BLKDIAG:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeBlkdiag)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeBlkdiag)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeBlkdiag)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_SUPP:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSupp)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSupp)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeSupp)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_NORMLIN:
if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeNormlin)==typeid(Faust::ConstraintInt<FPP,DEVICE>))
return "INT";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeNormlin)==typeid(Faust::ConstraintFPP<FPP,DEVICE,FPP2>))
return "FAUST_REAL";
else if(typeid(typename ConstraintType<FPP,DEVICE,FPP2>::ConstraintTypeNormlin)==typeid(Faust::ConstraintMat<FPP,DEVICE>))
return "FAUST_MAT";
else{
handleError(m_className,"get_type : unknown type parameter");
}
case CONSTRAINT_NAME_TOEPLITZ:
case CONSTRAINT_NAME_CIRC:
case CONSTRAINT_NAME_HANKEL:
return "FAUST_MAT";
default:
handleError(m_className,"get_type : unknown constraint type ");
}
}
template<typename FPP,FDevice DEVICE, typename FPP2>
bool Faust::ConstraintGeneric::is_constraint_parameter_int()const
{
......
......@@ -94,6 +94,7 @@ namespace Faust
virtual void set_default_parameter();
virtual void check_constraint_name()const;
const char* get_type() const;
virtual void project(Faust::MatDense<FPP,DEVICE> & mat)const;
virtual MatGeneric<FPP,DEVICE>* project_gen(Faust::MatDense<FPP,DEVICE> & mat) const;
virtual void Display() const;
......
......@@ -209,4 +209,9 @@ void Faust::ConstraintInt<FPP,DEVICE>::Display() const
std::cout<<" parameter :"<< get_parameter() << std::endl;
}
template<typename FPP,FDevice DEVICE>
const char* Faust::ConstraintInt<FPP,DEVICE>::get_type() const
{
return "FAUST_INT";
}
......@@ -91,6 +91,7 @@ namespace Faust
virtual void check_constraint_name()const;
virtual void project(Faust::MatDense<FPP,DEVICE> & mat)const;
virtual MatGeneric<FPP,DEVICE>* project_gen(Faust::MatDense<FPP,DEVICE> & mat)const;
const char* get_type() const;
virtual void Display() const;
~ConstraintMat(){};
......
......@@ -204,7 +204,11 @@ void Faust::ConstraintMat<FPP,DEVICE>::Display() const
get_parameter().Display();
}
template<typename FPP,FDevice DEVICE>
const char* Faust::ConstraintMat<FPP,DEVICE>::get_type() const
{
return "FAUST_MAT";
}
#endif
......@@ -186,7 +186,7 @@ void Faust::ParamsPalm<FPP,DEVICE,FPP2>::Display() const
//std::string type_cons;
//type_cons.resize(0);
//type_cons=getConstraintType((*cons[jl][L]).getConstraintType());
std::cout<<"type_cont : "<<cons[L]->template get_type<FPP,DEVICE,FPP2>()<<" ";
std::cout<<"type_cont : "<<cons[L]->get_type()<<" ";
std::cout<<(*cons[L]).get_constraint_name();
std::cout<<" nb_row :"<<(*cons[L]).get_rows();
std::cout<<" nb_col :"<<(*cons[L]).get_cols();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment