Class factory for fixed-point data types Fix and CFix. More...
#include <itpp/fixed/fix_factory.h>
Public Member Functions | |
Fix_Factory (int w=MAX_WORDLEN, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN, Stat *ptr=0) | |
Constructor. | |
virtual | ~Fix_Factory () |
Destructor. | |
operator double () const | |
Conversion operator. Useful in templated code. | |
virtual void | create (Fix *&ptr, const int n) const |
Create an n-length array of Fix. | |
virtual void | create (CFix *&ptr, const int n) const |
Create an n-length array of CFix. | |
Protected Attributes | |
int | wordlen |
Word length. | |
e_mode | emode |
Sign encoding mode. | |
o_mode | omode |
Overflow mode. | |
q_mode | qmode |
Quantization mode. | |
Stat * | stat_ptr |
Pointer to statistics object. | |
Friends | |
class | Fix |
class | CFix |
Class factory for fixed-point data types Fix and CFix.
For an introduction to factories, see the Detailed Description for Factory. For more information on the fixed-point data types, see the Detailed Description in the Fixed-point Module module.
This example shows how to declare a Fix_Factory:
However, the user does not need to declare UFIX32
since it is one of the already declared factories in fix_factory.h (which is included by itbase.h):
This means that it is only necessary for the user to declare a Fix_Factory if it is desired to have some other overflow mode than WRAP
or SAT
, or some other quantization mode than TRN
, or a non-zero statistics object pointer.
The Array/Vec/Mat constructors can take a Fix_Factory as an argument:
Even a Fix/CFix declaration can take a Fix_Factory as a constructor argument:
This syntax is also legal if Fix is replaced with double
and CFix is replaced with complex<double>
, i.e.
which can be useful in templated code, e.g. when the same code should support both floating- and fixed-point data types.
Definition at line 120 of file fix_factory.h.
Generated on Sat May 25 2013 16:32:33 for IT++ by Doxygen 1.8.2