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   reader.h
17  * @ingroup INTERNALAPI
18  * @brief  internal methods for input file readers
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_READER_H__
25 #define __SCIP_READER_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_prob.h"
30 #include "scip/type_retcode.h"
31 #include "scip/type_result.h"
32 #include "scip/type_set.h"
33 #include "scip/type_reader.h"
34 #include "scip/pub_reader.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
41 /** copies the given reader to a new scip */
42 SCIP_RETCODE SCIPreaderCopyInclude(
43    SCIP_READER*          reader,             /**< reader */
44    SCIP_SET*             set                 /**< SCIP_SET of SCIP to copy to */
45    );
46 
47 /** creates a reader */
48 SCIP_RETCODE SCIPreaderCreate(
49    SCIP_READER**         reader,             /**< pointer to store reader */
50    SCIP_SET*             set,                /**< global SCIP settings */
51    const char*           name,               /**< name of reader */
52    const char*           desc,               /**< description of reader */
53    const char*           extension,          /**< file extension that reader processes */
54    SCIP_DECL_READERCOPY  ((*readercopy)),    /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
55    SCIP_DECL_READERFREE  ((*readerfree)),    /**< destructor of reader */
56    SCIP_DECL_READERREAD  ((*readerread)),    /**< read method */
57    SCIP_DECL_READERWRITE ((*readerwrite)),   /**< write method */
58    SCIP_READERDATA*      readerdata          /**< reader data */
59    );
60 
61 /** frees memory of reader */
62 SCIP_RETCODE SCIPreaderFree(
63    SCIP_READER**         reader,             /**< pointer to reader data structure */
64    SCIP_SET*             set                 /**< global SCIP settings */
65    );
66 
67 /** reads problem data from file with given reader or returns SCIP_DIDNOTRUN */
68 SCIP_RETCODE SCIPreaderRead(
69    SCIP_READER*          reader,             /**< reader */
70    SCIP_SET*             set,                /**< global SCIP settings */
71    const char*           filename,           /**< name of the input file */
72    const char*           extension,          /**< extension of the input file name */
73    SCIP_RESULT*          result              /**< pointer to store the result of the callback method */
74    );
75 
76 /** writes problem data to file with given reader or returns SCIP_DIDNOTRUN */
77 SCIP_RETCODE SCIPreaderWrite(
78    SCIP_READER*          reader,             /**< reader */
79    SCIP_PROB*            prob,               /**< problem data */
80    SCIP_SET*             set,                /**< global SCIP settings */
81    FILE*                 file,               /**< output file (or NULL for standard output) */
82    const char*           format,             /**< file format (or NULL) */
83    SCIP_Bool             genericnames,       /**< using generic variable and constraint names? */
84    SCIP_RESULT*          result              /**< pointer to store the result of the callback method */
85    );
86 
87 /** gets time in seconds used in this reader for reading */
88 SCIP_Real SCIPreaderGetReadingTime(
89    SCIP_READER*          reader              /**< reader */
90    );
91 
92 /** enables or disables all clocks of \p reader, depending on the value of the flag */
93 void SCIPreaderEnableOrDisableClocks(
94    SCIP_READER*          reader,             /**< the reader for which all clocks should be enabled or disabled */
95    SCIP_Bool             enable              /**< should the clocks be enabled? */
96    );
97 
98 /** resets reading time of reader */
99 SCIP_RETCODE SCIPreaderResetReadingTime(
100    SCIP_READER*          reader              /**< reader */
101    );
102 
103 /** sets copy method of reader */
104 void SCIPreaderSetCopy(
105    SCIP_READER*          reader,             /**< reader */
106    SCIP_DECL_READERCOPY  ((*readercopy))     /**< copy method of reader or NULL if you don't want to copy your plugin into sub-SCIPs */
107    );
108 
109 /** sets destructor of reader */
110 void SCIPreaderSetFree(
111    SCIP_READER*          reader,             /**< reader */
112    SCIP_DECL_READERFREE  ((*readerfree))     /**< destructor of reader */
113    );
114 
115 /** sets read method of reader */
116 void SCIPreaderSetRead(
117    SCIP_READER*          reader,             /**< reader */
118    SCIP_DECL_READERREAD  ((*readerread))     /**< read method */
119    );
120 
121 /** sets write method of reader */
122 void SCIPreaderSetWrite(
123    SCIP_READER*          reader,             /**< reader */
124    SCIP_DECL_READERWRITE ((*readerwrite))    /**< write method */
125    );
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif
132