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:
parent
afc529626a
commit
6fb3271a54
2 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue