/Users/asorokin/Documents/workspaceC/Decima/ts/tsdata.h File Reference

#include "lib/stringinfo.h"

Go to the source code of this file.

Data Structures

struct  TS_ELEMENT
struct  SAX_ELEMENT
struct  TS
struct  SAX

Defines

#define DEFAULT_CARDINALITY   8
#define DatumGetTS(x)   ((TS*)DatumGetPointer(x))
#define DatumGetSAX(x)   ((SAX*)DatumGetPointer(x))
#define PG_GETARG_TS(x)   DatumGetTS( PG_DETOAST_DATUM(PG_GETARG_DATUM(x)) )
#define PG_GETARG_SAX(x)   DatumGetSAX( PG_DETOAST_DATUM(PG_GETARG_DATUM(x)) )
#define PG_RETURN_TS(x)   PG_RETURN_POINTER(x)
#define PG_RETURN_SAX(x)   PG_RETURN_POINTER(x)
#define SIZE_OF_SAX(len)   (offsetof(SAX, data[0]) + sizeof(SAX_ELEMENT) * len)
#define SIZE_OF_TS(len)   (offsetof(SAX, data[0]) + sizeof(TS_ELEMENT) * len)
#define SCAN_HEX(str, valp)
#define NONE_IS_NULL(r1, r2, i)   (!(sax_isNull(&(r1->data[i])) || sax_isNull(&(r2->data[i]))))
#define NEITHER_ELEMENT_NULL(r1, r2)   (!(sax_isNull(r1) || sax_isNull(r2)))
#define WEAK_CHAR_LENGTH   3.0
#define MAX_DIST   (4.0*bp256[0]*bp256[0])

Functions

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.
bool ts_uoverlap (TS *a, TS *b)
 overlap from top: a &> b means a[i].l >= b[i].l & a[i].l <= b[i].u for all i=1.
bool ts_loverlap (TS *a, TS *b)
 overlap from bottom: a &< b means a[i].u<= b[i].u & a[i].u >= b[i].l for all i=1.
bool ts_contained (TS *a, TS *b)
 contained (a <@ b) : a[i].u < b[i].u & a[i].l>b[i].l for all i=1.
bool ts_contains (TS *a, TS *b)
 contains (a > b) : a[i].u > b[i].u & a[i].l < b[i].l for all i=1.
bool ts_wcontained (TS *a, TS *b)
bool ts_wcontains (TS *a, TS *b)
bool ts_greater (TS *a, TS *b)
 greater (a>b) - lower bound of a is always higher than upper bound of b (a[i].l >= b[i].u for all i=1.
bool ts_less (TS *a, TS *b)
 less (a<b) - is equivalent of b>a (a[i].u <= b[i].l for all i=1.
bool ts_intersect (TS *a, TS *b)
 intersect ( a >< b) a is neither greater nor less than b;
bool sax_uoverlap (SAX *a, SAX *b)
 overlap from top: a &> b means a[i].l >= b[i].l & a[i].l <= b[i].u for all i=1.
bool sax_loverlap (SAX *a, SAX *b)
 overlap from bottom: a &< b means a[i].u<= b[i].u & a[i].u >= b[i].l for all i=1.
bool sax_contained (SAX *a, SAX *b)
 contained (a <@ b) : a[i].u < b[i].u & a[i].l>b[i].l for all i=1.
bool sax_contains (SAX *a, SAX *b)
 contains (a > b) : a[i].u > b[i].u & a[i].l < b[i].l for all i=1.
bool sax_greater (SAX *a, SAX *b)
 greater (a>b) - lower bound of a is always higher than upper bound of b (a[i].l >= b[i].u for all i=1.
bool sax_less (SAX *a, SAX *b)
 less (a<b) - is equivalent of b>a (a[i].u <= b[i].l for all i=1.
bool sax_intersect (SAX *a, SAX *b)
 intersect ( a >< b) a is neither greater nor less than b;
Datum ts_subset (PG_FUNCTION_ARGS)
 extract subset of time series.
Datum sax_subset (PG_FUNCTION_ARGS)
 extract subset of SAX string.
unsigned char unify_cardinality_up (SAX_ELEMENT *a, SAX_ELEMENT *b, unsigned char *al, unsigned char *au, unsigned char *bl, unsigned char *bu)
 calculate new boundaries for both SAX_ELEMENTS in assumption that alphabet promote to upper cardinality
unsigned char unify_cardinality_down (SAX_ELEMENT *a, SAX_ELEMENT *b, unsigned char *al, unsigned char *au, unsigned char *bl, unsigned char *bu)
float dist (unsigned char a, unsigned char b, unsigned char c)
SAXi_sax_upper (SAX *sax)
SAXi_sax_lower (SAX *sax)
StringInfo i_sax_string (SAX *sax)
SAXi_sax_in (char *str)
 String to SAX conversion.


Define Documentation

#define DatumGetSAX (  )     ((SAX*)DatumGetPointer(x))

Definition at line 64 of file tsdata.h.

#define DatumGetTS (  )     ((TS*)DatumGetPointer(x))

Definition at line 63 of file tsdata.h.

#define DEFAULT_CARDINALITY   8

Definition at line 62 of file tsdata.h.

#define MAX_DIST   (4.0*bp256[0]*bp256[0])

Definition at line 95 of file tsdata.h.

#define NEITHER_ELEMENT_NULL ( r1,
r2   )     (!(sax_isNull(r1) || sax_isNull(r2)))

Definition at line 81 of file tsdata.h.

#define NONE_IS_NULL ( r1,
r2,
 )     (!(sax_isNull(&(r1->data[i])) || sax_isNull(&(r2->data[i]))))

Definition at line 80 of file tsdata.h.

#define PG_GETARG_SAX (  )     DatumGetSAX( PG_DETOAST_DATUM(PG_GETARG_DATUM(x)) )

Definition at line 66 of file tsdata.h.

#define PG_GETARG_TS (  )     DatumGetTS( PG_DETOAST_DATUM(PG_GETARG_DATUM(x)) )

Definition at line 65 of file tsdata.h.

#define PG_RETURN_SAX (  )     PG_RETURN_POINTER(x)

Definition at line 68 of file tsdata.h.

#define PG_RETURN_TS (  )     PG_RETURN_POINTER(x)

Definition at line 67 of file tsdata.h.

#define SCAN_HEX ( str,
valp   ) 

Value:

if ( sax_util_htoi((str), (valp)) != 1 ) { \
                                ereport(ERROR, \
                                  (errcode(ERRCODE_SYNTAX_ERROR), \
                                    errmsg("bad sax representation"), \
                                    errdetail("couldn't scan '%s'", (str)))); \
                                YYABORT; \
                            }

Definition at line 72 of file tsdata.h.

#define SIZE_OF_SAX ( len   )     (offsetof(SAX, data[0]) + sizeof(SAX_ELEMENT) * len)

Definition at line 69 of file tsdata.h.

#define SIZE_OF_TS ( len   )     (offsetof(SAX, data[0]) + sizeof(TS_ELEMENT) * len)

Definition at line 70 of file tsdata.h.

#define WEAK_CHAR_LENGTH   3.0

Definition at line 93 of file tsdata.h.


Function Documentation

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  ) 

StringInfo i_sax_string ( SAX sax  ) 

Definition at line 150 of file sax.c.

SAX* i_sax_upper ( SAX sax  ) 

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.

bool sax_contained ( SAX a,
SAX b 
)

contained (a <@ b) : a[i].u < b[i].u & a[i].l>b[i].l for all i=1.

.N; this is equivalent of ((a &> b) & (b &< a))

Definition at line 253 of file saxoperators.c.

bool sax_contains ( SAX a,
SAX b 
)

contains (a > b) : a[i].u > b[i].u & a[i].l < b[i].l for all i=1.

.N; is equivalent of b <@ a

Definition at line 257 of file saxoperators.c.

bool sax_greater ( SAX a,
SAX b 
)

greater (a>b) - lower bound of a is always higher than upper bound of b (a[i].l >= b[i].u for all i=1.

.N );

Definition at line 265 of file saxoperators.c.

bool sax_intersect ( SAX a,
SAX b 
)

intersect ( a >< b) a is neither greater nor less than b;

Definition at line 261 of file saxoperators.c.

bool sax_less ( SAX a,
SAX b 
)

less (a<b) - is equivalent of b>a (a[i].u <= b[i].l for all i=1.

.N);

Definition at line 281 of file saxoperators.c.

bool sax_loverlap ( SAX a,
SAX b 
)

overlap from bottom: a &< b means a[i].u<= b[i].u & a[i].u >= b[i].l for all i=1.

.N

Definition at line 237 of file saxoperators.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.

bool sax_uoverlap ( SAX a,
SAX b 
)

overlap from top: a &> b means a[i].l >= b[i].l & a[i].l <= b[i].u for all i=1.

.N

Definition at line 212 of file saxoperators.c.

bool ts_contained ( TS a,
TS b 
)

contained (a <@ b) : a[i].u < b[i].u & a[i].l>b[i].l for all i=1.

.N; this is equivalent of ((a &> b) & (b &< a))

Definition at line 72 of file tsoperators.c.

bool ts_contains ( TS a,
TS b 
)

contains (a > b) : a[i].u > b[i].u & a[i].l < b[i].l for all i=1.

.N; is equivalent of b <@ a

Definition at line 77 of file tsoperators.c.

bool ts_greater ( TS a,
TS b 
)

greater (a>b) - lower bound of a is always higher than upper bound of b (a[i].l >= b[i].u for all i=1.

.N );

Definition at line 86 of file tsoperators.c.

bool ts_intersect ( TS a,
TS b 
)

intersect ( a >< b) a is neither greater nor less than b;

Definition at line 81 of file tsoperators.c.

bool ts_less ( TS a,
TS b 
)

less (a<b) - is equivalent of b>a (a[i].u <= b[i].l for all i=1.

.N);

Definition at line 97 of file tsoperators.c.

bool ts_loverlap ( TS a,
TS b 
)

overlap from bottom: a &< b means a[i].u<= b[i].u & a[i].u >= b[i].l for all i=1.

.N

Definition at line 62 of file tsoperators.c.

Datum ts_subset ( PG_FUNCTION_ARGS   ) 

extract subset of time series.

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

Parameters:
time series to deal with
offset 
length 

Definition at line 451 of file ts.c.

bool ts_uoverlap ( TS a,
TS b 
)

overlap from top: a &> b means a[i].l >= b[i].l & a[i].l <= b[i].u for all i=1.

.N

Definition at line 51 of file tsoperators.c.

bool ts_wcontained ( TS a,
TS b 
)

Definition at line 107 of file tsoperators.c.

bool ts_wcontains ( TS a,
TS b 
)

Definition at line 130 of file tsoperators.c.

unsigned char unify_cardinality_down ( SAX_ELEMENT a,
SAX_ELEMENT b,
unsigned char *  al,
unsigned char *  au,
unsigned char *  bl,
unsigned char *  bu 
)

Definition at line 174 of file saxoperators.c.

unsigned char unify_cardinality_up ( SAX_ELEMENT a,
SAX_ELEMENT b,
unsigned char *  al,
unsigned char *  au,
unsigned char *  bl,
unsigned char *  bu 
)

calculate new boundaries for both SAX_ELEMENTS in assumption that alphabet promote to upper cardinality

Definition at line 136 of file saxoperators.c.


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