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_xyz.c
17 * @ingroup DEFPLUGINS_READER
18 * @brief XYZ file reader
19 * @author Tobias Achterberg
20 */
21
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23
24 #include <assert.h>
25
26 #include "scip/reader_xyz.h"
27
28
29 #define READER_NAME "xyzreader"
30 #define READER_DESC "xyz file reader"
31 #define READER_EXTENSION "xyz"
32
33
34 /*
35 * Data structures
36 */
37
38 /* TODO: (optional) fill in the necessary reader data */
39
40 /** data for xyz reader */
41 struct SCIP_ReaderData
42 {
43 };
44
45
46 /*
47 * Local methods
48 */
49
50 /* put your local methods here, and declare them static */
51
52
53 /*
54 * Callback methods of reader
55 */
56
57
58 /** copy method for reader plugins (called when SCIP copies plugins) */
59 #if 0
60 static
61 SCIP_DECL_READERCOPY(readerCopyXyz)
62 { /*lint --e{715}*/
63 SCIPerrorMessage("method of xyz reader not implemented yet\n");
64 SCIPABORT(); /*lint --e{527}*/
65
66 return SCIP_OKAY;
67 }
68 #else
69 #define readerCopyXyz NULL
70 #endif
71
72 /** destructor of reader to free user data (called when SCIP is exiting) */
73 #if 0
74 static
75 SCIP_DECL_READERFREE(readerFreeXyz)
76 { /*lint --e{715}*/
77 SCIPerrorMessage("method of xyz reader not implemented yet\n");
78 SCIPABORT(); /*lint --e{527}*/
79
80 return SCIP_OKAY;
81 }
82 #else
83 #define readerFreeXyz NULL
84 #endif
85
86
87 /** problem reading method of reader */
88 #if 0
89 static
90 SCIP_DECL_READERREAD(readerReadXyz)
91 { /*lint --e{715}*/
92 SCIPerrorMessage("method of xyz reader not implemented yet\n");
93 SCIPABORT(); /*lint --e{527}*/
94
95 return SCIP_OKAY;
96 }
97 #else
98 #define readerReadXyz NULL
99 #endif
100
101
102 #if 0
103 /** problem writing method of reader */
104 static
105 SCIP_DECL_READERWRITE(readerWriteXyz)
106 { /*lint --e{715}*/
107 SCIPerrorMessage("method of xyz reader not implemented yet\n");
108 SCIPABORT(); /*lint --e{527}*/
109
110 return SCIP_OKAY;
111 }
112 #else
113 #define readerWriteXyz NULL
114 #endif
115
116
117 /*
118 * reader specific interface methods
119 */
120
121 /** includes the xyz file reader in SCIP */
SCIPincludeReaderXyz(SCIP * scip)122 SCIP_RETCODE SCIPincludeReaderXyz(
123 SCIP* scip /**< SCIP data structure */
124 )
125 {
126 SCIP_READERDATA* readerdata;
127 SCIP_READER* reader;
128
129 /* create xyz reader data */
130 readerdata = NULL;
131 /* TODO: (optional) create reader specific data here */
132
133 reader = NULL;
134
135 /* include reader */
136 #if 0
137 /* use SCIPincludeReader() if you want to set all callbacks explicitly and realize (by getting compiler errors) when
138 * new callbacks are added in future SCIP versions
139 */
140 SCIP_CALL( SCIPincludeReader(scip, READER_NAME, READER_DESC, READER_EXTENSION,
141 readerCopyXyz, readerFreeXyz, readerReadXyz, readerWriteXyz, readerdata) );
142 #else
143 /* use SCIPincludeReaderBasic() plus setter functions if you want to set callbacks one-by-one and your code should
144 * compile independent of new callbacks being added in future SCIP versions
145 */
146 SCIP_CALL( SCIPincludeReaderBasic(scip, &reader, READER_NAME, READER_DESC, READER_EXTENSION, readerdata) );
147
148 assert(reader != NULL);
149
150 /* set non fundamental callbacks via setter functions */
151 SCIP_CALL( SCIPsetReaderCopy(scip, reader, readerCopyXyz) );
152 SCIP_CALL( SCIPsetReaderFree(scip, reader, readerFreeXyz) );
153 SCIP_CALL( SCIPsetReaderRead(scip, reader, readerReadXyz) );
154 SCIP_CALL( SCIPsetReaderWrite(scip, reader, readerWriteXyz) );
155 #endif
156
157 /* add xyz reader parameters */
158 /* TODO: (optional) add reader specific parameters with SCIPaddTypeParam() here */
159
160 return SCIP_OKAY;
161 }
162