Previous Next Contents

5.3   Breakpoints






5.3.1   PmCreateBreakPoint

Synopsis
PmBreakPoint PmCreateBreakPoint (int size)
Creates and returns a BreakPoint of size points.

Returns NULL if there is no available memory.






5.3.2   PmReallocBreakPoint

Synopsis
PmBreakPoint PmReallocBreakPoint (PmBreakPoint aBP, int size)
Reallocates input BreakPoint aBP up to size points.

Returns

If reallocation is successful, returns the same input BreakPoint aBP with reallocated number of points.

If reallocation fails, returns NULL and the size of aBP remains unchanged.

If aBP is NULL, returns a new BreakPoint of size points, or NULL if reallocation failed.






5.3.3   PmFreeBreakPoint

Synopsis
void PmFreeBreakPoint (PmBreakPoint aBP)
Frees aBP.






5.3.4   PmReadBreakPoint

Synopsis
int PmReadBreakPoint (FILE *Stream, PmBreakPoint aBP, int format_flag)
Reads aBP from the input Stream.

format_flag indicates the format of the input file:

PM_BIN or PM_BIN_BPF
binary [x y] points
PM_ASCII or PM_ASCII_BPF
ascii [x y] points on the same line . Comments can be placed after each point [x y] in a line.
PM_SDIF_BPF
SDIF format, by default reads 1FQ0 frames and matrices. If an SDIF selection specification is appended to the file name, the stream, frame and matrix type therein will be read.
Returns [number of points] if a BreakPoint was read, -1 if there is no available memory to perform the operation.






5.3.5   PmWriteBreakPoint

Synopsis
void PmWriteBreakPoint (FILE *Stream, PmBreakPoint aBP, int format_flag)
Writes aBP to the output Stream.

format_flag indicates the format of the input stream (see above).






5.3.6   PmLoadBreakPoint

Synopsis
PmBreakPointPmLoadBreakPoint (char *name)
Creates and loads an entire bpf from a file given by name. The format is determined by checking if it is an SDIF file, if not, PM_ASCII_BPF is assumed.

Returns the bpf read, which must be PmFreeBreakPoint'ed by the caller.






5.3.7   PmLoadBreakPointOrConst

Synopsis
PmBreakPointPmLoadBreakPointOrConst (char *nameorconst)
If nameorconst looks like a number, returns a constant PmBreakPoint with that value, else, uses it as filename and loads a bpf from it. This is especially useful for parsing command line arguments, which can then be transparently either a constant (e.g. maximum fundamental frequency to be considered) or a bpf from a file.

On load, the function tries to auto-detect the file format, if it is not SDIF, for now we assume PM_ASCII_BPF.

Returns: A freshly created PmBreakPoint (which must be PmFreeBreakPoint'ed by the calling program).






5.3.8   PmSaveBreakPoint

Synopsis
int PmSaveBreakPoint (char *name, PmBreakPointbp, int format)
Saves an entire bpf to file name, in format format. If the format is PM_SDIF_BPF, the SDIF selection specification determines the SDIF stream, frame and matrix type (1FQ0 by default). E.g. if name = "foo.sdif::#4:1WRP/1BPF" writes on stream 4 as 1BPF matrices in 1WRP frames.

Returns 1 on success.






5.3.9   PmEvalBreakPoint

Synopsis
float PmEvalBreakPoint (PmBreakPoint aBP, float x)
Evaluates the function aBP at X = x by linear interpolation and returns the corresponding Y value.






5.3.10   PmAddBreakPoint

Synopsis
int PmAddBreakPoint (PmBreakPoint aBP, float x, float y)
Adds a point [x ; y] to the function aBP.

Returns 1 if addition was successful, -1 if there is no available memory to add the point.






5.3.11   PmExtractBreakPoint

Synopsis
void PmExtractBreakPoint (PmBreakPoint aBP, float x)
Extracts (=deletes) from the function aBP the point whose x-coordinate is closest to x.






5.3.12   PmGetBreakPoint

Synopsis
int PmGetBreakPoint (PmBreakPoint aBP, int pos, float *px, float *py)
Writes to the addresses px and py the coordinates of the point in position=pos in the function aBP.

Returns -1 if pos is greater than the [nb_of_points - 1] of aBP, 1 otherwise.






5.3.13   PmGetBreakPointNb

Synopsis
int PmGetBreakPointNb (PmBreakPoint aBP)
Returns the number of points of the function aBP.



Formatted and maintained by Diemo Schwarz --- last change
Previous Next Contents