#ifndef _h_FixPt_
#define _h_FixPt_
#include "FMXClient.h"
extern "C++"
{
namespace fmx
{
class FixPt
{
public:
enum
{
kDefltFixedPrecision = 16
};
inline void AssignInt ( fmx::int32 that );
inline void AssignDouble ( double that );
inline void AssignFixPt ( const FixPt &that );
inline bool operator == ( const FixPt &that ) const;
inline bool operator != ( const FixPt &that ) const;
inline bool operator < ( const FixPt &that ) const;
inline bool operator <= ( const FixPt &that ) const;
inline bool operator > ( const FixPt &that ) const;
inline bool operator >= ( const FixPt &that ) const;
inline void Increment ( fmx::int32 n );
inline void Decrement ( fmx::int32 n );
inline void Negate ();
inline int GetPrecision () const;
inline void SetPrecision ( int precision );
inline void Add ( const FixPt &arg, FixPt &result ) const;
inline void Subtract ( const FixPt &arg, FixPt &result ) const;
inline void Multiply ( const FixPt &arg, FixPt &result ) const;
inline fmx::errcode Divide ( const FixPt &arg, FixPt &result ) const;
inline bool AsBool () const;
inline fmx::int32 AsLong () const;
inline double AsFloat () const;
inline void AssignInt64 ( fmx::int64 that );
inline void Increment64 ( fmx::int64 n );
inline void Decrement64 ( fmx::int64 n );
inline fmx::int64 AsLong64 () const;
inline void operator delete ( void *obj );
private:
FixPt ();
FixPt ( const FixPt &other );
};
#if FMX_USE_AUTO_PTR
class DEPRECATED FixPtAutoPtr : public std::auto_ptr<FixPt>
{
typedef FixPtAutoPtr UpCaster;
public:
inline FixPtAutoPtr ( fmx::int32 val = 0, int precision = FixPt::kDefltFixedPrecision );
inline FixPtAutoPtr ( fmx::int32 val, const FixPt &precisionExample );
};
#endif
#if FMX_USE_UNIQUE_PTR
class FixPtUniquePtr : public std::unique_ptr<FixPt>
{
typedef FixPtUniquePtr UpCaster;
public:
inline FixPtUniquePtr ( fmx::int32 val = 0, int precision = FixPt::kDefltFixedPrecision );
inline FixPtUniquePtr ( fmx::int32 val, const FixPt &precisionExample );
};
#endif
}
}
extern "C"
{
fmx::FixPt FMX_API *FM_FixPt_Constructor1 ( fmx::int32 val, int precision, fmx::_fmxcpt &_x ) throw ();
fmx::FixPt FMX_API *FM_FixPt_Constructor2 ( fmx::int32 val, const fmx::FixPt &precisionExample, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_AssignInt ( void *_self, fmx::int32 that, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_AssignInt64 ( void *_self, fmx::int64 that, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_AssignDouble ( void *_self, double that, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_AssignFixPt ( void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_operatorEQ ( const void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_operatorNE ( const void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_operatorLT ( const void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_operatorLE ( const void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_operatorGT ( const void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_operatorGE ( const void *_self, const fmx::FixPt &that, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Increment ( void *_self, fmx::int32 n, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Increment64 ( void *_self, fmx::int64 n, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Decrement ( void *_self, fmx::int32 n, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Decrement64 ( void *_self, fmx::int64 n, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Negate ( void *_self, fmx::_fmxcpt &_x ) throw ();
int FMX_API FM_FixPt_GetPrecision ( const void *_self, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_SetPrecision ( void *_self, int precision, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Add ( const void *_self, const fmx::FixPt &arg, fmx::FixPt &result, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Subtract ( const void *_self, const fmx::FixPt &arg, fmx::FixPt &result, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Multiply ( const void *_self, const fmx::FixPt &arg, fmx::FixPt &result, fmx::_fmxcpt &_x ) throw ();
fmx::errcode FMX_API FM_FixPt_Divide ( const void *_self, const fmx::FixPt &arg, fmx::FixPt &result, fmx::_fmxcpt &_x ) throw ();
bool FMX_API FM_FixPt_AsBool ( const void *_self, fmx::_fmxcpt &_x ) throw ();
fmx::int32 FMX_API FM_FixPt_AsLong ( const void *_self, fmx::_fmxcpt &_x ) throw ();
fmx::int64 FMX_API FM_FixPt_AsLong64 ( const void *_self, fmx::_fmxcpt &_x ) throw ();
double FMX_API FM_FixPt_AsFloat ( const void *_self, fmx::_fmxcpt &_x ) throw ();
void FMX_API FM_FixPt_Delete ( void *_self, fmx::_fmxcpt &_x ) throw ();
}
extern "C++"
{
namespace fmx
{
inline void FixPt::AssignInt ( fmx::int32 that )
{
_fmxcpt _x;
FM_FixPt_AssignInt ( this, that, _x );
_x.Check ();
}
inline void FixPt::AssignInt64 ( fmx::int64 that )
{
_fmxcpt _x;
FM_FixPt_AssignInt64 ( this, that, _x );
_x.Check ();
}
inline void FixPt::AssignDouble ( double that )
{
_fmxcpt _x;
FM_FixPt_AssignDouble ( this, that, _x );
_x.Check ();
}
inline void FixPt::AssignFixPt ( const FixPt &that )
{
_fmxcpt _x;
FM_FixPt_AssignFixPt ( this, that, _x );
_x.Check ();
}
inline bool FixPt::operator == ( const FixPt &that ) const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_operatorEQ ( this, that, _x );
_x.Check ();
return _rtn;
}
inline bool FixPt::operator != ( const FixPt &that ) const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_operatorNE ( this, that, _x );
_x.Check ();
return _rtn;
}
inline bool FixPt::operator < ( const FixPt &that ) const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_operatorLT ( this, that, _x );
_x.Check ();
return _rtn;
}
inline bool FixPt::operator <= ( const FixPt &that ) const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_operatorLE ( this, that, _x );
_x.Check ();
return _rtn;
}
inline bool FixPt::operator > ( const FixPt &that ) const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_operatorGT ( this, that, _x );
_x.Check ();
return _rtn;
}
inline bool FixPt::operator >= ( const FixPt &that ) const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_operatorGE ( this, that, _x );
_x.Check ();
return _rtn;
}
inline void FixPt::Increment ( fmx::int32 n )
{
_fmxcpt _x;
FM_FixPt_Increment ( this, n, _x );
_x.Check ();
}
inline void FixPt::Increment64 ( fmx::int64 n )
{
_fmxcpt _x;
FM_FixPt_Increment64 ( this, n, _x );
_x.Check ();
}
inline void FixPt::Decrement ( fmx::int32 n )
{
_fmxcpt _x;
FM_FixPt_Decrement ( this, n, _x );
_x.Check ();
}
inline void FixPt::Decrement64 ( fmx::int64 n )
{
_fmxcpt _x;
FM_FixPt_Decrement64 ( this, n, _x );
_x.Check ();
}
inline void FixPt::Negate ()
{
_fmxcpt _x;
FM_FixPt_Negate ( this, _x );
_x.Check ();
}
inline int FixPt::GetPrecision () const
{
_fmxcpt _x;
int _rtn = FM_FixPt_GetPrecision ( this, _x );
_x.Check ();
return _rtn;
}
inline void FixPt::SetPrecision ( int precision )
{
_fmxcpt _x;
FM_FixPt_SetPrecision ( this, precision, _x );
_x.Check ();
}
inline void FixPt::Add ( const FixPt &arg, FixPt &result ) const
{
_fmxcpt _x;
FM_FixPt_Add ( this, arg, result, _x );
_x.Check ();
}
inline void FixPt::Subtract ( const FixPt &arg, FixPt &result ) const
{
_fmxcpt _x;
FM_FixPt_Subtract ( this, arg, result, _x );
_x.Check ();
}
inline void FixPt::Multiply ( const FixPt &arg, FixPt &result ) const
{
_fmxcpt _x;
FM_FixPt_Multiply ( this, arg, result, _x );
_x.Check ();
}
inline errcode FixPt::Divide ( const FixPt &arg, FixPt &result ) const
{
_fmxcpt _x;
errcode _rtn = FM_FixPt_Divide ( this, arg, result, _x );
_x.Check ();
return _rtn;
}
inline bool FixPt::AsBool () const
{
_fmxcpt _x;
bool _rtn = FM_FixPt_AsBool ( this, _x );
_x.Check ();
return _rtn;
}
inline fmx::int32 FixPt::AsLong () const
{
_fmxcpt _x;
fmx::int32 _rtn = FM_FixPt_AsLong ( this, _x );
_x.Check ();
return _rtn;
}
inline fmx::int64 FixPt::AsLong64 () const
{
_fmxcpt _x;
fmx::int64 _rtn = FM_FixPt_AsLong64 ( this, _x );
_x.Check ();
return _rtn;
}
inline double FixPt::AsFloat () const
{
_fmxcpt _x;
double _rtn = FM_FixPt_AsFloat ( this, _x );
_x.Check ();
return _rtn;
}
inline void FixPt::operator delete ( void *obj )
{
_fmxcpt _x;
FM_FixPt_Delete ( obj, _x );
_x.Check ();
}
#if FMX_USE_AUTO_PTR
inline FixPtAutoPtr::FixPtAutoPtr ( fmx::int32 val, int precision )
{
_fmxcpt _x;
reset ( FM_FixPt_Constructor1 ( val, precision, _x ) );
_x.Check ();
}
inline FixPtAutoPtr::FixPtAutoPtr ( fmx::int32 val, const FixPt &precisionExample )
{
_fmxcpt _x;
reset ( FM_FixPt_Constructor2 ( val, precisionExample, _x ) );
_x.Check ();
}
#endif
#if FMX_USE_UNIQUE_PTR
inline FixPtUniquePtr::FixPtUniquePtr ( fmx::int32 val, int precision )
{
_fmxcpt _x;
reset ( FM_FixPt_Constructor1 ( val, precision, _x ) );
_x.Check ();
}
inline FixPtUniquePtr::FixPtUniquePtr ( fmx::int32 val, const FixPt &precisionExample )
{
_fmxcpt _x;
reset ( FM_FixPt_Constructor2 ( val, precisionExample, _x ) );
_x.Check ();
}
#endif
}
}
#endif