1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (c) 2002-2023 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 scip_reader.h 26 * @ingroup PUBLICCOREAPI 27 * @brief public methods for reader plugins 28 * @author Tobias Achterberg 29 * @author Timo Berthold 30 * @author Thorsten Koch 31 * @author Alexander Martin 32 * @author Marc Pfetsch 33 * @author Kati Wolter 34 * @author Gregor Hendel 35 * @author Leona Gottwald 36 */ 37 38 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 39 40 #ifndef __SCIP_SCIP_READER_H__ 41 #define __SCIP_SCIP_READER_H__ 42 43 44 #include "scip/def.h" 45 #include "scip/type_cons.h" 46 #include "scip/type_prob.h" 47 #include "scip/type_reader.h" 48 #include "scip/type_result.h" 49 #include "scip/type_retcode.h" 50 #include "scip/type_scip.h" 51 #include "scip/type_var.h" 52 53 #ifdef __cplusplus 54 extern "C" { 55 #endif 56 57 /**@addtogroup PublicReaderMethods 58 * 59 * @{ 60 */ 61 62 /** creates a reader and includes it in SCIP 63 * 64 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 65 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 66 * 67 * @pre This method can be called if SCIP is in one of the following stages: 68 * - \ref SCIP_STAGE_INIT 69 * - \ref SCIP_STAGE_PROBLEM 70 * 71 * @note method has all reader callbacks as arguments and is thus changed every time a new callback is added 72 * in future releases; consider using SCIPincludeReaderBasic() and setter functions 73 * if you seek for a method which is less likely to change in future releases 74 */ 75 SCIP_EXPORT 76 SCIP_RETCODE SCIPincludeReader( 77 SCIP* scip, /**< SCIP data structure */ 78 const char* name, /**< name of reader */ 79 const char* desc, /**< description of reader */ 80 const char* extension, /**< file extension that reader processes */ 81 SCIP_DECL_READERCOPY ((*readercopy)), /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */ 82 SCIP_DECL_READERFREE ((*readerfree)), /**< destructor of reader */ 83 SCIP_DECL_READERREAD ((*readerread)), /**< read method */ 84 SCIP_DECL_READERWRITE ((*readerwrite)), /**< write method */ 85 SCIP_READERDATA* readerdata /**< reader data */ 86 ); 87 88 /** creates a reader and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL. 89 * Optional callbacks can be set via specific setter functions, see 90 * SCIPsetReaderCopy(), SCIPsetReaderFree(), SCIPsetReaderRead(), SCIPsetReaderWrite(). 91 * 92 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 93 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 94 * 95 * @pre This method can be called if SCIP is in one of the following stages: 96 * - \ref SCIP_STAGE_INIT 97 * - \ref SCIP_STAGE_PROBLEM 98 * 99 * @note if you want to set all callbacks with a single method call, consider using SCIPincludeReader() instead 100 */ 101 SCIP_EXPORT 102 SCIP_RETCODE SCIPincludeReaderBasic( 103 SCIP* scip, /**< SCIP data structure */ 104 SCIP_READER** readerptr, /**< reference to reader pointer, or NULL */ 105 const char* name, /**< name of reader */ 106 const char* desc, /**< description of reader */ 107 const char* extension, /**< file extension that reader processes */ 108 SCIP_READERDATA* readerdata /**< reader data */ 109 ); 110 111 /** set copy method of reader 112 * 113 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 114 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 115 * 116 * @pre This method can be called if SCIP is in one of the following stages: 117 * - \ref SCIP_STAGE_INIT 118 * - \ref SCIP_STAGE_PROBLEM 119 */ 120 SCIP_EXPORT 121 SCIP_RETCODE SCIPsetReaderCopy( 122 SCIP* scip, /**< SCIP data structure */ 123 SCIP_READER* reader, /**< reader */ 124 SCIP_DECL_READERCOPY ((*readercopy)) /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */ 125 ); 126 127 /** set deinitialization method of reader 128 * 129 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 130 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 131 * 132 * @pre This method can be called if SCIP is in one of the following stages: 133 * - \ref SCIP_STAGE_INIT 134 * - \ref SCIP_STAGE_PROBLEM 135 */ 136 SCIP_EXPORT 137 SCIP_RETCODE SCIPsetReaderFree( 138 SCIP* scip, /**< SCIP data structure */ 139 SCIP_READER* reader, /**< reader */ 140 SCIP_DECL_READERFREE ((*readerfree)) /**< destructor of reader */ 141 ); 142 143 /** set read method of reader 144 * 145 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 146 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 147 * 148 * @pre This method can be called if SCIP is in one of the following stages: 149 * - \ref SCIP_STAGE_INIT 150 * - \ref SCIP_STAGE_PROBLEM 151 */ 152 SCIP_EXPORT 153 SCIP_RETCODE SCIPsetReaderRead( 154 SCIP* scip, /**< SCIP data structure */ 155 SCIP_READER* reader, /**< reader */ 156 SCIP_DECL_READERREAD ((*readerread)) /**< read method of reader */ 157 ); 158 159 /** set write method of reader 160 * 161 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 162 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 163 * 164 * @pre This method can be called if SCIP is in one of the following stages: 165 * - \ref SCIP_STAGE_INIT 166 * - \ref SCIP_STAGE_PROBLEM 167 */ 168 SCIP_EXPORT 169 SCIP_RETCODE SCIPsetReaderWrite( 170 SCIP* scip, /**< SCIP data structure */ 171 SCIP_READER* reader, /**< reader */ 172 SCIP_DECL_READERWRITE ((*readerwrite)) /**< write method of reader */ 173 ); 174 175 /** returns the reader of the given name, or NULL if not existing */ 176 SCIP_EXPORT 177 SCIP_READER* SCIPfindReader( 178 SCIP* scip, /**< SCIP data structure */ 179 const char* name /**< name of reader */ 180 ); 181 182 /** returns the array of currently available readers */ 183 SCIP_EXPORT 184 SCIP_READER** SCIPgetReaders( 185 SCIP* scip /**< SCIP data structure */ 186 ); 187 188 /** returns the number of currently available readers */ 189 SCIP_EXPORT 190 int SCIPgetNReaders( 191 SCIP* scip /**< SCIP data structure */ 192 ); 193 194 /** @} */ 195 196 #ifdef __cplusplus 197 } 198 #endif 199 200 #endif 201