Specify the sense of a constraint in CPLEX

I am writing a small wrapper around Gurobi and Cplex so that the models I write are solver independent.I’m very familiar with Gurobi but I’m very new to Cplex and I’m having trouble replicating certain api calls that I use very frequently. Specifically I’m having trouble figuring out how to pass the sense to the Cplex API: std::shared_ptr Model::addConstr(const std::vector<std::shared_ptr>& vars, const std::vector& coeffs, char sense, double rhs, const std::string& name) #ifdef GUROBI GRBLinExpr expr; std::vector grb_vars; for(auto var : vars) { grb_vars.push_back(*(var->getGRBVar())); } expr.addTerms(&coeffs[0], &grb_vars[0], (int) vars.size()); GRBConstr constraint = _grb_model->addConstr(expr, sense, rhs, name); std::shared_ptr grb_constr_shared = std::make_shared(constraint); return std::make_shared(grb_constr_shared); #elif defined CPLEX // do exactly the same process for cplex #endif } And I’m having trouble figuring out how to pass the objective value of a variable: std::shared_ptr Model::addVar(double lb, double ub, double obj, char var_type, std::string name) { #ifdef GUROBI GRBVar grb_var = _grb_model->addVar(lb, ub, obj, var_type, std::move(name)); std::shared_ptr grb_var_shared = std::make_shared(grb_var); return std::make_shared(grb_var_shared); #elif defined CPLEX // do the same process for CPLEX and return std::make_shared(cplex_var_shared); #endif }.

Source: Specify the sense of a constraint in CPLEX