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-2022 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 visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file objmessagehdlr.h
17  * @brief C++ wrapper for message handlers
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #ifndef __SCIP_OBJMESSAGEHDLR_H__
24 #define __SCIP_OBJMESSAGEHDLR_H__
25 
26 #include "scip/scip.h"
27 
28 namespace scip
29 {
30 
31 /**
32  * @brief C++ wrapper for message handlers
33  *
34  * This class defines the interface for message handlers implemented in C++. Note that all functions are pure virtual
35  * (these functions have to be implemented).
36  *
37  * - \ref type_message.h "Corresponding C interface"
38  */
40 {
41 public:
42  /** should the output be buffered up to the next newline? */
44 
45  /** default constructor */
46  explicit ObjMessagehdlr(
47  SCIP_Bool bufferedoutput /**< should the output be buffered up to the next newline? */
48  )
49  : scip_bufferedoutput_(bufferedoutput)
50  {
51  }
52 
53  /** destructor */
54  virtual ~ObjMessagehdlr()
55  {
56  }
57 
58  /** error message print method of message handler
59  *
60  * @note This function can be activated by calling SCIPsetStaticErrorPrintingMessagehdlr().
61  *
62  * @see SCIP_DECL_ERRORPRINTING(x) in @ref type_message.h
63  */ /*lint -e715*/
64  virtual void scip_error(
65  SCIP_MESSAGEHDLR* messagehdlr, /**< the message handler itself */
66  FILE* file, /**< file stream to print into (NULL for stderr) */
67  const char* msg /**< string to output into the file (or NULL to flush) */
68  )
69  { /*lint --e{715}*/
70 
71  }
72 
73  /** warning message print method of message handler
74  *
75  * @see SCIP_DECL_MESSAGEWARNING(x) in @ref type_message.h
76  */ /*lint -e715*/
77  virtual SCIP_DECL_MESSAGEWARNING(scip_warning)
78  { /*lint --e{715}*/
79 
80  }
81 
82  /** dialog message print method of message handler
83  *
84  * @see SCIP_DECL_MESSAGEDIALOG(x) in @ref type_message.h
85  */ /*lint -e715*/
86  virtual SCIP_DECL_MESSAGEDIALOG(scip_dialog)
87  { /*lint --e{715}*/
88 
89  }
90 
91  /** info message print method of message handler
92  *
93  * @see SCIP_DECL_MESSAGEINFO(x) in @ref type_message.h
94  */ /*lint -e715*/
95  virtual SCIP_DECL_MESSAGEINFO(scip_info)
96  { /*lint --e{715}*/
97 
98  }
99 
100  /** destructor of message handler to free message handler data
101  *
102  * @see SCIP_DECL_MESSAGEHDLRFREE(x) in @ref type_message.h
103  */ /*lint -e715*/
104  virtual SCIP_DECL_MESSAGEHDLRFREE(scip_free)
105  { /*lint --e{715}*/
106  return SCIP_OKAY;
107  }
108 };
109 
110 } /* namespace scip */
111 
112 
113 
114 /** creates the message handler for the given message handler object */
115 SCIP_EXPORT
117  SCIP_MESSAGEHDLR** messagehdlr, /**< pointer to store the message handler */
118  scip::ObjMessagehdlr* objmessagehdlr, /**< message handler object */
119  SCIP_Bool deleteobject /**< should the message handler object be deleted when message handler is freed? */
120  );
121 
122 /** returns the message handler object for the given message handler */
123 SCIP_EXPORT
125  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
126  );
127 
128 /** set static error output function to the corresponding function of message handler */
129 SCIP_EXPORT
131  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
132  );
133 
134 #endif
virtual SCIP_DECL_MESSAGEDIALOG(scip_dialog)
ObjMessagehdlr(SCIP_Bool bufferedoutput)
SCIP_RETCODE SCIPcreateObjMessagehdlr(SCIP_MESSAGEHDLR **messagehdlr, scip::ObjMessagehdlr *objmessagehdlr, SCIP_Bool deleteobject)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
virtual void scip_error(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *msg)
virtual SCIP_DECL_MESSAGEHDLRFREE(scip_free)
#define SCIP_Bool
Definition: def.h:84
C++ wrapper for message handlers.
virtual SCIP_DECL_MESSAGEINFO(scip_info)
void SCIPsetStaticErrorPrintingMessagehdlr(SCIP_MESSAGEHDLR *messagehdlr)
const SCIP_Bool scip_bufferedoutput_
virtual SCIP_DECL_MESSAGEWARNING(scip_warning)
scip::ObjMessagehdlr * SCIPgetObjMessagehdlr(SCIP_MESSAGEHDLR *messagehdlr)
SCIP callable library.