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