Scippy

SCIP

Solving Constraint Integer Programs

pub_dialog.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pub_dialog.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for user interface dialog
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_PUB_DIALOG_H__
25 #define __SCIP_PUB_DIALOG_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_retcode.h"
30 #include "scip/type_scip.h"
31 #include "scip/type_dialog.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * dialog handler
39  */
40 
41 /**@addtogroup PublicDialogMethods
42  *
43  * @{
44  */
45 /** returns the root dialog of the dialog handler */
46 extern
48  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
49  );
50 
51 /** clears the input command buffer of the dialog handler */
52 extern
54  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
55  );
56 
57 /** returns TRUE iff input command buffer is empty */
58 extern
60  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
61  );
62 
63 /** returns the next line in the handler's command buffer; if the buffer is empty, displays the given prompt or the
64  * current dialog's path and asks the user for further input; the user must not free or modify the returned string
65  */
66 extern
68  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
69  SCIP_DIALOG* dialog, /**< current dialog */
70  const char* prompt, /**< prompt to display, or NULL to display the current dialog's path */
71  char** inputline, /**< pointer to store the complete line in the handler's command buffer */
72  SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
73  );
74 
75 /** returns the next word in the handler's command buffer; if the buffer is empty, displays the given prompt or the
76  * current dialog's path and asks the user for further input; the user must not free or modify the returned string
77  */
78 extern
80  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
81  SCIP_DIALOG* dialog, /**< current dialog */
82  const char* prompt, /**< prompt to display, or NULL to display the current dialog's path */
83  char** inputword, /**< pointer to store the next word in the handler's command buffer */
84  SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
85  );
86 
87 /** adds a single line of input to the dialog handler which is treated as if the user entered the command line */
88 extern
90  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
91  const char* inputline /**< input line to add */
92  );
93 
94 /** adds a command to the command history of the dialog handler; if a dialog is given, the command is preceeded
95  * by the dialog's command path; if no command is given, only the path to the dialog is added to the command history
96  */
97 extern
99  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
100  SCIP_DIALOG* dialog, /**< current dialog, or NULL */
101  const char* command, /**< command string to add to the command history, or NULL */
102  SCIP_Bool escapecommand /**< should special characters in command be prefixed by an escape char? */
103  );
104 
105 
106 
107 
108 /*
109  * dialog
110  */
111 
112 /** returns TRUE iff a dialog entry matching exactly the given name is existing in the given dialog */
113 extern
115  SCIP_DIALOG* dialog, /**< dialog */
116  const char* entryname /**< name of the dialog entry to find */
117  );
118 
119 /** searches the dialog for entries corresponding to the given name;
120  * If a complete match is found, the entry is returned as "subdialog" and
121  * the return value is 1.
122  * If no dialog entry completely matches the given "entryname", the number
123  * of entries with names beginning with "entryname" is returned. If this
124  * number is 1, the single match is returned as "subdialog". Otherwise,
125  * "subdialog" is set to NULL.
126  */
127 extern
129  SCIP_DIALOG* dialog, /**< dialog */
130  const char* entryname, /**< name of the dialog entry to find */
131  SCIP_DIALOG** subdialog /**< pointer to store the found dialog entry */
132  );
133 
134 /** displays the dialog's menu */
135 extern
137  SCIP_DIALOG* dialog, /**< dialog */
138  SCIP* scip /**< SCIP data structure */
139  );
140 
141 /** displays the entry for the dialog in it's parent's menu */
142 extern
144  SCIP_DIALOG* dialog, /**< dialog */
145  SCIP* scip /**< SCIP data structure */
146  );
147 
148 /** displays all dialog entries with names starting with the given "entryname" */
149 extern
151  SCIP_DIALOG* dialog, /**< dialog */
152  SCIP* scip, /**< SCIP data structure */
153  const char* entryname /**< name of the dialog entry to find */
154  );
155 
156 /** gets the name of the current path in the dialog tree, separated by the given character */
157 extern
158 void SCIPdialogGetPath(
159  SCIP_DIALOG* dialog, /**< dialog */
160  const char sepchar, /**< separation character to insert in path */
161  char* path /**< string buffer to store the path */
162  );
163 
164 /** gets the command name of the dialog */
165 extern
166 const char* SCIPdialogGetName(
167  SCIP_DIALOG* dialog /**< dialog */
168  );
169 
170 /** gets the description of the dialog */
171 extern
172 const char* SCIPdialogGetDesc(
173  SCIP_DIALOG* dialog /**< dialog */
174  );
175 
176 /** returns whether the dialog is a sub menu */
177 extern
179  SCIP_DIALOG* dialog /**< dialog */
180  );
181 
182 /** gets the parent dialog of the given dialog */
183 extern
185  SCIP_DIALOG* dialog /**< dialog */
186  );
187 
188 /** gets the array of sub-dialogs associated with the given dialog */
189 extern
191  SCIP_DIALOG* dialog /**< dialog */
192  );
193 
194 /** gets the number of sub-dialogs associated with the given dialog */
195 extern
197  SCIP_DIALOG* dialog /**< dialog */
198  );
199 
200 /** gets the user defined data associated with the given dialog */
201 extern
203  SCIP_DIALOG* dialog /**< dialog */
204  );
205 
206 /** sets user data of dialog; user has to free old data in advance! */
207 extern
208 void SCIPdialogSetData(
209  SCIP_DIALOG* dialog, /**< dialog */
210  SCIP_DIALOGDATA* dialogdata /**< new dialog user data */
211  );
212 
213 /** writes command history to specified filename */
214 extern
216  const char* filename /**< file name for (over)writing history */
217  );
218 
219 /* @} */
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif
int SCIPdialogGetNSubdialogs(SCIP_DIALOG *dialog)
Definition: dialog.c:1236
void SCIPdialoghdlrClearBuffer(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:435
const char * SCIPdialogGetName(SCIP_DIALOG *dialog)
Definition: dialog.c:1186
SCIP_DIALOG ** SCIPdialogGetSubdialogs(SCIP_DIALOG *dialog)
Definition: dialog.c:1226
void SCIPdialogGetPath(SCIP_DIALOG *dialog, const char sepchar, char *path)
Definition: dialog.c:1162
SCIP_RETCODE SCIPdialogDisplayMenuEntry(SCIP_DIALOG *dialog, SCIP *scip)
Definition: dialog.c:1097
SCIP_RETCODE SCIPdialogDisplayCompletions(SCIP_DIALOG *dialog, SCIP *scip, const char *entryname)
Definition: dialog.c:1131
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
int SCIPdialogFindEntry(SCIP_DIALOG *dialog, const char *entryname, SCIP_DIALOG **subdialog)
Definition: dialog.c:1019
struct SCIP_DialogData SCIP_DIALOGDATA
Definition: type_dialog.h:42
type definitions for return codes for SCIP methods
SCIP_DIALOG * SCIPdialogGetParent(SCIP_DIALOG *dialog)
Definition: dialog.c:1216
void SCIPdialogSetData(SCIP_DIALOG *dialog, SCIP_DIALOGDATA *dialogdata)
Definition: dialog.c:1256
SCIP_RETCODE SCIPdialogWriteHistory(const char *filename)
Definition: dialog.c:1267
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPdialogDisplayMenu(SCIP_DIALOG *dialog, SCIP *scip)
Definition: dialog.c:1063
const char * SCIPdialogGetDesc(SCIP_DIALOG *dialog)
Definition: dialog.c:1196
#define SCIP_Bool
Definition: def.h:61
SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
Definition: dialog.c:986
SCIP_RETCODE SCIPdialoghdlrAddInputLine(SCIP_DIALOGHDLR *dialoghdlr, const char *inputline)
Definition: dialog.c:687
SCIP_Bool SCIPdialogIsSubmenu(SCIP_DIALOG *dialog)
Definition: dialog.c:1206
SCIP_RETCODE SCIPdialoghdlrGetWord(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputword, SCIP_Bool *endoffile)
Definition: dialog.c:536
SCIP_RETCODE SCIPdialoghdlrAddHistory(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *command, SCIP_Bool escapecommand)
Definition: dialog.c:716
SCIP_DIALOG * SCIPdialoghdlrGetRoot(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:425
SCIP_Bool SCIPdialoghdlrIsBufferEmpty(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:446
type definitions for user interface dialog
SCIP_RETCODE SCIPdialoghdlrGetLine(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputline, SCIP_Bool *endoffile)
Definition: dialog.c:459
common defines and data types used in all packages of SCIP
SCIP_DIALOGDATA * SCIPdialogGetData(SCIP_DIALOG *dialog)
Definition: dialog.c:1246