Skip to content
Snippets Groups Projects
Commit 9ef4ff35 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

taxis_t: added cdi_keys_t

parent 46ebf9d7
No related branches found
No related tags found
1 merge request!136M214003/develop
......@@ -102,7 +102,6 @@ void
ptaxisInit(taxis_t *taxisptr)
{
taxisptr->self = CDI_UNDEFID;
taxisptr->datatype = CDI_DATATYPE_FLT64;
taxisptr->type = DefaultTimeType;
taxisptr->calendar = CDI_Default_Calendar;
taxisptr->unit = DefaultTimeUnit;
......@@ -120,6 +119,10 @@ ptaxisInit(taxis_t *taxisptr)
taxisptr->name = NULL;
taxisptr->longname = NULL;
taxisptr->units = NULL;
cdiInitKeys(&taxisptr->keys);
cdiDefVarKeyInt(&taxisptr->keys, CDI_KEY_DATATYPE, CDI_DATATYPE_FLT64);
taxisptr->datatype = CDI_DATATYPE_FLT64;
}
static taxis_t *
......@@ -235,6 +238,7 @@ taxisDefType(int taxisID, int taxistype)
if (taxisptr->type != taxistype)
{
taxisptr->type = taxistype;
cdiDefVarKeyInt(&taxisptr->keys, CDI_KEY_DATATYPE, CDI_DATATYPE_FLT64);
taxisptr->datatype = CDI_DATATYPE_FLT64;
delete_refcount_string(taxisptr->units);
taxisptr->units = NULL;
......@@ -849,6 +853,7 @@ taxisPtr(int taxisID)
void
ptaxisDefDatatype(taxis_t *taxisptr, int datatype)
{
cdiDefVarKeyInt(&taxisptr->keys, CDI_KEY_DATATYPE, datatype);
taxisptr->datatype = datatype;
}
......@@ -1349,7 +1354,6 @@ ptaxisCopy(taxis_t *dest, taxis_t *source)
reshLock();
// memcpy(dest, source, sizeof(taxis_t));
dest->datatype = source->datatype;
dest->type = source->type;
dest->calendar = source->calendar;
dest->unit = source->unit;
......@@ -1374,6 +1378,10 @@ ptaxisCopy(taxis_t *dest, taxis_t *source)
dest->units = dup_refcount_string(source->units);
if (dest->self != CDI_UNDEFID) reshSetStatus(dest->self, &taxisOps, RESH_DESYNC_IN_USE);
dest->datatype = source->datatype;
cdiInitKeys(&dest->keys);
cdiCopyVarKeys(&source->keys, &dest->keys);
reshUnlock();
}
......@@ -1480,6 +1488,7 @@ taxisGetPackSize(void *p, void *context)
+ (taxisptr->longname ? serializeGetSize((int) strlen(taxisptr->longname), CDI_DATATYPE_TXT, context) : 0)
+ (taxisptr->units ? serializeGetSize((int) strlen(taxisptr->units), CDI_DATATYPE_TXT, context) : 0)
+ serializeGetSize(1, CDI_DATATYPE_UINT32, context);
packBufferSize += serializeKeysGetPackSize(&taxisptr->keys, context);
return packBufferSize;
}
......@@ -1546,6 +1555,8 @@ taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int
taxisP->units = units;
}
serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &taxisP->keys, context);
reshSetStatus(taxisP->self, &taxisOps, reshGetStatus(taxisP->self, &taxisOps) & ~RESH_SYNC_BIT);
#undef adaptKey
......@@ -1596,6 +1607,8 @@ taxisPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos,
if (taxisP->longname)
serializePack(taxisP->longname, lnameLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context);
if (taxisP->units) serializePack(taxisP->units, unitsLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context);
serializeKeysPack(&taxisP->keys, packBuffer, packBufferSize, packBufferPos, context);
}
/*
......
......@@ -4,6 +4,8 @@
#include <stdbool.h>
#include "cdi.h"
#include "cdi_key.h"
#ifndef RESOURCE_HANDLE_H
#include "resource_handle.h"
#endif
......@@ -29,6 +31,7 @@ typedef struct
char *units;
bool climatology;
bool hasBounds;
cdi_keys_t keys;
} taxis_t;
// taxisInqSdatetime: Get the start date/time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment