Hermes
 All Data Structures Files Functions Variables Macros Pages
Utilities.c File Reference

File containing utilities functions used by the Hermes Mod. More...

#include "../h/Utilities/Utilities.h"
#include "../h/Utilities/MSVCWorkarounds.h"
#include <utils/builtins.h>
#include <utils/int8.h>
#include <math.h>
#include <time.h>
Include dependency graph for Utilities.c:

Functions

int asprintfHermes (char **ptr, const char *frm,...)
 
Timestamp epoch ()
 
float8 interval2seconds (const Interval *interval)
 Function converting the interval to seconds. More...
 
Interval * seconds2interval (float8 seconds, Interval *result)
 Function converting the interval to seconds in its place. More...
 
float8 timestamp2seconds (Timestamp ts)
 Function converting timestamp to seconds. More...
 
Timestamp seconds2timestamp (float8 seconds)
 Function converting seconds to timestamp. More...
 
Timestamp timestampPlusSeconds (Timestamp ts, float8 seconds)
 
Timestamp timestampMinusSeconds (Timestamp ts, float8 seconds)
 
Interval * differenceInInterval (Timestamp tsA, Timestamp tsB, Interval *result)
 
float8 differenceInSeconds (Timestamp tsA, Timestamp tsB)
 
Timestamp roundTimestamp (Timestamp ts)
 
PGDLLEXPORT Datum roundTimestampV1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (roundTimestampV1)
 
float8 Pi ()
 
float8 dPi ()
 
float8 radians2degrees (float8 rad)
 
float8 degrees2radians (float8 deg)
 
float8 degrees360 (float8 degrees180)
 
PGDLLEXPORT Datum degrees360V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (degrees360V1)
 
float8 toPrecision (float8 n, float8 precision)
 
float4 minFloat4 (float4 a, float4 b)
 
float4 maxFloat4 (float4 a, float4 b)
 
float8 minFloat8 (float8 a, float8 b)
 
float8 maxFloat8 (float8 a, float8 b)
 
int16 minInt16 (int16 a, int16 b)
 
int16 maxInt16 (int16 a, int16 b)
 
int32 minInt32 (int32 a, int32 b)
 
int32 maxInt32 (int32 a, int32 b)
 
int64 minInt64 (int64 a, int64 b)
 
int64 maxInt64 (int64 a, int64 b)
 
Timestamp minTimestamp (Timestamp a, Timestamp b)
 
Timestamp maxTimestamp (Timestamp a, Timestamp b)
 
Interval * minInterval (const Interval *a, const Interval *b)
 
Interval * maxInterval (const Interval *a, const Interval *b)
 
PGDLLEXPORT Datum minFloat4V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minFloat4V1)
 
PGDLLEXPORT Datum maxFloat4V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxFloat4V1)
 
PGDLLEXPORT Datum minFloat8V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minFloat8V1)
 
PGDLLEXPORT Datum maxFloat8V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxFloat8V1)
 
PGDLLEXPORT Datum minInt16V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minInt16V1)
 
PGDLLEXPORT Datum maxInt16V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxInt16V1)
 
PGDLLEXPORT Datum minInt32V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minInt32V1)
 
PGDLLEXPORT Datum maxInt32V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxInt32V1)
 
PGDLLEXPORT Datum minInt64V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minInt64V1)
 
PGDLLEXPORT Datum maxInt64V1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxInt64V1)
 
PGDLLEXPORT Datum minTimestampV1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minTimestampV1)
 
PGDLLEXPORT Datum maxTimestampV1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxTimestampV1)
 
PGDLLEXPORT Datum minIntervalV1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (minIntervalV1)
 
PGDLLEXPORT Datum maxIntervalV1 (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (maxIntervalV1)
 
PGDLLEXPORT Datum getFalse (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (getFalse)
 

Detailed Description

File containing utilities functions used by the Hermes Mod.

Author
Marios Vodas (mvoda.nosp@m.s@gm.nosp@m.ail.c.nosp@m.om).

Function Documentation

float8 degrees2radians ( float8  deg)
float8 degrees360 ( float8  degrees180)

Referenced by degrees360V1().

PGDLLEXPORT Datum degrees360V1 ( PG_FUNCTION_ARGS  )

References degrees360().

Here is the call graph for this function:

Interval* differenceInInterval ( Timestamp  tsA,
Timestamp  tsB,
Interval *  result 
)
float8 dPi ( )

Referenced by areaRangeSP().

Timestamp epoch ( )

Referenced by seconds2timestamp().

PGDLLEXPORT Datum getFalse ( PG_FUNCTION_ARGS  )
float4 maxFloat4 ( float4  a,
float4  b 
)

Referenced by maxFloat4V1().

PGDLLEXPORT Datum maxFloat4V1 ( PG_FUNCTION_ARGS  )

References maxFloat4().

Here is the call graph for this function:

float8 maxFloat8 ( float8  a,
float8  b 
)

Referenced by maxFloat8V1().

PGDLLEXPORT Datum maxFloat8V1 ( PG_FUNCTION_ARGS  )

References maxFloat8().

Here is the call graph for this function:

int16 maxInt16 ( int16  a,
int16  b 
)

Referenced by maxInt16V1().

PGDLLEXPORT Datum maxInt16V1 ( PG_FUNCTION_ARGS  )

References maxInt16().

Here is the call graph for this function:

int32 maxInt32 ( int32  a,
int32  b 
)

Referenced by maxInt32V1().

PGDLLEXPORT Datum maxInt32V1 ( PG_FUNCTION_ARGS  )

References maxInt32().

Here is the call graph for this function:

int64 maxInt64 ( int64  a,
int64  b 
)

Referenced by maxInt64V1().

PGDLLEXPORT Datum maxInt64V1 ( PG_FUNCTION_ARGS  )

References maxInt64().

Here is the call graph for this function:

Interval* maxInterval ( const Interval *  a,
const Interval *  b 
)

Referenced by maxIntervalV1().

PGDLLEXPORT Datum maxIntervalV1 ( PG_FUNCTION_ARGS  )

References maxInterval().

Here is the call graph for this function:

Timestamp maxTimestamp ( Timestamp  a,
Timestamp  b 
)

Referenced by maxTimestampV1().

PGDLLEXPORT Datum maxTimestampV1 ( PG_FUNCTION_ARGS  )

References maxTimestamp().

Here is the call graph for this function:

float4 minFloat4 ( float4  a,
float4  b 
)

Referenced by minFloat4V1().

PGDLLEXPORT Datum minFloat4V1 ( PG_FUNCTION_ARGS  )

References minFloat4().

Here is the call graph for this function:

float8 minFloat8 ( float8  a,
float8  b 
)
PGDLLEXPORT Datum minFloat8V1 ( PG_FUNCTION_ARGS  )

References minFloat8().

Here is the call graph for this function:

int16 minInt16 ( int16  a,
int16  b 
)

Referenced by minInt16V1().

PGDLLEXPORT Datum minInt16V1 ( PG_FUNCTION_ARGS  )

References minInt16().

Here is the call graph for this function:

int32 minInt32 ( int32  a,
int32  b 
)

Referenced by minInt32V1().

PGDLLEXPORT Datum minInt32V1 ( PG_FUNCTION_ARGS  )

References minInt32().

Here is the call graph for this function:

int64 minInt64 ( int64  a,
int64  b 
)

Referenced by minInt64V1().

PGDLLEXPORT Datum minInt64V1 ( PG_FUNCTION_ARGS  )

References minInt64().

Here is the call graph for this function:

Interval* minInterval ( const Interval *  a,
const Interval *  b 
)

Referenced by minIntervalV1().

PGDLLEXPORT Datum minIntervalV1 ( PG_FUNCTION_ARGS  )

References minInterval().

Here is the call graph for this function:

Timestamp minTimestamp ( Timestamp  a,
Timestamp  b 
)

Referenced by minTimestampV1().

PGDLLEXPORT Datum minTimestampV1 ( PG_FUNCTION_ARGS  )

References minTimestamp().

Here is the call graph for this function:

PG_FUNCTION_INFO_V1 ( roundTimestampV1  )
PG_FUNCTION_INFO_V1 ( degrees360V1  )
PG_FUNCTION_INFO_V1 ( minFloat4V1  )
PG_FUNCTION_INFO_V1 ( maxFloat4V1  )
PG_FUNCTION_INFO_V1 ( minFloat8V1  )
PG_FUNCTION_INFO_V1 ( maxFloat8V1  )
PG_FUNCTION_INFO_V1 ( minInt16V1  )
PG_FUNCTION_INFO_V1 ( maxInt16V1  )
PG_FUNCTION_INFO_V1 ( minInt32V1  )
PG_FUNCTION_INFO_V1 ( maxInt32V1  )
PG_FUNCTION_INFO_V1 ( minInt64V1  )
PG_FUNCTION_INFO_V1 ( maxInt64V1  )
PG_FUNCTION_INFO_V1 ( minTimestampV1  )
PG_FUNCTION_INFO_V1 ( maxTimestampV1  )
PG_FUNCTION_INFO_V1 ( minIntervalV1  )
PG_FUNCTION_INFO_V1 ( maxIntervalV1  )
PG_FUNCTION_INFO_V1 ( getFalse  )
float8 Pi ( )
float8 radians2degrees ( float8  rad)

Referenced by angleDistanceTraclus(), and xy2ll().

Timestamp roundTimestamp ( Timestamp  ts)

References round(), and seconds2interval().

Referenced by atPointTSegmentST(), and roundTimestampV1().

Here is the call graph for this function:

PGDLLEXPORT Datum roundTimestampV1 ( PG_FUNCTION_ARGS  )

References roundTimestamp().

Here is the call graph for this function:

Interval* seconds2interval ( float8  seconds,
Interval *  result 
)

Function converting the interval to seconds in its place.

Parameters
[in]secondsSeconds
[in]resultpointer to result
Returns
seconds

Referenced by getS2T_TemporalBufferSize(), getS2T_VotingSignal(), getTemporalTolerance(), roundTimestamp(), samplingPeriodTrajectoryV1(), seconds2timestamp(), timestampMinusSeconds(), and timestampPlusSeconds().

Timestamp seconds2timestamp ( float8  seconds)

Function converting seconds to timestamp.

Parameters
seconds
Returns
timestamp

References epoch(), and seconds2interval().

Referenced by centroidTrajectory(), simplifyEpochTrajectory(), and Vector3D2PointST().

Here is the call graph for this function:

float8 timestamp2seconds ( Timestamp  ts)
Timestamp timestampMinusSeconds ( Timestamp  ts,
float8  seconds 
)

References seconds2interval().

Referenced by bufferBoxST(), and enlargeBoxST().

Here is the call graph for this function:

Timestamp timestampPlusSeconds ( Timestamp  ts,
float8  seconds 
)
float8 toPrecision ( float8  n,
float8  precision 
)

References precision, and round().

Here is the call graph for this function: