/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/unit.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-10-18 01:47:47 UTC
  • Revision ID: csa@suren.me-20151018014747-9ji2ygdhz1l9wnt5
Support properties of arbitrary type

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
extern "C" {
36
36
#endif
37
37
 
 
38
/**
 
39
 * Use this function to add new unit definitions into the model. It is error to re-register
 
40
 * already registered unit. The function will copy the context of unit description, but name, 
 
41
 * transform, and other strings in the structure are considered to have static duration 
 
42
 * and will not be copied. On error no new units are initalized.
 
43
 * @param[in,out] ctx - pcilib context
 
44
 * @param[in] n - number of units to initialize. It is OK to pass 0 if protocols variable is NULL terminated (last member of protocols array have all members set to 0)
 
45
 * @param[in] desc - unit descriptions
 
46
 * @return - error or 0 on success
 
47
 */
38
48
int pcilib_add_units(pcilib_t *ctx, size_t n, const pcilib_unit_description_t *desc);
39
 
void pcilib_clean_units(pcilib_t *ctx);
 
49
 
 
50
/**
 
51
 * Destroys data associated with units. This is an internal function and will
 
52
 * be called during clean-up.
 
53
 * @param[in,out] ctx - pcilib context
 
54
 * @param[in] start - specifies first unit to clean (used to clean only part of the units to keep the defined state if pcilib_add_units has failed)
 
55
 */
 
56
void pcilib_clean_units(pcilib_t *ctx, pcilib_unit_t start);
40
57
 
41
58
pcilib_unit_t pcilib_find_unit_by_name(pcilib_t *ctx, const char *unit);
42
59
pcilib_unit_transform_t *pcilib_find_transform_by_unit_names(pcilib_t *ctx, const char *from, const char *to);
43
60
 
44
 
    // value is modified
45
 
int pcilib_transform_unit(pcilib_t *ctx, pcilib_unit_transform_t *trans, pcilib_value_t *value);
 
61
/**
 
62
 * Converts value to the requested units. It is error to convert values with unspecified units.
 
63
 * This is internal function, use pcilib_value_convert_value_unit instead.
 
64
 * @param[in,out] ctx - pcilib context
 
65
 * @param[in] trans - the requested unit transform 
 
66
 * @param[in,out] value - the value to be converted (changed on success)
 
67
 * @return - error or 0 on success
 
68
 */
 
69
int pcilib_transform_unit(pcilib_t *ctx, const pcilib_unit_transform_t *trans, pcilib_value_t *value);
 
70
 
 
71
/**
 
72
 * Converts value to the requested units. It is error to convert values with unspecified units.
 
73
 * This is internal function, use pcilib_value_convert_value_unit instead.
 
74
 * @param[in,out] ctx - pcilib context
 
75
 * @param[in] name - specifies the requested unit of the value
 
76
 * @param[in,out] value - the value to be converted (changed on success)
 
77
 * @return - error or 0 on success
 
78
 */
46
79
int pcilib_transform_unit_by_name(pcilib_t *ctx, const char *to, pcilib_value_t *value);
47
80
 
48
81