}
CutInfo::CutInfo(CutInfoKlass kl, int eid, int o)
- : d_klass(kl)
- , d_execOrd(eid)
- , d_poolOrd(o)
- , d_cutType(kind::UNDEFINED_KIND)
- , d_cutRhs()
- , d_cutVec()
- , d_mAtCreation(-1)
- , d_rowId(-1)
- , d_exactPrecision(NULL)
- , d_explanation(NULL)
+ : d_klass(kl),
+ d_execOrd(eid),
+ d_poolOrd(o),
+ d_cutType(kind::UNDEFINED_KIND),
+ d_cutRhs(),
+ d_cutVec(),
+ d_mAtCreation(-1),
+ d_rowId(-1),
+ d_exactPrecision(nullptr),
+ d_explanation(nullptr)
{}
CutInfo::~CutInfo(){
- if(d_exactPrecision == NULL){ delete d_exactPrecision; }
- if(d_explanation == NULL){ delete d_explanation; }
}
int CutInfo::getId() const {
d_cutRhs = r;
}
-bool CutInfo::reconstructed() const{
- return d_exactPrecision != NULL;
-}
+bool CutInfo::reconstructed() const { return d_exactPrecision != nullptr; }
CutInfoKlass CutInfo::getKlass() const{
return d_klass;
}
/* Returns true if the cut has an explanation. */
-bool CutInfo::proven() const{
- return d_explanation != NULL;
-}
+bool CutInfo::proven() const { return d_explanation != nullptr; }
bool CutInfo::operator<(const CutInfo& o) const{
return d_execOrd < o.d_execOrd;
void CutInfo::setReconstruction(const DenseVector& ep){
Assert(!reconstructed());
- d_exactPrecision = new DenseVector(ep);
+ d_exactPrecision.reset(new DenseVector(ep));
}
void CutInfo::setExplanation(const ConstraintCPVec& ex){
Assert(reconstructed());
- if(d_explanation == NULL){
- d_explanation = new ConstraintCPVec(ex);
- }else{
+ if (d_explanation == nullptr)
+ {
+ d_explanation.reset(new ConstraintCPVec(ex));
+ }
+ else
+ {
*d_explanation = ex;
}
}
void CutInfo::swapExplanation(ConstraintCPVec& ex){
Assert(reconstructed());
Assert(!proven());
- if(d_explanation == NULL){
- d_explanation = new ConstraintCPVec();
+ if (d_explanation == nullptr)
+ {
+ d_explanation.reset(new ConstraintCPVec());
}
d_explanation->swap(ex);
}
void CutInfo::clearReconstruction(){
if(proven()){
- delete d_explanation;
- d_explanation = NULL;
+ d_explanation = nullptr;
}
if(reconstructed()){
- delete d_exactPrecision;
- d_exactPrecision = NULL;
+ d_exactPrecision = nullptr;
}
Assert(!reconstructed());
* the cut is stored in exact precision in d_exactPrecision.
* If the cut has not yet been proven, this is null.
*/
- DenseVector* d_exactPrecision;
+ std::unique_ptr<DenseVector> d_exactPrecision;
- ConstraintCPVec* d_explanation;
+ std::unique_ptr<ConstraintCPVec> d_explanation;
-public:
+ public:
CutInfo(CutInfoKlass kl, int cutid, int ordinal);
virtual ~CutInfo();