From 71e7a59a7b99180ef420f604381a60de4477f8cb Mon Sep 17 00:00:00 2001 From: Ivo Hedtke Date: Fri, 8 Nov 2024 17:29:40 +0100 Subject: [PATCH] Add Var::getVar --- include/scippp/var.hpp | 21 ++++++++++++++++++++- source/var.cpp | 11 +++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/scippp/var.hpp b/include/scippp/var.hpp index 7a5675a5..9d783ac9 100644 --- a/include/scippp/var.hpp +++ b/include/scippp/var.hpp @@ -15,8 +15,27 @@ struct Solution; * @since 1.0.0 */ struct Var { - //! Pointer to the underlying %SCIP variable. + /** + * Pointer to the underlying %SCIP variable. + * @deprecated since 1.3.0: Use #getVar() instead + */ SCIP_Var* var { nullptr }; + + /** + * Pointer to the underlying %SCIP variable. + * @since 1.3.0 + * @return underlying %SCIP variable. + */ + [[nodiscard]] SCIP_Var* getVar(); + + /** + * Pointer to the underlying %SCIP variable. + * + * @since 1.3.0 + * @return underlying %SCIP variable. + */ + [[nodiscard]] const SCIP_Var* getVar() const; + /** * Get the assigned value in the solution. * @since 1.0.0 diff --git a/source/var.cpp b/source/var.cpp index 21298846..95eb40c6 100644 --- a/source/var.cpp +++ b/source/var.cpp @@ -1,11 +1,22 @@ #include "scippp/var.hpp" #include "scippp/solution.hpp" + #include #include namespace scippp { +SCIP_Var* Var::getVar() +{ + return var; +} + +const SCIP_Var* Var::getVar() const +{ + return var; +} + double Var::getSolVal(const Solution& sol) const { return SCIPgetSolVal(sol.scip, sol.sol, var);