summaryrefslogtreecommitdiffstats
path: root/pcilib/unit.h
blob: 9c62ff3e72350f892a1a7d34c99463d412a7461b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _PCILIB_UNIT_H
#define _PCILIB_UNIT_H

#include <pcilib.h>

#define PCILIB_UNIT_INVALID ((pcilib_unit_t)-1)
#define PCILIB_MAX_TRANSFORMS_PER_UNIT 16			/**< Limits number of supported transforms per unit */

typedef struct pcilib_unit_context_s *pcilib_unit_context_t;

/**
 * unit transformation routines
 */
typedef struct {
    char *unit;									/**< Name of the resulting unit */
    char *transform;								/**< String, similar to view formula, explaining transform to this unit */
} pcilib_unit_transform_t;

typedef struct {
    char *name;									/**< Unit name */
    pcilib_unit_transform_t transforms[PCILIB_MAX_TRANSFORMS_PER_UNIT + 1];	/**< Transforms to other units */
} pcilib_unit_description_t;

#ifdef __cplusplus
extern "C" {
#endif

int pcilib_add_units(pcilib_t *ctx, size_t n, const pcilib_unit_description_t *desc);
pcilib_unit_t pcilib_find_unit_by_name(pcilib_t *ctx, const char *unit);

#ifdef __cplusplus
}
#endif


#endif /* _PCILIB_UNIT_H */