Toggle navigation
SCIP Optimization Suite
SCIP
SoPlex
ZIMPL
UG
GCG
Documentation
SCIP 9.2.0
SCIP 8.1.0
SCIP 7.0.3
SCIP 6.0.2
SCIP 5.0.1
SCIP 4.0.1
SCIP 3.2.1
SCIP
Solving Constraint Integer Programs
Overview
Files
Plugin Types
Interfaces
Examples
How To
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
scip-repo
src
scip
message_default.c
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-2014 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 message_default.c
17
* @ingroup PUBLICMETHODS
18
* @brief default message handler
19
* @author Stefan Heinz
20
*/
21
22
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23
24
#include "
scip/pub_message.h
"
25
#include "
scip/message_default.h
"
26
#include "
scip/struct_message.h
"
27
28
/*
29
* Local methods
30
*/
31
32
/** prints a message to the given file stream and writes the same messate to the log file */
33
static
34
void
logMessage
(
35
FILE* file,
/**< file stream to print message into */
36
const
char
* msg
/**< message to print (or NULL to flush) */
37
)
38
{
39
if
( msg !=
NULL
)
40
fputs(msg, file);
41
fflush(file);
42
}
43
44
/*
45
* Callback methods of message handler
46
*/
47
48
/** warning message print method of message handler */
49
static
50
SCIP_DECL_MESSAGEWARNING
(messageWarningDefault)
51
{
/*lint --e{715}*/
52
if
( msg !=
NULL
&& msg[0] !=
'\0'
&& msg[0] !=
'\n'
)
53
fputs(
"WARNING: "
, file);
54
55
logMessage
(file, msg);
56
}
57
58
/** dialog message print method of message handler */
59
static
60
SCIP_DECL_MESSAGEDIALOG
(messageDialogDefault)
61
{
/*lint --e{715}*/
62
logMessage
(file, msg);
63
}
64
65
/** info message print method of message handler */
66
static
67
SCIP_DECL_MESSAGEINFO
(messageInfoDefault)
68
{
/*lint --e{715}*/
69
logMessage
(file, msg);
70
}
71
72
/** Create default message handler. To free the message handler use SCIPmessagehdlrRelease(). */
73
SCIP_RETCODE
SCIPcreateMessagehdlrDefault
(
74
SCIP_MESSAGEHDLR
** messagehdlr,
/**< pointer to store message handler */
75
SCIP_Bool
bufferedoutput,
/**< should the output be buffered up to the next newline? */
76
const
char
* filename,
/**< name of log file, or NULL (stdout) */
77
SCIP_Bool
quiet
/**< should screen messages be suppressed? */
78
)
79
{
80
/* create message handler */
81
SCIP_CALL
(
SCIPmessagehdlrCreate
(messagehdlr, bufferedoutput, filename, quiet,
82
messageWarningDefault, messageDialogDefault, messageInfoDefault,
83
NULL
,
NULL
) );
84
85
return
SCIP_OKAY
;
86
}
87