简体   繁体   中英

SCIP: About the "SCIP_ReaderData" in the bin packing example

A quesion about the reader plugin defined in the binpacking example. I found the following declaration in the interface method (file reader_bpa.c),

 SCIP_READERDATA* readerdata;
 readerdata = NULL;

I know SCIP_READERDATA is defined in file type_reader.h:

typedef struct SCIP_ReaderData SCIP_READERDATA;

However, the struct SCIP_ReaderData is not defined in the binpacking reader, so which is the actual struct that "SCIP_READERDATA* readerdata;" reference to? what kind of pointer is readerdata?

PS: I noticed that the default readers in SCIP have similar usage.

That is more a C-question than a SCIP question if I am not mistaken. The interface functions SCIPincludeReader() and SCIPincludeReaderBasic() require a pointer to reader data as last argument. Reader data is supposed to allow the plugin author to connect arbitrary data with their reader plugin by declaring the corresponding struct SCIP_ReaderData as many other plugins do. If you try to do anything with the pointer, eg, allocate memory for it using SCIPallocMemory(scip, &readerdata) , you will get compiler errors because the pointer refers to an incomplete type , namely struct SCIP_ReaderData .

More useful information on incomplete types is found, eg, here

The point is, the example uses this to make it clearer which arguments are passed to the SCIPIncludeReaderBasic() -function, where you would see NULL otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM