ExprFuncNode.h

Classes

TableExprFuncNode -- Class representing a function in table select expression (full description)

class TableExprFuncNode : public TableExprNodeMulti

Types

enum FunctionType

piFUNC
eFUNC
near2FUNC
for Double or Complex returning Bool (2 is with default tolerance)
near3FUNC
nearabs2FUNC
nearabs3FUNC
sinFUNC
for Double or DComplex returning same data type
sinhFUNC
cosFUNC
coshFUNC
expFUNC
logFUNC
log10FUNC
powFUNC
squareFUNC
sqrtFUNC
conjFUNC
minFUNC
maxFUNC
normFUNC
for Double or DComplex returning Double
absFUNC
argFUNC
realFUNC
imagFUNC
asinFUNC
for Double returning Double
acosFUNC
atanFUNC
atan2FUNC
tanFUNC
tanhFUNC
signFUNC
roundFUNC
floorFUNC
ceilFUNC
fmodFUNC
complexFUNC
for Double returning DComplex
arrsumFUNC
for Double or Complex array returning scalar
arrsumsFUNC
arrproductFUNC
arrproductsFUNC
arrsumsqrFUNC
arrsumsqrsFUNC
arrminFUNC
for Double array returning Double
arrminsFUNC
arrmaxFUNC
arrmaxsFUNC
arrmeanFUNC
arrmeansFUNC
arrvarianceFUNC
arrvariancesFUNC
arrstddevFUNC
arrstddevsFUNC
arravdevFUNC
arravdevsFUNC
arrmedianFUNC
arrmediansFUNC
arrfractileFUNC
arrfractilesFUNC
anyFUNC
for Bool array returning Bool
anysFUNC
allFUNC
allsFUNC
ntrueFUNC
for Bool array returning Double
ntruesFUNC
nfalseFUNC
nfalsesFUNC
arrayFUNC
for any type returning array of that type
isnanFUNC
for Double or DComplex array returning Bool
isdefFUNC
for any array returning Bool scalar
ndimFUNC
for any array returning Double scalar
nelemFUNC
shapeFUNC
for any array returning Double array
strlengthFUNC
for String
upcaseFUNC
# returning Double
downcaseFUNC
# returning String
trimFUNC
# returning String
regexFUNC
# returning String
patternFUNC
# returning Regex
sqlpatternFUNC
# returning Regex
datetimeFUNC
# returning Regex for Date
mjdtodateFUNC
# returning Date
mjdFUNC
# returning Date
dateFUNC
# returning Double
timeFUNC
# returning Date
yearFUNC
# returning Double (in radians)
monthFUNC
# returning Double
dayFUNC
# returning Double
cmonthFUNC
# returning Double
weekdayFUNC
# returning String
cdowFUNC
# returning Double
weekFUNC
# returning String
randFUNC
# returning Double special function to select on a random number
rownrFUNC
special function to select on row number
rowidFUNC
special function to return row id (meant for GIVING)
iifFUNC
special function resembling if statement
NRFUNC

Interface

Public Members
TableExprFuncNode (FunctionType, NodeDataType, ValueType, const ValueType& source)
~TableExprFuncNode ()
Bool getBool (const TableExprId& id)
Double getDouble (const TableExprId& id)
DComplex getDComplex (const TableExprId& id)
String getString (const TableExprId& id)
Regex getRegex (const TableExprId& id)
MVTime getDate (const TableExprId& id)
static NodeDataType checkOperands (Block<Int>& dtypeOper, ValueType& resVT, Block<Int>& vtypeOper, FunctionType, PtrBlock<TableExprNodeRep*>&)
static TableExprNodeRep* fillNode (TableExprFuncNode* thisNode, PtrBlock<TableExprNodeRep*>& nodes, const Block<Int>& dtypeOper)
static void fillChildNodes (TableExprFuncNode* thisNode, PtrBlock<TableExprNodeRep*>& nodes, const Block<Int>& dtypeOper)
PtrBlock<TableExprNodeRep*> operands()
FunctionType funcType() const
NodeDataType argDataType() const
Private Members
void tryToConst()

Description

Prerequisite

Synopsis

This class represents a function in a table select tree. The rownumber function is represented by class TableExprNodeRownr. The rowid function is represented by class TableExprNodeRowid. The rand function is represented by class TableExprNodeRandom.

When one wants to add a function to the table selection grammar, the following has to be done:

Member Description

enum FunctionType

TableExprFuncNode (FunctionType, NodeDataType, ValueType, const ValueType& source)

Constructor

~TableExprFuncNode ()

Destructor

Bool getBool (const TableExprId& id)
Double getDouble (const TableExprId& id)
DComplex getDComplex (const TableExprId& id)
String getString (const TableExprId& id)
Regex getRegex (const TableExprId& id)
MVTime getDate (const TableExprId& id)

'get' Functions to get the desired result of a function

static NodeDataType checkOperands (Block<Int>& dtypeOper, ValueType& resVT, Block<Int>& vtypeOper, FunctionType, PtrBlock<TableExprNodeRep*>&)

Check the data and value types of the operands. It sets the exptected data and value types of the operands. Set the value type of the function result and returns the data type of the function result.

static TableExprNodeRep* fillNode (TableExprFuncNode* thisNode, PtrBlock<TableExprNodeRep*>& nodes, const Block<Int>& dtypeOper)

Link the children to the node and convert the children to constants if possible. Also convert the node to constant if possible.

static void fillChildNodes (TableExprFuncNode* thisNode, PtrBlock<TableExprNodeRep*>& nodes, const Block<Int>& dtypeOper)

Link the children to the node and convert the children to constants if possible.

PtrBlock<TableExprNodeRep*> operands()
FunctionType funcType() const
NodeDataType argDataType() const

Some functions to be used by TableExprNodeFuncArray.

void tryToConst()

Try if the function gives a constant result. If so, set the expression type to Constant.