forked from LLNL/cardioid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpioHelper.c
37 lines (28 loc) · 871 Bytes
/
pioHelper.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// $Id$
#include "pioHelper.h"
#include <string.h>
#include <assert.h>
#include "ddcMalloc.h"
#include "pioFixedRecordHelper.h"
#include "pioVariableRecordHelper.h"
PIO_HELPER* pioHelperFactory(OBJECT* header)
{
char* dataType;
object_get(header, "datatype", &dataType, STRING, 1, "undefined");
PIO_HELPER* helper = NULL;
if (strcmp(dataType, "FIXRECORDASCII") == 0)
helper = pfrh_create(header);
else if (strcmp(dataType, "FIXRECORDBINARY") == 0)
helper = pfrh_create(header);
else if (strcmp(dataType, "VARRECORDASCII") == 0)
helper = pvrah_create(header);
else if (strcmp(dataType, "VARRECORDBINARY") == 0)
helper = pvrbh_create(header);
// catch attempt to read unknown datatype.
assert(helper != NULL);
ddcFree(dataType);
return helper;
}
/* Local Variables: */
/* tab-width: 3 */
/* End: */