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-2016 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 PUBLICMETHODS
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 /** returns the root dialog of the dialog handler */
42 extern
44  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
45  );
46 
47 /** clears the input command buffer of the dialog handler */
48 extern
50  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
51  );
52 
53 /** returns TRUE iff input command buffer is empty */
54 extern
56  SCIP_DIALOGHDLR* dialoghdlr /**< dialog handler */
57  );
58 
59 /** returns the next line in the handler's command buffer; if the buffer is empty, displays the given prompt or the
60  * current dialog's path and asks the user for further input; the user must not free or modify the returned string
61  */
62 extern
64  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
65  SCIP_DIALOG* dialog, /**< current dialog */
66  const char* prompt, /**< prompt to display, or NULL to display the current dialog's path */
67  char** inputline, /**< pointer to store the complete line in the handler's command buffer */
68  SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
69  );
70 
71 /** returns the next word in the handler's command buffer; if the buffer is empty, displays the given prompt or the
72  * current dialog's path and asks the user for further input; the user must not free or modify the returned string
73  */
74 extern
76  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
77  SCIP_DIALOG* dialog, /**< current dialog */
78  const char* prompt, /**< prompt to display, or NULL to display the current dialog's path */
79  char** inputword, /**< pointer to store the next word in the handler's command buffer */
80  SCIP_Bool* endoffile /**< pointer to store whether the end of the input file was reached */
81  );
82 
83 /** adds a single line of input to the dialog handler which is treated as if the user entered the command line */
84 extern
86  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
87  const char* inputline /**< input line to add */
88  );
89 
90 /** adds a command to the command history of the dialog handler; if a dialog is given, the command is preceeded
91  * by the dialog's command path; if no command is given, only the path to the dialog is added to the command history
92  */
93 extern
95  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
96  SCIP_DIALOG* dialog, /**< current dialog, or NULL */
97  const char* command, /**< command string to add to the command history, or NULL */
98  SCIP_Bool escapecommand /**< should special characters in command be prefixed by an escape char? */
99  );
100 
101 
102 
103 
104 /*
105  * dialog
106  */
107 
108 /** returns TRUE iff a dialog entry matching exactly the given name is existing in the given dialog */
109 extern
111  SCIP_DIALOG* dialog, /**< dialog */
112  const char* entryname /**< name of the dialog entry to find */
113  );
114 
115 /** searches the dialog for entries corresponding to the given name;
116  * If a complete match is found, the entry is returned as "subdialog" and
117  * the return value is 1.
118  * If no dialog entry completely matches the given "entryname", the number
119  * of entries with names beginning with "entryname" is returned. If this
120  * number is 1, the single match is returned as "subdialog". Otherwise,
121  * "subdialog" is set to NULL.
122  */
123 extern
125  SCIP_DIALOG* dialog, /**< dialog */
126  const char* entryname, /**< name of the dialog entry to find */
127  SCIP_DIALOG** subdialog /**< pointer to store the found dialog entry */
128  );
129 
130 /** displays the dialog's menu */
131 extern
133  SCIP_DIALOG* dialog, /**< dialog */
134  SCIP* scip /**< SCIP data structure */
135  );
136 
137 /** displays the entry for the dialog in it's parent's menu */
138 extern
140  SCIP_DIALOG* dialog, /**< dialog */
141  SCIP* scip /**< SCIP data structure */
142  );
143 
144 /** displays all dialog entries with names starting with the given "entryname" */
145 extern
147  SCIP_DIALOG* dialog, /**< dialog */
148  SCIP* scip, /**< SCIP data structure */
149  const char* entryname /**< name of the dialog entry to find */
150  );
151 
152 /** gets the name of the current path in the dialog tree, separated by the given character */
153 extern
154 void SCIPdialogGetPath(
155  SCIP_DIALOG* dialog, /**< dialog */
156  const char sepchar, /**< separation character to insert in path */
157  char* path /**< string buffer to store the path */
158  );
159 
160 /** gets the command name of the dialog */
161 extern
162 const char* SCIPdialogGetName(
163  SCIP_DIALOG* dialog /**< dialog */
164  );
165 
166 /** gets the description of the dialog */
167 extern
168 const char* SCIPdialogGetDesc(
169  SCIP_DIALOG* dialog /**< dialog */
170  );
171 
172 /** returns whether the dialog is a sub menu */
173 extern
175  SCIP_DIALOG* dialog /**< dialog */
176  );
177 
178 /** gets the parent dialog of the given dialog */
179 extern
181  SCIP_DIALOG* dialog /**< dialog */
182  );
183 
184 /** gets the array of sub-dialogs associated with the given dialog */
185 extern
187  SCIP_DIALOG* dialog /**< dialog */
188  );
189 
190 /** gets the number of sub-dialogs associated with the given dialog */
191 extern
193  SCIP_DIALOG* dialog /**< dialog */
194  );
195 
196 /** gets the user defined data associated with the given dialog */
197 extern
199  SCIP_DIALOG* dialog /**< dialog */
200  );
201 
202 /** sets user data of dialog; user has to free old data in advance! */
203 extern
204 void SCIPdialogSetData(
205  SCIP_DIALOG* dialog, /**< dialog */
206  SCIP_DIALOGDATA* dialogdata /**< new dialog user data */
207  );
208 
209 /** writes command history to specified filename */
210 extern
212  const char* filename /**< file name for (over)writing history */
213  );
214 
215 #ifdef __cplusplus
216 }
217 #endif
218 
219 #endif
void SCIPdialogGetPath(SCIP_DIALOG *dialog, const char sepchar, char *path)
Definition: dialog.c:1146
void SCIPdialoghdlrClearBuffer(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:435
SCIP_RETCODE SCIPdialogDisplayCompletions(SCIP_DIALOG *dialog, SCIP *scip, const char *entryname)
Definition: dialog.c:1115
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
struct SCIP_DialogData SCIP_DIALOGDATA
Definition: type_dialog.h:42
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPdialoghdlrGetLine(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputline, SCIP_Bool *endoffile)
Definition: dialog.c:459
SCIP_RETCODE SCIPdialogWriteHistory(const char *filename)
Definition: dialog.c:1251
SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
Definition: dialog.c:970
SCIP_DIALOGDATA * SCIPdialogGetData(SCIP_DIALOG *dialog)
Definition: dialog.c:1230
void SCIPdialogSetData(SCIP_DIALOG *dialog, SCIP_DIALOGDATA *dialogdata)
Definition: dialog.c:1240
int SCIPdialogGetNSubdialogs(SCIP_DIALOG *dialog)
Definition: dialog.c:1220
SCIP_DIALOG ** SCIPdialogGetSubdialogs(SCIP_DIALOG *dialog)
Definition: dialog.c:1210
type definitions for SCIP&#39;s main datastructure
SCIP_DIALOG * SCIPdialoghdlrGetRoot(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:425
SCIP_RETCODE SCIPdialoghdlrAddHistory(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *command, SCIP_Bool escapecommand)
Definition: dialog.c:711
SCIP_RETCODE SCIPdialogDisplayMenuEntry(SCIP_DIALOG *dialog, SCIP *scip)
Definition: dialog.c:1081
#define SCIP_Bool
Definition: def.h:53
const char * SCIPdialogGetDesc(SCIP_DIALOG *dialog)
Definition: dialog.c:1180
SCIP_RETCODE SCIPdialoghdlrAddInputLine(SCIP_DIALOGHDLR *dialoghdlr, const char *inputline)
Definition: dialog.c:687
SCIP_RETCODE SCIPdialoghdlrGetWord(SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog, const char *prompt, char **inputword, SCIP_Bool *endoffile)
Definition: dialog.c:536
SCIP_DIALOG * SCIPdialogGetParent(SCIP_DIALOG *dialog)
Definition: dialog.c:1200
SCIP_RETCODE SCIPdialogDisplayMenu(SCIP_DIALOG *dialog, SCIP *scip)
Definition: dialog.c:1047
type definitions for user interface dialog
SCIP_Bool SCIPdialogIsSubmenu(SCIP_DIALOG *dialog)
Definition: dialog.c:1190
common defines and data types used in all packages of SCIP
const char * SCIPdialogGetName(SCIP_DIALOG *dialog)
Definition: dialog.c:1170
int SCIPdialogFindEntry(SCIP_DIALOG *dialog, const char *entryname, SCIP_DIALOG **subdialog)
Definition: dialog.c:1003
SCIP_Bool SCIPdialoghdlrIsBufferEmpty(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:446