Commit a74dae9c authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Extend open backend to create buffers only optionally.

parent 44d5ade2
......@@ -355,7 +355,8 @@ streamUnpack(char * unpackBuffer, int unpackBufferSize,
int
cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
int filetype, stream_t *streamptr);
int filetype, stream_t *streamptr,
int recordBufIsToBeCreated);
void
cdiStreamDefVlist_(int streamID, int vlistID);
......
......@@ -143,7 +143,8 @@ int pioFileOpen(const char *filename, const char *mode)
int
cdiPioStreamOpen(const char *filename, const char *filemode,
int filetype, stream_t *streamptr)
int filetype, stream_t *streamptr,
int recordBufIsToBeCreated)
{
if ( tolower ( * filemode ) == 'w' )
{
......
......@@ -18,7 +18,8 @@ int pioFileOpen(const char *filename, const char *mode);
int pioFileClose ( int );
size_t pioFileWrite ( int, int, const void*, size_t );
int cdiPioStreamOpen(const char *filename, const char *filemode,
int filetype, stream_t *streamptr);
int filetype, stream_t *streamptr,
int recordBufIsToBeCreated);
void cdiPioStreamDefVlist_(int streamID, int vlistID);
void cdiPioStreamWriteVar_(int streamID, int varID, int memtype,
const void *data, int nmiss);
......
......@@ -658,7 +658,8 @@ extern int cdiPioSerialOpenFileMap(int streamID);
#endif
int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
int filetype, stream_t *streamptr)
int filetype, stream_t *streamptr,
int recordBufIsToBeCreated)
{
int fileID;
switch (filetype)
......@@ -669,8 +670,11 @@ int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
{
fileID = gribOpen(filename, filemode);
if ( fileID < 0 ) fileID = CDI_ESYSTEM;
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
if (recordBufIsToBeCreated)
{
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
}
break;
}
#endif
......@@ -679,9 +683,12 @@ int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
{
fileID = fileOpen(filename, filemode);
if ( fileID < 0 ) fileID = CDI_ESYSTEM;
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
streamptr->record->srvp = srvNew();
if (recordBufIsToBeCreated)
{
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
streamptr->record->srvp = srvNew();
}
break;
}
#endif
......@@ -690,9 +697,12 @@ int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
{
fileID = fileOpen(filename, filemode);
if ( fileID < 0 ) fileID = CDI_ESYSTEM;
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
streamptr->record->extp = extNew();
if (recordBufIsToBeCreated)
{
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
streamptr->record->extp = extNew();
}
break;
}
#endif
......@@ -701,9 +711,12 @@ int cdiStreamOpenDefaultDelegate(const char *filename, const char *filemode,
{
fileID = fileOpen(filename, filemode);
if ( fileID < 0 ) fileID = CDI_ESYSTEM;
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
streamptr->record->iegp = iegNew();
if (recordBufIsToBeCreated)
{
streamptr->record = (Record *) malloc(sizeof(Record));
streamptr->record->buffer = NULL;
streamptr->record->iegp = iegNew();
}
break;
}
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment