Scippy

SCIP

Solving Constraint Integer Programs

objmessagehdlr.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-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file objmessagehdlr.h
26 * @brief C++ wrapper for message handlers
27 * @author Tobias Achterberg
28 */
29
30/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
31
32#ifndef __SCIP_OBJMESSAGEHDLR_H__
33#define __SCIP_OBJMESSAGEHDLR_H__
34
35#include "scip/scip.h"
36
37namespace scip
38{
39
40/** @brief C++ wrapper for message handlers
41 *
42 * This class defines the interface for message handlers implemented in C++. Note that all functions are pure virtual
43 * (these functions have to be implemented).
44 *
45 * - \ref type_message.h "Corresponding C interface"
46 */
48{
49public:
50 /** should the output be buffered up to the next newline? */
52
53 /** default constructor */
55 SCIP_Bool bufferedoutput /**< should the output be buffered up to the next newline? */
56 )
57 : scip_bufferedoutput_(bufferedoutput)
58 {
59 }
60
61 /** destructor */
63 {
64 }
65
66 /** assignment of polymorphic classes causes slicing and is therefore disabled. */
68
69 /** assignment of polymorphic classes causes slicing and is therefore disabled. */
71
72 /** error message print method of message handler
73 *
74 * @note This function can be activated by calling SCIPsetStaticErrorPrintingMessagehdlr().
75 *
76 * @see SCIP_DECL_ERRORPRINTING(x) in @ref type_message.h
77 */ /*lint -e715*/
78 virtual void scip_error(
79 SCIP_MESSAGEHDLR* messagehdlr, /**< the message handler itself */
80 FILE* file, /**< file stream to print into (NULL for stderr) */
81 const char* msg /**< string to output into the file (or NULL to flush) */
82 )
83 { /*lint --e{715}*/
84
85 }
86
87 /** warning message print method of message handler
88 *
89 * @see SCIP_DECL_MESSAGEWARNING(x) in @ref type_message.h
90 */ /*lint -e715*/
91 virtual SCIP_DECL_MESSAGEWARNING(scip_warning)
92 { /*lint --e{715}*/
93
94 }
95
96 /** dialog message print method of message handler
97 *
98 * @see SCIP_DECL_MESSAGEDIALOG(x) in @ref type_message.h
99 */ /*lint -e715*/
100 virtual SCIP_DECL_MESSAGEDIALOG(scip_dialog)
101 { /*lint --e{715}*/
102
103 }
104
105 /** info message print method of message handler
106 *
107 * @see SCIP_DECL_MESSAGEINFO(x) in @ref type_message.h
108 */ /*lint -e715*/
109 virtual SCIP_DECL_MESSAGEINFO(scip_info)
110 { /*lint --e{715}*/
111
112 }
113
114 /** destructor of message handler to free message handler data
115 *
116 * @see SCIP_DECL_MESSAGEHDLRFREE(x) in @ref type_message.h
117 */ /*lint -e715*/
118 virtual SCIP_DECL_MESSAGEHDLRFREE(scip_free)
119 { /*lint --e{715}*/
120 return SCIP_OKAY;
121 }
122};
123
124} /* namespace scip */
125
126
127
128/** creates the message handler for the given message handler object */
129SCIP_EXPORT
131 SCIP_MESSAGEHDLR** messagehdlr, /**< pointer to store the message handler */
132 scip::ObjMessagehdlr* objmessagehdlr, /**< message handler object */
133 SCIP_Bool deleteobject /**< should the message handler object be deleted when message handler is freed? */
134 );
135
136/** returns the message handler object for the given message handler */
137SCIP_EXPORT
139 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
140 );
141
142/** set static error output function to the corresponding function of message handler */
143SCIP_EXPORT
145 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
146 );
147
148#endif
C++ wrapper for message handlers.
ObjMessagehdlr & operator=(const ObjMessagehdlr &o)=delete
virtual SCIP_DECL_MESSAGEINFO(scip_info)
virtual SCIP_DECL_MESSAGEWARNING(scip_warning)
const SCIP_Bool scip_bufferedoutput_
virtual void scip_error(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *msg)
virtual SCIP_DECL_MESSAGEDIALOG(scip_dialog)
ObjMessagehdlr(SCIP_Bool bufferedoutput)
ObjMessagehdlr & operator=(ObjMessagehdlr &&o)=delete
virtual SCIP_DECL_MESSAGEHDLRFREE(scip_free)
#define SCIP_Bool
Definition: def.h:91
SCIP_RETCODE SCIPcreateObjMessagehdlr(SCIP_MESSAGEHDLR **messagehdlr, scip::ObjMessagehdlr *objmessagehdlr, SCIP_Bool deleteobject)
scip::ObjMessagehdlr * SCIPgetObjMessagehdlr(SCIP_MESSAGEHDLR *messagehdlr)
void SCIPsetStaticErrorPrintingMessagehdlr(SCIP_MESSAGEHDLR *messagehdlr)
SCIP callable library.
@ SCIP_OKAY
Definition: type_retcode.h:42
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63