23 #include <com/avpkit/ferry/RefCounted.h>
24 #include <com/avpkit/core/AVPKit.h>
26 namespace com {
namespace avpkit {
namespace core
97 virtual int32_t
reduce(int64_t num, int64_t den, int64_t max)=0;
108 static int32_t sReduce(
IRational *dst, int64_t num,
109 int64_t den, int64_t max);
227 static IRational *make(int32_t num, int32_t den);
233 typedef enum Rounding {
251 Rounding rounding)=0;
264 static int64_t sRescale(int64_t origValue,
298 static int64_t rescale(int64_t srcValue,
299 int32_t dstNumerator,
300 int32_t dstDenominator,
301 int32_t srcNumerator,
302 int32_t srcDenominator,
This class wraps represents a Rational number for the AVPKit.
virtual double getValue()=0
An alias for getDouble() but matching JavaBean conventions.
virtual int32_t compareTo(IRational *other)=0
Compare a rational to this rational.
virtual IRational * divide(IRational *arg)=0
Divides this rational by arg.
virtual int64_t rescale(int64_t origValue, IRational *origBase)=0
Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this...
virtual int32_t reduce(int64_t num, int64_t den, int64_t max)=0
Reduce a fraction to it's lowest common denominators.
virtual int64_t rescale(int64_t origValue, IRational *origBase, Rounding rounding)=0
Takes a value scaled in increments of origBase and gives the equivalent value scaled in terms of this...
virtual IRational * add(IRational *arg)=0
Adds arg to this rational.
virtual bool isFinalized()=0
Returns true if init() has been called and this object is now considered finalized and immutable.
virtual IRational * copy()=0
Creates a new IRational object by copying (by value) this object.
virtual int32_t getDenominator()=0
Get the denominator for this rational.
virtual IRational * multiply(IRational *arg)=0
Multiplies this number by arg.
virtual void setDenominator(int32_t value)=0
Sets the denominator on this object.
virtual IRational * subtract(IRational *arg)=0
Subtracts arg from this rational.
virtual void setValue(double value)=0
Sets the numerator and denominator on this object by reducing the double to the closest integer numer...
virtual void init()=0
Marks this object as finalized and immutable.
virtual void setNumerator(int32_t value)=0
Sets the numerator on this object.
virtual int32_t getNumerator()=0
Get the numerator for this rational.
virtual double getDouble()=0
Rational to double conversion.
Parent of all Ferry objects – it mains reference counts in native code.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...