Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
9b40b469
Commit
9b40b469
authored
Jul 19, 2016
by
Uwe Schulzweida
Browse files
Moved definition of cdi_atts_t to vlist_att.h.
parent
d313e344
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/stream_cdf_i.c
View file @
9b40b469
...
...
@@ -2417,9 +2417,9 @@ void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varn
cdfGetAttDouble
(
ncid
,
gmapvarid
,
attname
,
(
int
)
attlen
,
attflt
);
printf
(
"attrtype: %d attname: %s attr: %g
\n
"
,
attrtype
,
attname
,
attflt
[
0
]);
int
datatype
=
(
attrtype
==
NC_FLOAT
)
?
DATATYPE_FLT32
:
DATATYPE_FLT64
;
int
varID
=
vlistDefVar
(
projID
,
CDI_UNDEFID
,
CDI_UNDEFID
,
CDI_UNDEFID
);
printf
(
"varID = %d
\n
"
,
varID
);
//
vlistDefAttFlt(projID,
varID
, attname, datatype, (int)attlen, attflt);
//
int varID = vlistDefVar(projID, CDI_UNDEFID, CDI_UNDEFID, CDI_UNDEFID);
//
printf("varID = %d\n", varID);
vlistDefAttFlt
(
projID
,
CDI_GLOBAL
,
attname
,
datatype
,
(
int
)
attlen
,
attflt
);
}
else
if
(
xtypeIsText
(
attrtype
)
&&
strcmp
(
attname
,
"grid_mapping_name"
)
)
{
...
...
src/vlist.h
View file @
9b40b469
...
...
@@ -17,30 +17,7 @@
#define VALIDMISS 1.e+303
/*
* CDI attribute
*/
typedef
struct
{
size_t
xsz
;
/* amount of space at xvalue */
size_t
namesz
;
/* size of name */
char
*
name
;
/* attribute name */
int
indtype
;
/* internal data type of xvalue (INT, FLT or TXT) */
int
exdtype
;
/* external data type */
/* indtype exdtype */
/* TXT TXT */
/* INT INT16, INT32 */
/* FLT FLT32, FLT64 */
size_t
nelems
;
/* number of elements */
void
*
xvalue
;
/* the actual data */
}
cdi_att_t
;
typedef
struct
{
size_t
nalloc
;
/* number allocated >= nelems */
size_t
nelems
;
/* length of the array */
cdi_att_t
value
[
MAX_ATTRIBUTES
];
}
cdi_atts_t
;
#include
"vlist_att.h"
typedef
struct
{
...
...
@@ -117,9 +94,9 @@ var_t;
typedef
struct
{
//set when a vlist is passed to streamDefVlist() to safeguard against modifications of the wrong vlist object
bool
immutable
;
bool
immutable
;
//set if this vlist has been created by CDI itself, and must not be destroyed by the user, consequently
bool
internal
;
bool
internal
;
int
self
;
int
nvars
;
/* number of variables */
int
ngrids
;
...
...
src/vlist_att.c
View file @
9b40b469
...
...
@@ -491,9 +491,10 @@ vlistAttGetSize(vlist_t *vlistptr, int varID, int attnum, void *context)
return
txsize
;
}
int
vlistAttsGetSize
(
v
list_t
*
p
,
int
varID
,
void
*
context
)
int
vlistAttsGetSize
(
v
oid
*
v
p
,
int
varID
,
void
*
context
)
{
vlist_t
*
p
=
(
vlist_t
*
)
vp
;
cdi_atts_t
*
attsp
=
get_attsp
(
p
,
varID
);
int
txsize
=
serializeGetSize
(
1
,
DATATYPE_INT
,
context
);
size_t
numAtts
=
attsp
->
nelems
;
...
...
@@ -502,9 +503,9 @@ vlistAttsGetSize(vlist_t *p, int varID, void *context)
return
txsize
;
}
static
void
vlistAttPack
(
vlist_t
*
vlistptr
,
int
varID
,
int
attnum
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
static
void
vlistAttPack
(
vlist_t
*
vlistptr
,
int
varID
,
int
attnum
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
{
cdi_atts_t
*
attsp
;
cdi_att_t
*
attp
;
...
...
@@ -523,10 +524,10 @@ vlistAttPack(vlist_t *vlistptr, int varID, int attnum,
buf
,
size
,
position
,
context
);
}
void
vlistAttsPack
(
vlist_t
*
p
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
void
vlistAttsPack
(
void
*
vp
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
{
vlist_t
*
p
=
(
vlist_t
*
)
vp
;
cdi_atts_t
*
attsp
=
get_attsp
(
p
,
varID
);
size_t
numAtts
=
attsp
->
nelems
;
int
numAttsI
=
(
int
)
numAtts
;
...
...
@@ -536,9 +537,9 @@ vlistAttsPack(vlist_t *p, int varID,
vlistAttPack
(
p
,
varID
,
(
int
)
i
,
buf
,
size
,
position
,
context
);
}
static
void
vlistAttUnpack
(
int
vlistID
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
static
void
vlistAttUnpack
(
int
vlistID
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
{
int
tempbuf
[
vlist_att_nints
];
...
...
@@ -575,9 +576,8 @@ vlistAttUnpack(int vlistID, int varID,
Free
(
attData
);
}
void
vlistAttsUnpack
(
int
vlistID
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
void
vlistAttsUnpack
(
int
vlistID
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
)
{
int
numAtts
;
serializeUnpack
(
buf
,
size
,
position
,
&
numAtts
,
1
,
DATATYPE_INT
,
context
);
...
...
src/vlist_att.h
View file @
9b40b469
...
...
@@ -5,17 +5,42 @@
#include
"config.h"
#endif
int
vlistAttsGetSize
(
vlist_t
*
p
,
int
varID
,
void
*
context
);
#ifndef _CDI_LIMITS_H
#include
"cdi_limits.h"
#endif
/*
* CDI attribute
*/
typedef
struct
{
size_t
xsz
;
/* amount of space at xvalue */
size_t
namesz
;
/* size of name */
char
*
name
;
/* attribute name */
int
indtype
;
/* internal data type of xvalue (INT, FLT or TXT) */
int
exdtype
;
/* external data type */
/* indtype exdtype */
/* TXT TXT */
/* INT INT16, INT32 */
/* FLT FLT32, FLT64 */
size_t
nelems
;
/* number of elements */
void
*
xvalue
;
/* the actual data */
}
cdi_att_t
;
typedef
struct
{
size_t
nalloc
;
/* number allocated >= nelems */
size_t
nelems
;
/* length of the array */
cdi_att_t
value
[
MAX_ATTRIBUTES
];
}
cdi_atts_t
;
void
vlistAttsPack
(
vlist_t
*
p
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
);
int
vlistAttsGetSize
(
void
*
p
,
int
varID
,
void
*
context
);
void
vlistAttsUnpack
(
int
vlistID
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
);
void
vlistAttsPack
(
void
*
p
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
);
void
vlistAttsUnpack
(
int
vlistID
,
int
varID
,
void
*
buf
,
int
size
,
int
*
position
,
void
*
context
);
#endif
...
...
src/vlist_var.c
View file @
9b40b469
...
...
@@ -134,7 +134,6 @@ void vlistCheckVarID(const char *caller, int vlistID, int varID)
int
vlistDefVarTiles
(
int
vlistID
,
int
gridID
,
int
zaxisID
,
int
tsteptype
,
int
tilesetID
)
{
// printf("ObjID %d TxCode: %d\n", vlistID, reshGetTxCode(vlistID));
vlist_t
*
vlistptr
=
vlist_to_pointer
(
vlistID
);
if
(
CDI_Debug
)
Message
(
"gridID = %d zaxisID = %d tsteptype = %d"
,
gridID
,
zaxisID
,
tsteptype
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment