A class for manipulating monetary prices
Inherits from Wombat.MamaWrapper, IComparable
Name | |
---|---|
MamaPrice() Constructor |
|
MamaPrice(MamaPrice price) Copy constructor |
|
void | destroy() Destroy a mamaPrice object. |
void | copy(MamaPrice rhs) |
void | clear() Clear a MamaPrice object. |
void | add(MamaPrice rhs) Add a price object |
void | subtract(MamaPrice rhs) Subtract a price object. |
bool | equal(MamaPrice rhs) Check for equality between two price objects. |
bool | equals(MamaPrice rhs) Synonym of equal |
double | compare(MamaPrice rhs) 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. |
void | setValue(double val) Set the price value only (no hint information). |
void | setPrecision(mamaPricePrecision precision) Set the price precision. |
void | setHints(byte hints) Set all of the price hints. |
void | setWithHints(double val, byte hints) Set the price with hint information. |
void | setFromString(string str) Set the price from a string representation, preserving any detectable hints. |
double | getValue() Get the price value only. |
mamaPricePrecision | getPrecision() Get the price precision. |
byte | getHints() Get the price hints. |
double | getWithHints(ref int precision) Get the price with special, optional hints. |
string | getAsString() Get the price as a string, formatted according to the hints provided. |
override string | ToString() Return a string representation of the price. |
void | negate() Negate the price value. Hints and precisions are not affected. |
bool | isZero() Return whether the price has a value equivalent to zero. It may not be exactly 0.0, but we check against +/- epsilon. |
override bool | Equals(object obj) |
int | CompareTo(object rhs) |
override int | GetHashCode() |
mamaPricePrecision | decimals2Precision(int places) Return the appropriate precision code for a given number of decimal places. |
mamaPricePrecision | denom2Precision(int denominator) Return the appropriate precision code for a given fractional denominator. |
int | precision2Decimals(int precision) Return the number of decimal places for a given precision code. |
int | precision2Denom(int precision) Return the fractional denominator for a given precision code. |
Name | |
---|---|
virtual override MamaStatus.mamaStatus | DestroyNativePeer() Implements the destruction of the underlying peer object MamaWrapper.DestroyNativePeer |
Public Functions inherited from Wombat.MamaWrapper
Name | |
---|---|
void | Dispose() Destroys the underlying peer object and unbinds the wrapper from it. |
void | setNativeHandle(IntPtr nHandle) Sets the native handle of the native peer object. Should only be used by subclasses and in the same assembly. |
Protected Functions inherited from Wombat.MamaWrapper
Name | |
---|---|
MamaWrapper() Constructs a new wrapper object but doesn’t create it. If the object is not explicitly disposed it will remain registered for finalization and will attempt the destroy the native peer object when finalized. |
|
MamaWrapper(IntPtr nativeHandle) Constructs a managed wrapper from an existing native peer. The peer object will not be automatically finalized |
|
virtual void | Dispose(bool disposing, bool destroyNativeHandle =true) The actual implementation of Dispose - called by both the Dispose method and the finalizer. |
virtual void | OnDispose() |
Protected Attributes inherited from Wombat.MamaWrapper
Name | |
---|---|
IntPtr | nativeHandle the handle to the native peer object |
MamaPrice()
Constructor
MamaPrice(
MamaPrice price
)
Copy constructor
void destroy()
Destroy a mamaPrice object.
void copy(
MamaPrice rhs
)
void clear()
Clear a MamaPrice object.
void add(
MamaPrice rhs
)
Add a price object
void subtract(
MamaPrice rhs
)
Subtract a price object.
bool equal(
MamaPrice rhs
)
Check for equality between two price objects.
bool equals(
MamaPrice rhs
)
Synonym of equal
double compare(
MamaPrice rhs
)
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.
void setValue(
double val
)
Set the price value only (no hint information).
void setPrecision(
mamaPricePrecision precision
)
Set the price precision.
void setHints(
byte hints
)
Set all of the price hints.
void setWithHints(
double val,
byte hints
)
Set the price with hint information.
void setFromString(
string str
)
Set the price from a string representation, preserving any detectable hints.
double getValue()
Get the price value only.
mamaPricePrecision getPrecision()
Get the price precision.
byte getHints()
Get the price hints.
double getWithHints(
ref int precision
)
Get the price with special, optional hints.
string getAsString()
Get the price as a string, formatted according to the hints provided.
override string ToString()
Return a string representation of the price.
void negate()
Negate the price value. Hints and precisions are not affected.
bool isZero()
Return whether the price has a value equivalent to zero. It may not be exactly 0.0, but we check against +/- epsilon.
override bool Equals(
object obj
)
int CompareTo(
object rhs
)
override int GetHashCode()
static mamaPricePrecision decimals2Precision(
int places
)
Return the appropriate precision code for a given number of decimal places.
static mamaPricePrecision denom2Precision(
int denominator
)
Return the appropriate precision code for a given fractional denominator.
static int precision2Decimals(
int precision
)
Return the number of decimal places for a given precision code.
static int precision2Denom(
int precision
)
Return the fractional denominator for a given precision code.
virtual override MamaStatus.mamaStatus DestroyNativePeer()
Implements the destruction of the underlying peer object MamaWrapper.DestroyNativePeer
Return: MAMA Status code
Reimplements: Wombat::MamaWrapper::DestroyNativePeer
Updated on 2023-03-31 at 15:29:32 +0100