Name | |
---|---|
enum | mamaPricePrecision_ { MAMA_PRICE_PREC_UNKNOWN = 0, MAMA_PRICE_PREC_10 = 1, MAMA_PRICE_PREC_100 = 2, MAMA_PRICE_PREC_1000 = 3, MAMA_PRICE_PREC_10000 = 4, MAMA_PRICE_PREC_100000 = 5, MAMA_PRICE_PREC_1000000 = 6, MAMA_PRICE_PREC_10000000 = 7, MAMA_PRICE_PREC_100000000 = 8, MAMA_PRICE_PREC_1000000000 = 9, MAMA_PRICE_PREC_10000000000 = 10, MAMA_PRICE_PREC_100000000000 = 11, MAMA_PRICE_PREC_1000000000000 = 12, MAMA_PRICE_PREC_10000000000000 = 13, MAMA_PRICE_PREC_100000000000000 = 14, MAMA_PRICE_PREC_1000000000000000 = 15, MAMA_PRICE_PREC_INT = 16, MAMA_PRICE_PREC_DIV_2 = 17, MAMA_PRICE_PREC_DIV_4 = 18, MAMA_PRICE_PREC_DIV_8 = 19, MAMA_PRICE_PREC_DIV_16 = 20, MAMA_PRICE_PREC_DIV_32 = 21, MAMA_PRICE_PREC_DIV_64 = 22, MAMA_PRICE_PREC_DIV_128 = 23, MAMA_PRICE_PREC_DIV_256 = 24, MAMA_PRICE_PREC_DIV_512 = 25, MAMA_PRICE_PREC_TICK_32 = 26, MAMA_PRICE_PREC_HALF_32 = 27, MAMA_PRICE_PREC_QUARTER_32 = 28, MAMA_PRICE_PREC_TICK_64 = 29, MAMA_PRICE_PREC_HALF_64 = 30, MAMA_PRICE_PREC_10000000000000000 = 31, MAMA_PRICE_PREC_CENTS = MAMA_PRICE_PREC_100, MAMA_PRICE_PREC_PENNIES = MAMA_PRICE_PREC_100} |
typedef enum mamaPricePrecision_ | mamaPricePrecision |
typedef mama_u8_t | mamaPriceHints |
Name | |
---|---|
MAMAExpDLL mama_status | mamaPrice_create(mamaPrice * price) |
MAMAExpDLL mama_status | mamaPrice_destroy(mamaPrice price) |
MAMAExpDLL mama_status | mamaPrice_clear(mamaPrice price) |
MAMAExpDLL mama_status | mamaPrice_copy(mamaPrice dest, const mamaPrice src) |
MAMAExpDLL mama_status | mamaPrice_add(mamaPrice dest, const mamaPrice rhs) |
MAMAExpDLL mama_status | mamaPrice_subtract(mamaPrice dest, const mamaPrice rhs) |
MAMAExpDLL int | mamaPrice_equal(const mamaPrice lhs, const mamaPrice rhs) |
MAMAExpDLL double | mamaPrice_compare(const mamaPrice lhs, const mamaPrice rhs) |
MAMAExpDLL mama_status | mamaPrice_setValue(mamaPrice price, double value) |
MAMAExpDLL mama_status | mamaPrice_setPrecision(mamaPrice price, mamaPricePrecision precision) |
MAMAExpDLL mama_status | mamaPrice_setIsValidPrice(mamaPrice price, mama_bool_t valid) |
MAMAExpDLL mama_status | mamaPrice_setHints(mamaPrice price, mamaPriceHints hints) |
MAMAExpDLL mama_status | mamaPrice_setWithHints(mamaPrice price, double value, mamaPriceHints hints) |
MAMAExpDLL mama_status | mamaPrice_setFromString(mamaPrice price, const char * str) |
MAMAExpDLL mama_status | mamaPrice_getValue(const mamaPrice price, double * value) |
MAMAExpDLL mama_status | mamaPrice_getRoundedValue(const mamaPrice price, const mamaPricePrecision precision, double * value) |
MAMAExpDLL mama_status | mamaPrice_getPrecision(const mamaPrice price, mamaPricePrecision * precision) |
MAMAExpDLL mama_status | mamaPrice_getIsValidPrice(const mamaPrice price, mama_bool_t * valid) |
MAMAExpDLL mama_status | mamaPrice_getHints(const mamaPrice price, mamaPriceHints * hints) |
MAMAExpDLL mama_status | mamaPrice_getWithHints(const mamaPrice price, double * value, mamaPricePrecision * precision) |
MAMAExpDLL mama_status | mamaPrice_getAsString(const mamaPrice price, char * str, mama_size_t maxLen) |
MAMAExpDLL mama_status | mamaPrice_negate(mamaPrice price) |
MAMAExpDLL mama_status | mamaPrice_isZero(const mamaPrice price, mama_bool_t * result) |
MAMAExpDLL mamaPricePrecision | mamaPrice_decimals2Precision(mama_i32_t places) |
MAMAExpDLL mamaPricePrecision | mamaPrice_denom2Precision(mama_i32_t denominator) |
MAMAExpDLL mama_i32_t | mamaPrice_precision2Decimals(mamaPricePrecision precision) |
MAMAExpDLL mama_i32_t | mamaPrice_precision2Denom(mamaPricePrecision precision) |
Name | |
---|---|
MAMA_PRICE_HINTS_NONE | |
MAMA_PRICE_MAX_STR_LEN | |
MAMA_PRICE_EPSILON |
Enumerator | Value | Description |
---|---|---|
MAMA_PRICE_PREC_UNKNOWN | 0 | |
MAMA_PRICE_PREC_10 | 1 | |
MAMA_PRICE_PREC_100 | 2 | |
MAMA_PRICE_PREC_1000 | 3 | |
MAMA_PRICE_PREC_10000 | 4 | |
MAMA_PRICE_PREC_100000 | 5 | |
MAMA_PRICE_PREC_1000000 | 6 | |
MAMA_PRICE_PREC_10000000 | 7 | |
MAMA_PRICE_PREC_100000000 | 8 | |
MAMA_PRICE_PREC_1000000000 | 9 | |
MAMA_PRICE_PREC_10000000000 | 10 | |
MAMA_PRICE_PREC_100000000000 | 11 | |
MAMA_PRICE_PREC_1000000000000 | 12 | |
MAMA_PRICE_PREC_10000000000000 | 13 | |
MAMA_PRICE_PREC_100000000000000 | 14 | |
MAMA_PRICE_PREC_1000000000000000 | 15 | |
MAMA_PRICE_PREC_INT | 16 | |
MAMA_PRICE_PREC_DIV_2 | 17 | |
MAMA_PRICE_PREC_DIV_4 | 18 | |
MAMA_PRICE_PREC_DIV_8 | 19 | |
MAMA_PRICE_PREC_DIV_16 | 20 | |
MAMA_PRICE_PREC_DIV_32 | 21 | |
MAMA_PRICE_PREC_DIV_64 | 22 | |
MAMA_PRICE_PREC_DIV_128 | 23 | |
MAMA_PRICE_PREC_DIV_256 | 24 | |
MAMA_PRICE_PREC_DIV_512 | 25 | |
MAMA_PRICE_PREC_TICK_32 | 26 | |
MAMA_PRICE_PREC_HALF_32 | 27 | |
MAMA_PRICE_PREC_QUARTER_32 | 28 | |
MAMA_PRICE_PREC_TICK_64 | 29 | |
MAMA_PRICE_PREC_HALF_64 | 30 | |
MAMA_PRICE_PREC_10000000000000000 | 31 | |
MAMA_PRICE_PREC_CENTS | MAMA_PRICE_PREC_100 | |
MAMA_PRICE_PREC_PENNIES | MAMA_PRICE_PREC_100 |
typedef enum mamaPricePrecision_ mamaPricePrecision;
typedef mama_u8_t mamaPriceHints;
MAMAExpDLL mama_status mamaPrice_create(
mamaPrice * price
)
Parameters:
Create a mamaPrice object.
MAMAExpDLL mama_status mamaPrice_destroy(
mamaPrice price
)
Parameters:
Destroy a mamaPrice object.
MAMAExpDLL mama_status mamaPrice_clear(
mamaPrice price
)
Parameters:
Clear a mamaPrice object.
MAMAExpDLL mama_status mamaPrice_copy(
mamaPrice dest,
const mamaPrice src
)
Parameters:
Copy a price object. The destination object must have already been allocated using mamaPrice_create().
MAMAExpDLL mama_status mamaPrice_add(
mamaPrice dest,
const mamaPrice rhs
)
Parameters:
Add to a price object. The destination object must have already been allocated using mamaPrice_create().
MAMAExpDLL mama_status mamaPrice_subtract(
mamaPrice dest,
const mamaPrice rhs
)
Parameters:
Subtract from a price object. The destination object must have already been allocated using mamaPrice_create().
MAMAExpDLL int mamaPrice_equal(
const mamaPrice lhs,
const mamaPrice rhs
)
Parameters:
Check for equality between two price objects.
MAMAExpDLL double mamaPrice_compare(
const mamaPrice lhs,
const mamaPrice rhs
)
Parameters:
Compare two price objects. The return value is negative if lhs is earlier than rhs, positive if lhs is greater than rhs and zero if the two are equal.
MAMAExpDLL mama_status mamaPrice_setValue(
mamaPrice price,
double value
)
Parameters:
Set the price value only (no hint information).
MAMAExpDLL mama_status mamaPrice_setPrecision(
mamaPrice price,
mamaPricePrecision precision
)
Parameters:
Set the price precision.
MAMAExpDLL mama_status mamaPrice_setIsValidPrice(
mamaPrice price,
mama_bool_t valid
)
Parameters:
Set if price contains a valid value. (0 may be a valid value)
MAMAExpDLL mama_status mamaPrice_setHints(
mamaPrice price,
mamaPriceHints hints
)
Parameters:
Set all of the price hints.
MAMAExpDLL mama_status mamaPrice_setWithHints(
mamaPrice price,
double value,
mamaPriceHints hints
)
Parameters:
Set the price with hint information.
MAMAExpDLL mama_status mamaPrice_setFromString(
mamaPrice price,
const char * str
)
Parameters:
Set the price from a string representation, preserving any detectable hints.
MAMAExpDLL mama_status mamaPrice_getValue(
const mamaPrice price,
double * value
)
Parameters:
Get the price value only.
MAMAExpDLL mama_status mamaPrice_getRoundedValue(
const mamaPrice price,
const mamaPricePrecision precision,
double * value
)
Parameters:
Return: Indicates whether the function succeeded or failed and could be one of:
This function obtains the double value of a price rounded to the supplied precision.
MAMAExpDLL mama_status mamaPrice_getPrecision(
const mamaPrice price,
mamaPricePrecision * precision
)
Parameters:
Get the price precision.
MAMAExpDLL mama_status mamaPrice_getIsValidPrice(
const mamaPrice price,
mama_bool_t * valid
)
Parameters:
Check if price contains a valid value.
MAMAExpDLL mama_status mamaPrice_getHints(
const mamaPrice price,
mamaPriceHints * hints
)
Parameters:
Return: Indicates whether the function succeeded or failed and could be one of:
Note: This function is intended for internal use only.
Get the price hints.
MAMAExpDLL mama_status mamaPrice_getWithHints(
const mamaPrice price,
double * value,
mamaPricePrecision * precision
)
Parameters:
Get the price with special, optional hints.
MAMAExpDLL mama_status mamaPrice_getAsString(
const mamaPrice price,
char * str,
mama_size_t maxLen
)
Parameters:
Get the price as a string, formatted according to the hints provided.
MAMAExpDLL mama_status mamaPrice_negate(
mamaPrice price
)
Negate the price value. Hints and precisions are not affected.
MAMAExpDLL mama_status mamaPrice_isZero(
const mamaPrice price,
mama_bool_t * result
)
Return whether the price has a value equivalent to zero. It may not be exactly 0.0, but we check against +/- epsilon.
MAMAExpDLL mamaPricePrecision mamaPrice_decimals2Precision(
mama_i32_t places
)
Return the appropriate precision code for a given number of decimal places.
MAMAExpDLL mamaPricePrecision mamaPrice_denom2Precision(
mama_i32_t denominator
)
Return the appropriate precision code for a given fractional denominator.
MAMAExpDLL mama_i32_t mamaPrice_precision2Decimals(
mamaPricePrecision precision
)
Return the number of decimal places for a given precision code.
MAMAExpDLL mama_i32_t mamaPrice_precision2Denom(
mamaPricePrecision precision
)
Return the fractional denominator for a given precision code.
#define MAMA_PRICE_HINTS_NONE ((mamaPriceHints)0x00)
#define MAMA_PRICE_MAX_STR_LEN (32)
#define MAMA_PRICE_EPSILON ((mama_f64_t)0.00000000001)
MAMA_PRICE_EPSILON a value that is considered equivalent to zero.
/* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef MamaPriceH__
#define MamaPriceH__
#include <mama/config.h>
#include <mama/status.h>
#include <mama/types.h>
#if defined(__cplusplus)
extern "C" {
#endif
typedef enum mamaPricePrecision_
{
MAMA_PRICE_PREC_UNKNOWN = 0,
MAMA_PRICE_PREC_10 = 1,
MAMA_PRICE_PREC_100 = 2,
MAMA_PRICE_PREC_1000 = 3,
MAMA_PRICE_PREC_10000 = 4,
MAMA_PRICE_PREC_100000 = 5,
MAMA_PRICE_PREC_1000000 = 6,
MAMA_PRICE_PREC_10000000 = 7,
MAMA_PRICE_PREC_100000000 = 8,
MAMA_PRICE_PREC_1000000000 = 9,
MAMA_PRICE_PREC_10000000000 = 10,
MAMA_PRICE_PREC_100000000000 = 11,
MAMA_PRICE_PREC_1000000000000 = 12,
MAMA_PRICE_PREC_10000000000000 = 13,
MAMA_PRICE_PREC_100000000000000 = 14,
MAMA_PRICE_PREC_1000000000000000 = 15,
MAMA_PRICE_PREC_INT = 16,
MAMA_PRICE_PREC_DIV_2 = 17,
MAMA_PRICE_PREC_DIV_4 = 18,
MAMA_PRICE_PREC_DIV_8 = 19,
MAMA_PRICE_PREC_DIV_16 = 20,
MAMA_PRICE_PREC_DIV_32 = 21,
MAMA_PRICE_PREC_DIV_64 = 22,
MAMA_PRICE_PREC_DIV_128 = 23,
MAMA_PRICE_PREC_DIV_256 = 24,
MAMA_PRICE_PREC_DIV_512 = 25,
MAMA_PRICE_PREC_TICK_32 = 26,
MAMA_PRICE_PREC_HALF_32 = 27,
MAMA_PRICE_PREC_QUARTER_32 = 28,
MAMA_PRICE_PREC_TICK_64 = 29,
MAMA_PRICE_PREC_HALF_64 = 30,
MAMA_PRICE_PREC_10000000000000000 = 31,
MAMA_PRICE_PREC_CENTS = MAMA_PRICE_PREC_100,
MAMA_PRICE_PREC_PENNIES = MAMA_PRICE_PREC_100
} mamaPricePrecision;
typedef mama_u8_t mamaPriceHints;
#define MAMA_PRICE_HINTS_NONE ((mamaPriceHints)0x00)
#define MAMA_PRICE_MAX_STR_LEN (32)
#define MAMA_PRICE_EPSILON ((mama_f64_t)0.00000000001)
MAMAExpDLL
extern mama_status
mamaPrice_create (mamaPrice* price);
MAMAExpDLL
extern mama_status
mamaPrice_destroy (mamaPrice price);
MAMAExpDLL
extern mama_status
mamaPrice_clear (mamaPrice price);
MAMAExpDLL
extern mama_status
mamaPrice_copy (mamaPrice dest,
const mamaPrice src);
MAMAExpDLL
extern mama_status
mamaPrice_add (mamaPrice dest,
const mamaPrice rhs);
MAMAExpDLL
extern mama_status
mamaPrice_subtract (mamaPrice dest,
const mamaPrice rhs);
MAMAExpDLL
extern int
mamaPrice_equal (const mamaPrice lhs,
const mamaPrice rhs);
MAMAExpDLL
extern double
mamaPrice_compare (const mamaPrice lhs,
const mamaPrice rhs);
MAMAExpDLL
extern mama_status
mamaPrice_setValue (mamaPrice price,
double value);
MAMAExpDLL
extern mama_status
mamaPrice_setPrecision (mamaPrice price,
mamaPricePrecision precision);
MAMAExpDLL
extern mama_status
mamaPrice_setIsValidPrice (mamaPrice price,
mama_bool_t valid);
MAMAExpDLL
extern mama_status
mamaPrice_setHints (mamaPrice price,
mamaPriceHints hints);
MAMAExpDLL
extern mama_status
mamaPrice_setWithHints (mamaPrice price,
double value,
mamaPriceHints hints);
MAMAExpDLL
extern mama_status
mamaPrice_setFromString(mamaPrice price,
const char* str);
MAMAExpDLL
extern mama_status
mamaPrice_getValue(const mamaPrice price,
double* value);
MAMAExpDLL
mama_status
mamaPrice_getRoundedValue(const mamaPrice price,
const mamaPricePrecision precision,
double* value);
MAMAExpDLL
extern mama_status
mamaPrice_getPrecision(const mamaPrice price,
mamaPricePrecision* precision);
MAMAExpDLL
extern mama_status
mamaPrice_getIsValidPrice (const mamaPrice price,
mama_bool_t* valid);
MAMAExpDLL
extern mama_status
mamaPrice_getHints(const mamaPrice price,
mamaPriceHints* hints);
MAMAExpDLL
extern mama_status
mamaPrice_getWithHints(const mamaPrice price,
double* value,
mamaPricePrecision* precision);
MAMAExpDLL
extern mama_status
mamaPrice_getAsString(const mamaPrice price,
char* str,
mama_size_t maxLen);
MAMAExpDLL
extern mama_status
mamaPrice_negate(mamaPrice price);
MAMAExpDLL
extern mama_status
mamaPrice_isZero(const mamaPrice price,
mama_bool_t* result);
MAMAExpDLL
extern mamaPricePrecision
mamaPrice_decimals2Precision (mama_i32_t places);
MAMAExpDLL
extern mamaPricePrecision
mamaPrice_denom2Precision (mama_i32_t denominator);
MAMAExpDLL
extern mama_i32_t
mamaPrice_precision2Decimals (mamaPricePrecision precision);
MAMAExpDLL
extern mama_i32_t
mamaPrice_precision2Denom (mamaPricePrecision precision);
#if defined(__cplusplus)
}
#endif
#endif
Updated on 2023-03-31 at 15:29:16 +0100