GCGlib  0.04.228
GCG Graphics Engine
gcgDISCRETE1D< NUMTYPE > Class Template Reference

Class for 1D signal definition and processing. More...

#include <gcg.h>

Inheritance diagram for gcgDISCRETE1D< NUMTYPE >:
gcgCLASS gcgFILTERMASK1D< NUMTYPE >

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.
 

Detailed Description

template<>
class gcgDISCRETE1D< NUMTYPE >

Class for 1D signal definition and processing.

Template Parameters
NUMTYPEType of the samples representing the signal. Supported types: float, double, long, int and short.
Since
0.01.6

Constructor & Destructor Documentation

◆ gcgDISCRETE1D() [1/2]

gcgDISCRETE1D< NUMTYPE >::gcgDISCRETE1D ( )

Constructs a valid but empty unidimensional signal. The signal can be used as destiny in any gcgDISCRETE1D<NUMTYPE> method.

See also
~gcgDISCRETE1D()

◆ gcgDISCRETE1D() [2/2]

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().

Parameters
[in]lengthsignal length or number of samples. It must be non-zero.
[in]originsample position indicating the origin of the signal.
[in]sampledatapointer 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]isstaticdataif true, indicates that the sampledata pointer must not be deleted upon object destruction. If false, the sampledata will be deleted whenever necessary.
[in]borderextensionindicates 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.
See also
createSignal()
~gcgDISCRETE1D()

◆ ~gcgDISCRETE1D()

virtual gcgDISCRETE1D< NUMTYPE >::~gcgDISCRETE1D ( )
virtual

Frees all signal resources by calling destroySignal().

See also
gcgDISCRETE1D()

Member Function Documentation

◆ createSignal()

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.

Parameters
[in]lengthsignal length or number of samples. It must be non-zero.
[in]originsample position indicating the origin of the signal.
[in]sampledatapointer 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]isstaticdataif true, indicates that the sampledata pointer must not be deleted upon object destruction. If false, the sampledata will be deleted whenever necessary.
[in]borderextensionindicates 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.
Returns
true if the signal is correctly created. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSimilar()
duplicateSignal()
duplicateSubsignal()
destroySignal()

◆ createSimilar() [1/5]

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.

Parameters
[in]sourcepointer 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.
Returns
true if the current signal is correctly created and similar to the source. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSignal()
duplicateSignal()
duplicateSubsignal()
destroySignal()
isCompatibleWith()

◆ createSimilar() [2/5]

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.

Parameters
[in]sourcepointer 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.
Returns
true if the current signal is correctly created and similar to the source. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSignal()
duplicateSignal()
duplicateSubsignal()
destroySignal()
isCompatibleWith()

◆ createSimilar() [3/5]

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.

Parameters
[in]sourcepointer 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.
Returns
true if the current signal is correctly created and similar to the source. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSignal()
duplicateSignal()
duplicateSubsignal()
destroySignal()
isCompatibleWith()

◆ createSimilar() [4/5]

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.

Parameters
[in]sourcepointer 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.
Returns
true if the current signal is correctly created and similar to the source. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSignal()
duplicateSignal()
duplicateSubsignal()
destroySignal()
isCompatibleWith()

◆ createSimilar() [5/5]

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.

Parameters
[in]sourcepointer 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.
Returns
true if the current signal is correctly created and similar to the source. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSignal()
duplicateSignal()
duplicateSubsignal()
destroySignal()
isCompatibleWith()

◆ destroySignal()

bool gcgDISCRETE1D< NUMTYPE >::destroySignal ( )

Releases all resources used by the signal. After destroyed, the signal becomes invalid and must be recreated.

Returns
true if the signal was released. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
createSignal()
createSimilar()

The documentation for this class was generated from the following file: