Classes Files

Wombat::MamaPrice

A class for manipulating monetary prices

Inherits from Wombat.MamaWrapper, IComparable

Public Functions

  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.

Protected Functions

  Name
virtual override MamaStatus.mamaStatus DestroyNativePeer()
Implements the destruction of the underlying peer object MamaWrapper.DestroyNativePeer

Additional inherited members

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

Public Functions Documentation

function MamaPrice

MamaPrice()

Constructor

function MamaPrice

MamaPrice(
    MamaPrice price
)

Copy constructor

function destroy

void destroy()

Destroy a mamaPrice object.

function copy

void copy(
    MamaPrice rhs
)

function clear

void clear()

Clear a MamaPrice object.

function add

void add(
    MamaPrice rhs
)

Add a price object

function subtract

void subtract(
    MamaPrice rhs
)

Subtract a price object.

function equal

bool equal(
    MamaPrice rhs
)

Check for equality between two price objects.

function equals

bool equals(
    MamaPrice rhs
)

Synonym of equal

function compare

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.

function setValue

void setValue(
    double val
)

Set the price value only (no hint information).

function setPrecision

void setPrecision(
    mamaPricePrecision precision
)

Set the price precision.

function setHints

void setHints(
    byte hints
)

Set all of the price hints.

function setWithHints

void setWithHints(
    double val,
    byte hints
)

Set the price with hint information.

function setFromString

void setFromString(
    string str
)

Set the price from a string representation, preserving any detectable hints.

function getValue

double getValue()

Get the price value only.

function getPrecision

mamaPricePrecision getPrecision()

Get the price precision.

function getHints

byte getHints()

Get the price hints.

function getWithHints

double getWithHints(
    ref int precision
)

Get the price with special, optional hints.

function getAsString

string getAsString()

Get the price as a string, formatted according to the hints provided.

function ToString

override string ToString()

Return a string representation of the price.

function negate

void negate()

Negate the price value. Hints and precisions are not affected.

function isZero

bool isZero()

Return whether the price has a value equivalent to zero. It may not be exactly 0.0, but we check against +/- epsilon.

function Equals

override bool Equals(
    object obj
)

function CompareTo

int CompareTo(
    object rhs
)

function GetHashCode

override int GetHashCode()

function decimals2Precision

static mamaPricePrecision decimals2Precision(
    int places
)

Return the appropriate precision code for a given number of decimal places.

function denom2Precision

static mamaPricePrecision denom2Precision(
    int denominator
)

Return the appropriate precision code for a given fractional denominator.

function precision2Decimals

static int precision2Decimals(
    int precision
)

Return the number of decimal places for a given precision code.

function precision2Denom

static int precision2Denom(
    int precision
)

Return the fractional denominator for a given precision code.

Protected Functions Documentation

function DestroyNativePeer

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