1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

sample: add sample_format()

This commit is contained in:
Steffen Vogel 2018-08-06 11:26:25 +02:00
parent afc529626a
commit 6fb3271a54
2 changed files with 13 additions and 1 deletions

View file

@ -76,6 +76,7 @@ struct sample {
int capacity; /**< The number of values in sample::values for which memory is reserved. */
int flags; /**< Flags are used to store binary properties of a sample. */
struct list *signals; /**< The list of signal descriptors. */
atomic_int refcnt; /**< Reference counter. */
ptrdiff_t pool_off; /**< This sample belongs to this memory pool (relative pointer). See sample_pool(). */
@ -91,7 +92,7 @@ struct sample {
double f; /**< Floating point values. */
int64_t i; /**< Integer values. */
bool b; /**< Boolean values. */
float complex z; /**< Complex values. */
float _Complex z; /**< Complex values. */
} data[]; /**< Data is in host endianess! */
};
@ -132,6 +133,8 @@ int sample_copy_many(struct sample *dsts[], struct sample *srcs[], int cnt);
int sample_get_many(struct sample *smps[], int cnt);
int sample_put_many(struct sample *smps[], int cnt);
enum signal_format sample_format(const struct sample *s, unsigned idx);
#ifdef __cplusplus
}
#endif

View file

@ -252,3 +252,12 @@ int sample_cmp(struct sample *a, struct sample *b, double epsilon, int flags)
return 0;
}
enum signal_format sample_format(const struct sample *s, unsigned idx)
{
struct signal *sig;
sig = (struct signal *) list_at_safe(s->signals, idx);
return sig ? sig->format : SIGNAL_FORMAT_UNKNOWN;
}