Merge
authorAlpar Juttner <alpar@cs.elte.hu>
Wed, 04 Mar 2009 13:43:05 +0000
changeset 589fc6c7aab4b8d
parent 588 89e29e22d479
parent 585 ba124394367a
child 594 d59dcc933e59
Merge
lemon/glpk.cc
lemon/glpk.h
test/lp_test.cc
test/mip_test.cc
     1.1 --- a/lemon/glpk.cc	Sun Mar 01 07:10:49 2009 +0000
     1.2 +++ b/lemon/glpk.cc	Wed Mar 04 13:43:05 2009 +0000
     1.3 @@ -522,6 +522,12 @@
     1.4      cols.clear();
     1.5    }
     1.6  
     1.7 +  void GlpkBase::freeEnv() {
     1.8 +    glp_free_env();
     1.9 +  }
    1.10 +
    1.11 +  GlpkBase::FreeEnvHelper GlpkBase::freeEnvHelper;
    1.12 +
    1.13    // GlpkLp members
    1.14  
    1.15    GlpkLp::GlpkLp()
     2.1 --- a/lemon/glpk.h	Sun Mar 01 07:10:49 2009 +0000
     2.2 +++ b/lemon/glpk.h	Wed Mar 04 13:43:05 2009 +0000
     2.3 @@ -100,6 +100,18 @@
     2.4  
     2.5      virtual void _clear();
     2.6  
     2.7 +  private:
     2.8 +
     2.9 +    static void freeEnv();
    2.10 +
    2.11 +    struct FreeEnvHelper {
    2.12 +      ~FreeEnvHelper() {
    2.13 +        freeEnv();
    2.14 +      }
    2.15 +    };
    2.16 +    
    2.17 +    static FreeEnvHelper freeEnvHelper;
    2.18 +    
    2.19    public:
    2.20  
    2.21      ///Pointer to the underlying GLPK data structure.