TIM SDK
TIM API C
|
|
Amount.
Object type amount.
Functions | |
ta_e_result_code_t | ta_amount_create (ta_object_t *amount, int64_t value, ta_e_currency_t currency) |
Create object of type amount. More... | |
ta_e_result_code_t | ta_amount_create_decimal (ta_object_t *amount, double value, ta_e_currency_t currency) |
Create object of type amount using double precision floating point value. More... | |
ta_e_result_code_t | ta_amount_create_exponent (ta_object_t *amount, int64_t value, ta_e_currency_t currency, int exponent) |
Create object of type amount using custom exponent. More... | |
ta_e_result_code_t | ta_amount_create_decimal_exponent (ta_object_t *amount, double value, ta_e_currency_t currency, int exponent) |
Create object of type amount using custom exponent and double precision value. More... | |
ta_e_result_code_t | ta_amount_get_value (ta_object_t amount, int64_t *value) |
Amount in minor units. More... | |
ta_e_result_code_t | ta_amount_set_value (ta_object_t amount, int64_t value) |
Set amount in minor units. More... | |
ta_e_result_code_t | ta_amount_get_decimal_value (ta_object_t amount, double *value) |
Amount in major units as double precision floating point value. More... | |
ta_e_result_code_t | ta_amount_set_decimal_value (ta_object_t amount, double value) |
Set amount in major units as double precision floating point value. More... | |
ta_e_result_code_t | ta_amount_get_currency (ta_object_t amount, ta_e_currency_t *currency) |
Currency. More... | |
ta_e_result_code_t | ta_amount_set_currency (ta_object_t amount, ta_e_currency_t currency) |
Set currency. More... | |
ta_e_result_code_t | ta_amount_get_exponent (ta_object_t amount, int *exponent) |
Exponent. More... | |
ta_e_result_code_t | ta_amount_set_exponent (ta_object_t amount, int exponent) |
Set exponent. More... | |
ta_e_result_code_t ta_amount_create | ( | ta_object_t * | amount, |
int64_t | value, | ||
ta_e_currency_t | currency | ||
) |
Create object of type amount.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in minor units. The currency selected by currency defines the used exponent. For example with ta_c_currency_chf the exponent is 2. To create an amount equal to 1 CHF use a value of 100. |
[in] | currency | Currency of amount. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_create_decimal | ( | ta_object_t * | amount, |
double | value, | ||
ta_e_currency_t | currency | ||
) |
Create object of type amount using double precision floating point value.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in major units. The currency selected by currency defines the used exponent. For example with ta_c_currency_chf the exponent is 2. Values with more than 2 digits after the period will be rounded according to regular mathematical rounding rules. |
[in] | currency | Currency of amount. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_create_decimal_exponent | ( | ta_object_t * | amount, |
double | value, | ||
ta_e_currency_t | currency, | ||
int | exponent | ||
) |
Create object of type amount using custom exponent and double precision value.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in minor units. The value of exponent overrides the exponent defined by the currency selected by currency. For example with an exponent of 3 values with more than 3 digits after the period will be rounded according to regular mathematical rounding rules. |
[in] | currency | Currency of amount. |
[in] | exponent | Exponent to use instead of the exponent defined by the currency. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_invalid_argument | exponent is less than 0. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_create_exponent | ( | ta_object_t * | amount, |
int64_t | value, | ||
ta_e_currency_t | currency, | ||
int | exponent | ||
) |
Create object of type amount using custom exponent.
[out] | amount | Pointer to variable to write created object instance to. Created object instance is retained. |
[in] | value | Value of amount in minor units. The value of exponent overrides the exponent defined by the currency selected by currency. For example with an exponent of 3 to create an amount equal to 1 CHF use a value of 1000. |
[in] | currency | Currency of amount. |
[in] | exponent | Exponent to use instead of the exponent defined by the currency. |
ta_c_rc_ok | Object instance has been created and written to amount. |
ta_c_rc_invalid_argument | amount is null-pointer. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_c_rc_invalid_argument | value is less than 0. |
ta_c_rc_invalid_argument | exponent is less than 0. |
ta_c_rc_out_of_memory | Failed allocating memory. |
ta_e_result_code_t ta_amount_get_currency | ( | ta_object_t | amount, |
ta_e_currency_t * | currency | ||
) |
Currency.
[in] | amount | Object instance of type amount. |
[out] | currency | Pointer to variable to write currency to. |
ta_c_rc_ok | Value written to currency. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | currency is null-pointer. |
ta_e_result_code_t ta_amount_get_decimal_value | ( | ta_object_t | amount, |
double * | value | ||
) |
Amount in major units as double precision floating point value.
[in] | amount | Object instance of type amount. |
[out] | value | Pointer to variable to write value to. |
ta_c_rc_ok | Value written to value. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | value is null-pointer. |
ta_e_result_code_t ta_amount_get_exponent | ( | ta_object_t | amount, |
int * | exponent | ||
) |
Exponent.
[in] | amount | Object instance of type amount. |
[out] | exponent | Pointer to variable to write exponent to. |
ta_c_rc_ok | Value written to exponent. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | exponent is null-pointer. |
ta_e_result_code_t ta_amount_get_value | ( | ta_object_t | amount, |
int64_t * | value | ||
) |
Amount in minor units.
[in] | amount | Object instance of type amount. |
[out] | value | Pointer to variable to write value to. Use ta_amount_get_exponent to get the used exponent. This can be a different exponent than the one defined by the used currency. |
ta_c_rc_ok | Value written to value. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | value is null-pointer. |
ta_e_result_code_t ta_amount_set_currency | ( | ta_object_t | amount, |
ta_e_currency_t | currency | ||
) |
Set currency.
[in] | amount | Object instance of type amount. |
[in] | currency | Currency to set. |
ta_c_rc_ok | Value assigned to amount. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | currency is not a valid value from ta_e_currency_t. |
ta_e_result_code_t ta_amount_set_decimal_value | ( | ta_object_t | amount, |
double | value | ||
) |
Set amount in major units as double precision floating point value.
[in] | amount | Object instance of type amount. |
[in] | value | Value to set. Use ta_amount_get_exponent to get the used exponent. For example with an exponent of 2 values with more than 2 digits after the period will be rounded according to regular mathematical rounding rules. |
ta_c_rc_ok | Value written to value. |
ta_c_rc_invalid_argument | amount is 0 pointer. |
ta_c_rc_out_of_memory | Memory allocation required but failed. |
ta_e_result_code_t ta_amount_set_exponent | ( | ta_object_t | amount, |
int | exponent | ||
) |
Set exponent.
[in] | amount | Object instance of type amount. |
[in] | exponent | Exponent to set. |
ta_c_rc_ok | Value assigned to amount. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | exponent is less than 0. |
ta_e_result_code_t ta_amount_set_value | ( | ta_object_t | amount, |
int64_t | value | ||
) |
Set amount in minor units.
[in] | amount | Object instance of type amount. |
[in] | value | Value to set. Use ta_amount_get_exponent to get the used exponent. This can be a different exponent than the one defined by the used currency. For example with an exponent of 2 to set an amount equal to 1 CHF you have to use a value of 100. |
ta_c_rc_ok | Value assigned to amount. |
ta_c_rc_invalid_argument | amount is ta_object_invalid. |
ta_c_rc_invalid_argument | amount is not of type amount. |
ta_c_rc_invalid_argument | value is less than 0. |