/Users/asorokin/Documents/workspaceC/Decima/ts/sax.c File Reference

#include "postgres.h"
#include <string.h>
#include <float.h>
#include <math.h>
#include "access/gist.h"
#include "access/skey.h"
#include "utils/builtins.h"
#include "utils/array.h"
#include "tsdata.h"

Go to the source code of this file.

Defines

#define ARRPTR(x)   ( (double *) ARR_DATA_PTR(x) )
#define ARRNELEMS(x)   ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x))

Functions

int sax_yyparse ()
void sax_yyerror (const char *message)
int sax_scanner_init (const char *str)
void sax_scanner_finish (void)
bool sax_isNull (SAX_ELEMENT *point)
 Check for NULL conditions.
 PG_FUNCTION_INFO_V1 (sax_in)
 PG_FUNCTION_INFO_V1 (sax_out)
 PG_FUNCTION_INFO_V1 (sax_length)
 PG_FUNCTION_INFO_V1 (sax_points_per_letter)
 PG_FUNCTION_INFO_V1 (sax_range)
 PG_FUNCTION_INFO_V1 (sax_upper)
 PG_FUNCTION_INFO_V1 (sax_lower)
 PG_FUNCTION_INFO_V1 (sax_string)
 PG_FUNCTION_INFO_V1 (sax_subset)
Datum sax_in (PG_FUNCTION_ARGS)
 PgSQL wrapper for string to SAX conversion.
Datum sax_out (PG_FUNCTION_ARGS)
 Output SAX to string.
Datum sax_length (PG_FUNCTION_ARGS)
 Return the length of the series.
Datum sax_points_per_letter (PG_FUNCTION_ARGS)
 Return the points per letter of the series.
Datum sax_range (PG_FUNCTION_ARGS)
 Return a SAX consisting of one point representing the range of the input series.
Datum sax_upper (PG_FUNCTION_ARGS)
 Return a SAX consisting of point representing upper boundary of the input series.
Datum sax_lower (PG_FUNCTION_ARGS)
Datum sax_string (PG_FUNCTION_ARGS)
 PgSQL wrapper for SAX to easy-to-read string conversion.
SAXi_sax_upper (SAX *sax)
SAXi_sax_lower (SAX *sax)
SAXi_sax_in (char *str)
 String to SAX conversion.
StringInfo i_sax_string (SAX *sax)
void i_sax_subset (SAX *sax, int32 offset, SAX *result)
Datum sax_subset (PG_FUNCTION_ARGS)
 extract subset of SAX string.
float dist (unsigned char a, unsigned char b, unsigned char c)
unsigned char promoteLetter (unsigned char let, unsigned char ref, unsigned char oldA, unsigned char newA)
 New cardinality is greater than old one.
unsigned char downgradeLetter (unsigned char let, unsigned char oldA, unsigned char newA)
 New cardinality is less then old one.
unsigned char changeLetterCardinality (unsigned char let, unsigned char oldA, unsigned char newA)

Variables

int sax_yydebug


Define Documentation

#define ARRNELEMS (  )     ArrayGetNItems( ARR_NDIM(x), ARR_DIMS(x))

Definition at line 52 of file sax.c.

#define ARRPTR (  )     ( (double *) ARR_DATA_PTR(x) )

Definition at line 51 of file sax.c.


Function Documentation

unsigned char changeLetterCardinality ( unsigned char  let,
unsigned char  oldA,
unsigned char  newA 
)

Definition at line 563 of file sax.c.

float dist ( unsigned char  a,
unsigned char  b,
unsigned char  c 
)

Definition at line 483 of file sax.c.

unsigned char downgradeLetter ( unsigned char  let,
unsigned char  oldA,
unsigned char  newA 
)

New cardinality is less then old one.

Extra bits will be stripped out

Definition at line 545 of file sax.c.

SAX* i_sax_in ( char *  str  ) 

String to SAX conversion.

Main function for object type. It accept strings in form :

SAX = 'lower:upper|card;lower:upper;... lower:; ... :upper; ... :/num_per_letter'

and convert them into internal DB representation.
Parameters:
str -string to convert
Returns:
pointer to SAX structure

Definition at line 99 of file sax.c.

SAX * i_sax_lower ( SAX sax  ) 

Definition at line 404 of file sax.c.

StringInfo i_sax_string ( SAX sax  ) 

Definition at line 150 of file sax.c.

void i_sax_subset ( SAX sax,
int32  offset,
SAX result 
)

Definition at line 435 of file sax.c.

SAX * i_sax_upper ( SAX sax  ) 

Definition at line 386 of file sax.c.

PG_FUNCTION_INFO_V1 ( sax_subset   ) 

PG_FUNCTION_INFO_V1 ( sax_string   ) 

PG_FUNCTION_INFO_V1 ( sax_lower   ) 

PG_FUNCTION_INFO_V1 ( sax_upper   ) 

PG_FUNCTION_INFO_V1 ( sax_range   ) 

PG_FUNCTION_INFO_V1 ( sax_points_per_letter   ) 

PG_FUNCTION_INFO_V1 ( sax_length   ) 

PG_FUNCTION_INFO_V1 ( sax_out   ) 

PG_FUNCTION_INFO_V1 ( sax_in   ) 

unsigned char promoteLetter ( unsigned char  let,
unsigned char  ref,
unsigned char  oldA,
unsigned char  newA 
)

New cardinality is greater than old one.

Function will add missing bits to promote letter from oldA cardinality to newA with reference to newA cardinality letter ref.

Definition at line 516 of file sax.c.

Datum sax_in ( PG_FUNCTION_ARGS   ) 

PgSQL wrapper for string to SAX conversion.

Main function for object type. It accept strings in form :

SAX = 'lower:upper|card;lower:upper;... lower:; ... :upper; ... :/num_per_letter'

and convert them into internal DB representation.
Parameters:
structure with compressed internal parameters
Returns:
pointer to Internal representation of SAX structure

Definition at line 127 of file sax.c.

bool sax_isNull ( SAX_ELEMENT point  ) 

Check for NULL conditions.

Definition at line 424 of file sax.c.

Datum sax_length ( PG_FUNCTION_ARGS   ) 

Return the length of the series.

Definition at line 308 of file sax.c.

Datum sax_lower ( PG_FUNCTION_ARGS   ) 

Definition at line 372 of file sax.c.

Datum sax_out ( PG_FUNCTION_ARGS   ) 

Output SAX to string.

Main function for SAX output, it generates string like:

SAX = 'lower:upper|card;lower:upper;... lower:; ... :upper; ... :/num_per_letter'

from internal data representation.
Parameters:
sax SAX structure to convert
Returns:
string

Definition at line 241 of file sax.c.

Datum sax_points_per_letter ( PG_FUNCTION_ARGS   ) 

Return the points per letter of the series.

Definition at line 295 of file sax.c.

Datum sax_range ( PG_FUNCTION_ARGS   ) 

Return a SAX consisting of one point representing the range of the input series.

Definition at line 323 of file sax.c.

void sax_scanner_finish ( void   ) 

int sax_scanner_init ( const char *  str  ) 

Datum sax_string ( PG_FUNCTION_ARGS   ) 

PgSQL wrapper for SAX to easy-to-read string conversion.

It generates string like:

SAX = 'ABCD|C:D|EF09/num_per_letter'

from internal data representation. If cardinality is grater than 4 it will be downgrade to 4 so every time point has onle letter representation.
Parameters:
sax SAX structure to convert
Returns:
string

Definition at line 209 of file sax.c.

Datum sax_subset ( PG_FUNCTION_ARGS   ) 

extract subset of SAX string.

It returns SAX string starts at offset and spanning length points. If offset is negative SAX string will be padded with NULL values in the beginning. If offset+length greater than length of original SAX string, result will be padded with NULL values at the end.

Parameters:
SAX string to deal with
offset 
length 

Definition at line 459 of file sax.c.

Datum sax_upper ( PG_FUNCTION_ARGS   ) 

Return a SAX consisting of point representing upper boundary of the input series.

Definition at line 355 of file sax.c.

void sax_yyerror ( const char *  message  ) 

int sax_yyparse (  ) 


Variable Documentation


Generated on Fri Jul 24 12:11:26 2009 for Decima by  doxygen 1.5.9