objdialog.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2018 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifndef GCG_OBJDIALOG_H__
37 #define GCG_OBJDIALOG_H__
38 
39 #include <cstring>
40 
41 #include "scip/scip.h"
42 #include "objscip/objcloneable.h"
43 
44 namespace gcg
45 {
46 
53 class ObjDialog : public scip::ObjCloneable
54 {
55 public:
56  /*lint --e{1540}*/
57 
59  SCIP* scip_;
60 
62  char* scip_name_;
63 
65  char* scip_desc_;
66 
68  const SCIP_Bool scip_issubmenu_;
69 
72  SCIP* scip,
73  const char* name,
74  const char* desc,
75  SCIP_Bool issubmenu
76  )
77  : scip_(scip),
78  scip_name_(0),
79  scip_desc_(0),
80  scip_issubmenu_(issubmenu)
81  {
82  /* the macro SCIPduplicateMemoryArray does not need the first argument: */
83  SCIP_CALL_ABORT( SCIPduplicateMemoryArray(scip_, &scip_name_, name, std::strlen(name)+1) );
84  SCIP_CALL_ABORT( SCIPduplicateMemoryArray(scip_, &scip_desc_, desc, std::strlen(desc)+1) );
85  }
86 
88  virtual ~ObjDialog()
89  {
90  /* the macro SCIPfreeMemoryArray does not need the first argument: */
91  /*lint --e{64}*/
92  SCIPfreeMemoryArray(scip_, &scip_name_);
93  SCIPfreeMemoryArray(scip_, &scip_desc_);
94  scip_ = NULL;
95  }
96 
101  virtual SCIP_DECL_DIALOGFREE(scip_free)
102  { /*lint --e{715}*/
103  return SCIP_OKAY;
104  }
105 
110  virtual SCIP_DECL_DIALOGDESC(scip_desc)
111  { /*lint --e{715}*/
112  SCIPdialogMessage(scip, 0, "%s", scip_desc_);
113  return SCIP_OKAY;
114  }
115 
120  virtual SCIP_DECL_DIALOGEXEC(scip_exec) = 0;
121 };
122 
123 } /* namespace scip */
124 
125 
126 
147 extern
148 SCIP_RETCODE SCIPincludeObjDialog(
149  SCIP* scip,
150  SCIP_DIALOG* parentdialog,
151  gcg::ObjDialog* objdialog,
152  SCIP_Bool deleteobject
153  );
154 
155 #endif
char * scip_desc_
Definition: objdialog.h:65
virtual SCIP_DECL_DIALOGFREE(scip_free)
Definition: objdialog.h:101
SCIP_RETCODE SCIPincludeObjDialog(SCIP *scip, SCIP_DIALOG *parentdialog, gcg::ObjDialog *objdialog, SCIP_Bool deleteobject)
Definition: objdialog.cpp:127
SCIP * scip_
Definition: objdialog.h:59
virtual ~ObjDialog()
Definition: objdialog.h:88
ObjDialog(SCIP *scip, const char *name, const char *desc, SCIP_Bool issubmenu)
Definition: objdialog.h:71
char * scip_name_
Definition: objdialog.h:62
const SCIP_Bool scip_issubmenu_
Definition: objdialog.h:68
virtual SCIP_DECL_DIALOGDESC(scip_desc)
Definition: objdialog.h:110
C++ wrapper for dialogs.
Definition: objdialog.h:53
virtual SCIP_DECL_DIALOGEXEC(scip_exec)=0