[GIT] ppl/ppl(master): Simplified C interface to Artificial_Parameter.

Module: ppl/ppl Branch: master Commit: e0bd48ed51aee3986fe5c9dc43a903f07bea3be7 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e0bd48ed51aee...
Author: Enea Zaffanella zaffanella@cs.unipr.it Date: Thu Feb 18 22:15:57 2010 +0100
Simplified C interface to Artificial_Parameter.
---
interfaces/C/ppl_c_header.h | 12 ++++++------ interfaces/C/ppl_c_implementation_common.cc | 27 ++++++++++++--------------- 2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/interfaces/C/ppl_c_header.h b/interfaces/C/ppl_c_header.h index 7ba3a38..f026e8f 100644 --- a/interfaces/C/ppl_c_header.h +++ b/interfaces/C/ppl_c_header.h @@ -3034,26 +3034,26 @@ PPL_PROTO((ppl_const_PIP_Decision_Node_t pip_dec, int ppl_Artificial_Parameter_get_Linear_Expression PPL_PROTO((ppl_const_Artificial_Parameter_t ap, - ppl_const_Linear_Expression_t* le)); + ppl_Linear_Expression_t le));
/*! \relates ppl_Artificial_Parameter_tag \brief - Copies into \p coef the coefficient of variable \p var in + Copies into \p n the coefficient of variable \p var in the artificial parameter \p ap. */ int -ppl_Artificial_Parameter_get_coefficient +ppl_Artificial_Parameter_coefficient PPL_PROTO((ppl_const_Artificial_Parameter_t ap, ppl_dimension_type var, - ppl_const_Coefficient_t* coef)); + ppl_Coefficient_t n));
/*! \relates ppl_Artificial_Parameter_tag \brief - Copies into \p coef the inhomogeneous term of the artificial + Copies into \p n the inhomogeneous term of the artificial parameter \p ap. */ int ppl_Artificial_Parameter_get_inhomogeneous_term PPL_PROTO((ppl_const_Artificial_Parameter_t ap, - ppl_const_Coefficient_t* coef)); + ppl_Coefficient_t n));
/*! \relates ppl_Artificial_Parameter_tag \brief Writes to \p coeff the denominator in artificial parameter \p ap. diff --git a/interfaces/C/ppl_c_implementation_common.cc b/interfaces/C/ppl_c_implementation_common.cc index 6a03cc4..f4d0859 100644 --- a/interfaces/C/ppl_c_implementation_common.cc +++ b/interfaces/C/ppl_c_implementation_common.cc @@ -2472,34 +2472,31 @@ CATCH_ALL int ppl_Artificial_Parameter_get_Linear_Expression (ppl_const_Artificial_Parameter_t ap, - ppl_const_Linear_Expression_t* le) try { + ppl_Linear_Expression_t le) try { const Artificial_Parameter& sap = *to_const(ap); - const Linear_Expression& lle = static_cast<const Linear_Expression&>(sap); - *le = to_const(&lle); + Linear_Expression& lle = *to_nonconst(le); + lle = sap; return 0; } CATCH_ALL
int -ppl_Artificial_Parameter_get_coefficient(ppl_const_Artificial_Parameter_t ap, - ppl_dimension_type var, - ppl_const_Coefficient_t* coef) try { +ppl_Artificial_Parameter_coefficient(ppl_const_Artificial_Parameter_t ap, + ppl_dimension_type var, + ppl_Coefficient_t n) try { const Artificial_Parameter& sap = *to_const(ap); - const Linear_Expression& lle = static_cast<const Linear_Expression&>(sap); - const Coefficient& ncoef = lle.coefficient(Variable(var)); - *coef = to_const(&ncoef); + Coefficient& nn = *to_nonconst(n); + nn = sap.coefficient(Variable(var)); return 0; } CATCH_ALL
int -ppl_Artificial_Parameter_get_inhomogeneous_term -(ppl_const_Artificial_Parameter_t ap, - ppl_const_Coefficient_t* coef) try { +ppl_Artificial_Parameter_inhomogeneous_term +(ppl_const_Artificial_Parameter_t ap, ppl_Coefficient_t n) try { const Artificial_Parameter& sap = *to_const(ap); - const Linear_Expression& lle = static_cast<const Linear_Expression&>(sap); - const Coefficient& icoef = lle.inhomogeneous_term(); - *coef = to_const(&icoef); + Coefficient& nn = *to_nonconst(n); + nn = sap.inhomogeneous_term(); return 0; } CATCH_ALL
participants (1)
-
Enea Zaffanella