GCGlib
0.04.228
GCG Graphics Engine
|
Class for 1D signal definition and processing. More...
#include <gcg.h>
Public Member Functions | |
gcgDISCRETE1D () | |
Constructs a valid but empty unidimensional signal. The signal can be used as destiny in any gcgDISCRETE1D<NUMTYPE> method. More... | |
gcgDISCRETE1D (unsigned int length, int origin, NUMTYPE *sampledata=NULL, bool isstaticdata=false, int borderextension=GCG_BORDER_EXTENSION_CLAMP) | |
Constructs a valid unidimensional signal and allocates its resources by calling createSignal(). More... | |
virtual | ~gcgDISCRETE1D () |
Frees all signal resources by calling destroySignal(). More... | |
bool | createSignal (unsigned int length, int origin, NUMTYPE *sampledata=NULL, bool isstaticdata=false, int borderextension=GCG_BORDER_EXTENSION_CLAMP) |
Unidimensional creation. Allocates all necessary space for the signal indicated by the parameters. More... | |
bool | destroySignal () |
Releases all resources used by the signal. After destroyed, the signal becomes invalid and must be recreated. More... | |
bool | createSimilar (gcgDISCRETE1D< float > *source) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source. More... | |
bool | createSimilar (gcgDISCRETE1D< double > *source) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source. More... | |
bool | createSimilar (gcgDISCRETE1D< short > *source) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source. More... | |
bool | createSimilar (gcgDISCRETE1D< int > *source) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source. More... | |
bool | createSimilar (gcgDISCRETE1D< long > *source) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source. More... | |
Public Member Functions inherited from gcgCLASS | |
void * | operator new (size_t size) |
Defines a new operator to be used by instatiations of GCGlib classes instead the global one. More... | |
void * | operator new (size_t size, const std::nothrow_t &) throw () |
Defines a new operator to be used by instantiations of GCGlib classes instead the global one. Returns a NULL pointer instead of throwing an exception if an error occurs. More... | |
void * | operator new[] (size_t size) |
Defines a new operator to be used by GCGlib array allocations instead the global one. More... | |
void * | operator new[] (size_t size, const std::nothrow_t &) throw () |
Defines a new operator to be used by vector allocations instead the global one. More... | |
void | operator delete (void *p) |
Defines a delete operator to free instances of GCGlib classes instead the global one. It is designed to match the new operator. More... | |
void | operator delete (void *p, const std::nothrow_t &) throw () |
Defines a delete operator to free instances of GCGlib classes instead the global one. It is designed to match the new operator. More... | |
void | operator delete[] (void *p) |
Defines a delete operator to free instances of arrays for GCGlib classes instead the global one. It is designed to match the new[] operator. More... | |
void | operator delete[] (void *p, const std::nothrow_t &) throw () |
Defines a delete operator to free instances of arrays for GCGlib classes instead the global one. It is designed to match the new[] operator. More... | |
Public Attributes | |
NUMTYPE * | data |
Pointer to the signal samples. | |
unsigned int | length |
Signal length = number of samples. | |
bool | isstaticdata |
True if the data pointer data must not be deleted by this object. | |
int | origin |
Origin coordinate: indicates the sample position of the origin (x = 0) of the signal. | |
int | extension |
Defines the way the borders have to be extended. | |
Class for 1D signal definition and processing.
NUMTYPE | Type of the samples representing the signal. Supported types: float, double, long, int and short. |
gcgDISCRETE1D< NUMTYPE >::gcgDISCRETE1D | ( | ) |
Constructs a valid but empty unidimensional signal. The signal can be used as destiny in any gcgDISCRETE1D<NUMTYPE> method.
gcgDISCRETE1D< NUMTYPE >::gcgDISCRETE1D | ( | unsigned int | length, |
int | origin, | ||
NUMTYPE * | sampledata = NULL , |
||
bool | isstaticdata = false , |
||
int | borderextension = GCG_BORDER_EXTENSION_CLAMP |
||
) |
Constructs a valid unidimensional signal and allocates its resources by calling createSignal().
[in] | length | signal length or number of samples. It must be non-zero. |
[in] | origin | sample position indicating the origin of the signal. |
[in] | sampledata | pointer to a memory block with at least length elements of NUMTYPE that must be used as the data buffer by all methods. If NULL, a new data block is allocated. If it is static, set isstaticdata as true to indicate that it must not be deleted upon instance destruction. |
[in] | isstaticdata | if true, indicates that the sampledata pointer must not be deleted upon object destruction. If false, the sampledata will be deleted whenever necessary. |
[in] | borderextension | indicates the border extension mode for sample accesses outside the signal limits. It must be GCG_BORDER_EXTENSION_ZERO, GCG_BORDER_EXTENSION_CLAMP, GCG_BORDER_EXTENSION_PERIODIC, GCG_BORDER_EXTENSION_SYMMETRIC_NOREPEAT or GCG_BORDER_EXTENSION_SYMMETRIC_REPEAT. |
|
virtual |
Frees all signal resources by calling destroySignal().
bool gcgDISCRETE1D< NUMTYPE >::createSignal | ( | unsigned int | length, |
int | origin, | ||
NUMTYPE * | sampledata = NULL , |
||
bool | isstaticdata = false , |
||
int | borderextension = GCG_BORDER_EXTENSION_CLAMP |
||
) |
Unidimensional creation. Allocates all necessary space for the signal indicated by the parameters.
[in] | length | signal length or number of samples. It must be non-zero. |
[in] | origin | sample position indicating the origin of the signal. |
[in] | sampledata | pointer to a memory block with at least length elements of NUMTYPE that must be used as the data buffer by all methods. If NULL, a new data block is allocated. Set isstaticdata as true to indicate that it must not be deleted upon instance destruction. |
[in] | isstaticdata | if true, indicates that the sampledata pointer must not be deleted upon object destruction. If false, the sampledata will be deleted whenever necessary. |
[in] | borderextension | indicates the border extension mode for sample accesses outside the signal limits. It must be GCG_BORDER_EXTENSION_ZERO, GCG_BORDER_EXTENSION_CLAMP, GCG_BORDER_EXTENSION_PERIODIC, GCG_BORDER_EXTENSION_SYMMETRIC_NOREPEAT or GCG_BORDER_EXTENSION_SYMMETRIC_REPEAT. |
bool gcgDISCRETE1D< NUMTYPE >::createSimilar | ( | gcgDISCRETE1D< float > * | source | ) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source.
[in] | source | pointer to the source signal. It must be non null. A warning is issued if it is not a valid signal. The destiny signal receives all attributes of the source signal: length, origin and border extension. The gcgDISCRETE1D::data is allocated but not copied. |
bool gcgDISCRETE1D< NUMTYPE >::createSimilar | ( | gcgDISCRETE1D< double > * | source | ) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source.
[in] | source | pointer to the source signal. It must be non null. A warning is issued if it is not a valid signal. The destiny signal receives all attributes of the source signal: length, origin and border extension. The gcgDISCRETE1D::data is allocated but not copied. |
bool gcgDISCRETE1D< NUMTYPE >::createSimilar | ( | gcgDISCRETE1D< short > * | source | ) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source.
[in] | source | pointer to the source signal. It must be non null. A warning is issued if it is not a valid signal. The destiny signal receives all attributes of the source signal: length, origin and border extension. The gcgDISCRETE1D::data is allocated but not copied. |
bool gcgDISCRETE1D< NUMTYPE >::createSimilar | ( | gcgDISCRETE1D< int > * | source | ) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source.
[in] | source | pointer to the source signal. It must be non null. A warning is issued if it is not a valid signal. The destiny signal receives all attributes of the source signal: length, origin and border extension. The gcgDISCRETE1D::data is allocated but not copied. |
bool gcgDISCRETE1D< NUMTYPE >::createSimilar | ( | gcgDISCRETE1D< long > * | source | ) |
Creates a signal with the same length, origin and border extension of another source signal. This is useful for creating temporary signals compatible with the source.
[in] | source | pointer to the source signal. It must be non null. A warning is issued if it is not a valid signal. The destiny signal receives all attributes of the source signal: length, origin and border extension. The gcgDISCRETE1D::data is allocated but not copied. |
bool gcgDISCRETE1D< NUMTYPE >::destroySignal | ( | ) |
Releases all resources used by the signal. After destroyed, the signal becomes invalid and must be recreated.