Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
0f9a0757
Commit
0f9a0757
authored
Feb 23, 2018
by
Uwe Schulzweida
Browse files
Added function varDefKeyBytes().
parent
db35384f
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cdi_key.c
View file @
0f9a0757
...
...
@@ -237,14 +237,9 @@ int cdiInqKeyInt(int cdiID, int varID, int key, int *value)
return
status
;
}
// cdiDefKeyBytes: Define a bytes array from a key of a CDI variable
int
cdiDefKeyBytes
(
int
cdiID
,
int
varID
,
int
key
,
const
unsigned
char
*
bytes
,
int
length
)
{
int
status
=
CDI_NOERR
;
cdi_keys_t
*
keysp
=
cdi_get_keysp
(
cdiID
,
varID
);
xassert
(
keysp
!=
NULL
);
void
cdiDefVarKeyBytes
(
cdi_keys_t
*
keysp
,
int
key
,
const
unsigned
char
*
bytes
,
int
length
)
{
cdi_key_t
*
keyp
=
find_key
(
keysp
,
key
);
if
(
keyp
==
NULL
)
keyp
=
new_key
(
keysp
,
key
);
...
...
@@ -264,6 +259,17 @@ int cdiDefKeyBytes(int cdiID, int varID, int key, const unsigned char *bytes, in
memcpy
(
keyp
->
v
.
s
,
bytes
,
length
);
keyp
->
type
=
KEY_BYTES
;
}
}
// cdiDefKeyBytes: Define a bytes array from a key of a CDI variable
int
cdiDefKeyBytes
(
int
cdiID
,
int
varID
,
int
key
,
const
unsigned
char
*
bytes
,
int
length
)
{
int
status
=
CDI_NOERR
;
cdi_keys_t
*
keysp
=
cdi_get_keysp
(
cdiID
,
varID
);
xassert
(
keysp
!=
NULL
);
cdiDefVarKeyBytes
(
keysp
,
key
,
bytes
,
length
);
return
status
;
}
...
...
src/cdi_key.h
View file @
0f9a0757
...
...
@@ -21,7 +21,10 @@ typedef struct {
cdi_key_t
value
[
MAX_KEYS
];
}
cdi_keys_t
;
void
cdiDefVarKeyInt
(
cdi_keys_t
*
keysp
,
int
key
,
int
value
);
void
cdiDefVarKeyBytes
(
cdi_keys_t
*
keysp
,
int
key
,
const
unsigned
char
*
bytes
,
int
length
);
void
cdiCopyVarKeys
(
cdi_keys_t
*
keysp
,
int
cdiID2
,
int
varID2
);
void
cdiDeleteVarKeys
(
cdi_keys_t
*
keysp
);
int
cdiDeleteKeys
(
int
cdiID
,
int
varID
);
...
...
src/stream_gribapi.c
View file @
0f9a0757
...
...
@@ -449,6 +449,12 @@ void gribapiGetKeys(grib_handle *gh, int varID)
varDefKeyInt
(
varID
,
CDI_KEY_PERTURBATIONNUMBER
,
(
int
)
perturbationNumber
);
}
}
long
ltmp
;
if
(
grib_get_long
(
gh
,
"grib2LocalSectionNumber"
,
&
ltmp
)
==
0
)
{
// printf("grib2LocalSectionNumber %ld\n", ltmp);
}
}
static
...
...
src/varscan.c
View file @
0f9a0757
...
...
@@ -1097,6 +1097,13 @@ void varDefKeyInt(int varID, int key, int value)
}
void
varDefKeyBytes
(
int
varID
,
int
key
,
const
unsigned
char
*
bytes
,
int
length
)
{
cdi_keys_t
*
keysp
=
&
(
vartable
[
varID
].
keys
);
cdiDefVarKeyBytes
(
keysp
,
key
,
bytes
,
length
);
}
#if defined (HAVE_LIBGRIB_API)
/* Resizes and initializes opt_grib_kvpair data structure. */
static
...
...
src/varscan.h
View file @
0f9a0757
...
...
@@ -30,6 +30,7 @@ void varDefTable(int varID, int tableID);
int
varInqTable
(
int
varID
);
void
varDefKeyInt
(
int
varID
,
int
key
,
int
value
);
void
varDefKeyBytes
(
int
varID
,
int
key
,
const
unsigned
char
*
bytes
,
int
length
);
void
varDefOptGribInt
(
int
varID
,
int
tile_index
,
long
lval
,
const
char
*
keyword
);
void
varDefOptGribDbl
(
int
varID
,
int
tile_index
,
double
dval
,
const
char
*
keyword
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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