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
3c70e59a
Commit
3c70e59a
authored
May 16, 2017
by
Fabian Wachsmann
Browse files
Added three function to inq Charvals and added maximal string length as zaxis attribute
parent
8f73c100
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zaxis.c
View file @
3c70e59a
...
...
@@ -129,6 +129,7 @@ void zaxis_init(zaxis_t *zaxisptr)
zaxisptr
->
p0value
.
defined
=
false
;
zaxisptr
->
vals
=
NULL
;
zaxisptr
->
cvals
=
NULL
;
zaxisptr
->
clength
=
0
;
zaxisptr
->
ubounds
=
NULL
;
zaxisptr
->
lbounds
=
NULL
;
zaxisptr
->
weights
=
NULL
;
...
...
@@ -777,20 +778,24 @@ void zaxisDefLevels(int zaxisID, const double *levels)
}
void
zaxisDefCvals
(
int
zaxisID
,
const
char
**
cvals
)
void
zaxisDefCvals
(
int
zaxisID
,
const
char
**
cvals
,
size_t
clen
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
size_t
size
=
(
size_t
)
zaxisptr
->
size
;
if
(
cvals
)
if
(
cvals
&&
clen
)
{
if
(
zaxisptr
->
cvals
!=
NULL
)
zaxisptr
->
cvals
=
NULL
;
zaxisptr
->
clength
=
clen
;
zaxisptr
->
cvals
=
(
char
**
)
Malloc
(
size
*
sizeof
(
char
*
));
for
(
size_t
ilev
=
0
;
ilev
<
size
;
++
ilev
)
zaxisptr
->
cvals
[
ilev
]
=
strdup
(
cvals
[
ilev
]);
{
zaxisptr
->
cvals
[
ilev
]
=
Malloc
((
clen
+
1
)
*
sizeof
(
char
));
strcpy
(
zaxisptr
->
cvals
[
ilev
],
cvals
[
ilev
]);
zaxisptr
->
cvals
[
ilev
][
clen
]
=
'\0'
;
}
reshSetStatus
(
zaxisID
,
&
zaxisOps
,
RESH_DESYNC_IN_USE
);
}
}
...
...
@@ -988,6 +993,15 @@ const double *zaxisInqLevelsPtr(int zaxisID)
return
zaxisptr
->
vals
;
}
char
**
zaxisInqCLevelsPtr
(
int
zaxisID
)
{
char
**
cvals
=
NULL
;
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
cvals
=
zaxisptr
->
cvals
;
return
cvals
;
}
/*
@Function zaxisInqLevels
@Title Get all levels of a Z-axis
...
...
@@ -1022,6 +1036,40 @@ int zaxisInqLevels(int zaxisID, double *levels)
return
size
;
}
int
zaxisInqCLen
(
int
zaxisID
)
{
int
size
=
0
;
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
if
(
zaxisptr
->
cvals
&&
zaxisptr
->
clength
)
size
=
zaxisptr
->
clength
;
return
size
;
}
int
zaxisInqCLevels
(
int
zaxisID
,
char
***
clevels
)
{
int
size
=
0
;
size_t
clen
=
0
;
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
if
(
zaxisptr
->
cvals
)
{
size
=
zaxisptr
->
size
;
clen
=
zaxisptr
->
clength
;
if
(
clevels
&&
size
&&
clen
)
{
(
*
clevels
)
=
Malloc
(
size
*
sizeof
(
char
*
));
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
(
*
clevels
)[
i
]
=
Malloc
(
clen
*
sizeof
(
char
));
strcpy
((
*
clevels
)[
i
],
zaxisptr
->
cvals
[
i
]);
}
}
}
return
size
;
}
int
zaxisInqLbounds
(
int
zaxisID
,
double
*
lbounds
)
{
...
...
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