00001
00002
00003 #if defined(_MSC_VER)
00004
00005 # pragma warning(disable:4786)
00006 #endif
00007 #include <cassert>
00008
00009 #include "OsiRowCut.hpp"
00010 #include "SbbCountRowCut.hpp"
00011 #include "SbbNode.hpp"
00012
00013 SbbCountRowCut::SbbCountRowCut ()
00014 :
00015 OsiRowCut(),
00016 owner_(NULL),
00017 ownerCut_(-1),
00018 numberPointingToThis_(0),
00019 whichCutGenerator_(-1)
00020 {
00021 #ifdef CHECK_CUT_COUNTS
00022 printf("SbbCountRowCut default constructor %x\n",this);
00023 #endif
00024 }
00025
00026
00027 SbbCountRowCut::SbbCountRowCut (const OsiRowCut & rhs)
00028 : OsiRowCut(rhs),
00029 owner_(NULL),
00030 ownerCut_(-1),
00031 numberPointingToThis_(0),
00032 whichCutGenerator_(-1)
00033 {
00034 #ifdef CHECK_CUT_COUNTS
00035 printf("SbbCountRowCut constructor %x from RowCut\n",this);
00036 #endif
00037 }
00038
00039 SbbCountRowCut::SbbCountRowCut (const OsiRowCut & rhs,
00040 SbbNodeInfo * info, int whichOne,
00041 int whichGenerator)
00042 : OsiRowCut(rhs),
00043 owner_(info),
00044 ownerCut_(whichOne),
00045 numberPointingToThis_(0),
00046 whichCutGenerator_(whichGenerator)
00047 {
00048 #ifdef CHECK_CUT_COUNTS
00049 printf("SbbCountRowCut constructor %x from RowCut and info\n",this);
00050 #endif
00051 }
00052 SbbCountRowCut::~SbbCountRowCut()
00053 {
00054 #ifdef CHECK_CUT_COUNTS
00055 printf("SbbCountRowCut destructor %x - references %d\n",this,
00056 numberPointingToThis_);
00057 #endif
00058
00059 owner_->deleteCut(ownerCut_);
00060 }
00061
00062 void
00063 SbbCountRowCut::increment(int change)
00064 {
00065 numberPointingToThis_+=change;
00066 }
00067
00068
00069 int
00070 SbbCountRowCut::decrement(int change)
00071 {
00072 assert(numberPointingToThis_>=change);
00073 numberPointingToThis_-=change;
00074 return numberPointingToThis_;
00075 }
00076
00077 void
00078 SbbCountRowCut::setInfo(SbbNodeInfo * info, int whichOne)
00079 {
00080 owner_=info;
00081 ownerCut_=whichOne;
00082 }
00083