Class representing a function in table select expression. More...
#include <ExprFuncNode.h>
Class representing a function in table select expression.
Internal
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:
Definition at line 76 of file ExprFuncNode.h.
piFUNC | |
eFUNC | |
cFUNC | |
near2FUNC |
for Int, or Double or Complex returning Bool (2 is with default tolerance) |
near3FUNC | |
nearabs2FUNC | |
nearabs3FUNC | |
sinFUNC |
for Int, Double or DComplex returning Double or Complex |
sinhFUNC | |
cosFUNC | |
coshFUNC | |
expFUNC | |
logFUNC | |
log10FUNC | |
sqrtFUNC | |
powFUNC | |
conjFUNC | |
squareFUNC |
for Int, Double or DComplex returning Int, Double or Complex |
cubeFUNC | |
minFUNC | |
maxFUNC | |
normFUNC |
for Int, Double or DComplex returning Int or Double |
absFUNC | |
argFUNC | |
realFUNC |
for Int, Double, DComplex, Bool or String returning Double |
imagFUNC | |
intFUNC |
for Int, Double, Bool or String returning Int (using floor) |
asinFUNC |
for Int or Double returning Double |
acosFUNC | |
atanFUNC | |
atan2FUNC | |
tanFUNC | |
tanhFUNC | |
signFUNC |
for Int or Double returning Int or Double |
roundFUNC | |
floorFUNC | |
ceilFUNC | |
fmodFUNC | |
complexFUNC |
for Int, Double or DComplex returning DComplex |
arrsumFUNC |
for Int, Double or Complex array returning the same |
arrsumsFUNC | |
arrproductFUNC | |
arrproductsFUNC | |
arrsumsqrFUNC | |
arrsumsqrsFUNC | |
arrminFUNC |
for Int or Double array returning Int or Double |
arrminsFUNC | |
runminFUNC | |
boxminFUNC | |
arrmaxFUNC | |
arrmaxsFUNC | |
runmaxFUNC | |
boxmaxFUNC | |
arrmeanFUNC |
for Int or Double array returning Double |
arrmeansFUNC | |
runmeanFUNC | |
boxmeanFUNC | |
arrvarianceFUNC | |
arrvariancesFUNC | |
runvarianceFUNC | |
boxvarianceFUNC | |
arrstddevFUNC | |
arrstddevsFUNC | |
runstddevFUNC | |
boxstddevFUNC | |
arravdevFUNC | |
arravdevsFUNC | |
runavdevFUNC | |
boxavdevFUNC | |
arrrmsFUNC | |
arrrmssFUNC | |
runrmsFUNC | |
boxrmsFUNC | |
arrmedianFUNC | |
arrmediansFUNC | |
runmedianFUNC | |
boxmedianFUNC | |
arrfractileFUNC | |
arrfractilesFUNC | |
anyFUNC |
for Bool array returning Bool |
anysFUNC | |
runanyFUNC | |
boxanyFUNC | |
allFUNC | |
allsFUNC | |
runallFUNC | |
boxallFUNC | |
ntrueFUNC |
for Bool array returning Int scalar |
ntruesFUNC | |
nfalseFUNC | |
nfalsesFUNC | |
arrayFUNC |
for any type returning array of that type |
transposeFUNC | |
resizeFUNC | |
diagonalFUNC | |
isnanFUNC |
for Int, Double or DComplex array returning Bool |
isinfFUNC | |
isfiniteFUNC | |
isdefFUNC |
for any array returning Bool scalar |
isnullFUNC | |
iscolFUNC | |
iskeyFUNC | |
ndimFUNC |
for any array returning Int scalar |
nelemFUNC | |
shapeFUNC |
for any array returning Int array |
strlengthFUNC |
for String |
upcaseFUNC | |
downcaseFUNC | |
capitalizeFUNC | |
trimFUNC | |
ltrimFUNC | |
rtrimFUNC | |
substrFUNC | |
replaceFUNC | |
regexFUNC | |
patternFUNC | |
sqlpatternFUNC | |
datetimeFUNC |
for Date |
mjdtodateFUNC | |
mjdFUNC | |
dateFUNC | |
timeFUNC | |
yearFUNC | |
monthFUNC | |
dayFUNC | |
cmonthFUNC | |
weekdayFUNC | |
cdowFUNC | |
weekFUNC | |
ctodFUNC | |
cdateFUNC | |
ctimeFUNC | |
stringFUNC |
return values as strings |
hmsFUNC |
return angles as hms strings |
dmsFUNC |
return angles as dms strings |
hdmsFUNC |
return angles as hms/dms strings |
randFUNC |
special function returning a random Double number |
rownrFUNC |
special function returning Int row number |
rowidFUNC |
special function returning Int row id (meant for GIVING) |
iifFUNC |
special function resembling if statement |
angdistFUNC |
angular distance returning radians |
angdistxFUNC | |
conesFUNC |
cone search functions, implemented in derived class |
cones3FUNC | |
anyconeFUNC | |
anycone3FUNC | |
findconeFUNC | |
findcone3FUNC | |
boolFUNC |
for Int, Double, Complex or String returning Bool |
nullarrayFUNC |
masked array functions |
marrayFUNC | |
arrdataFUNC | |
arrmaskFUNC | |
negatemaskFUNC | |
replmaskedFUNC | |
replunmaskedFUNC | |
arrflatFUNC | |
FirstAggrFunc | |
countallFUNC | |
gcountFUNC | |
gfirstFUNC | |
glastFUNC | |
gminFUNC | |
gmaxFUNC | |
gsumFUNC | |
gproductFUNC | |
gsumsqrFUNC | |
gmeanFUNC | |
gvarianceFUNC | |
gstddevFUNC | |
grmsFUNC | |
ganyFUNC | |
gallFUNC | |
gntrueFUNC | |
gnfalseFUNC | |
FirstAggrArrayFunc | |
gminsFUNC | |
gmaxsFUNC | |
gsumsFUNC | |
gproductsFUNC | |
gsumsqrsFUNC | |
gmeansFUNC | |
gvariancesFUNC | |
gstddevsFUNC | |
grmssFUNC | |
ganysFUNC | |
gallsFUNC | |
gntruesFUNC | |
gnfalsesFUNC | |
LastAggrArrayFunc | |
ghistFUNC | |
gaggrFUNC | |
growidFUNC | |
gmedianFUNC | |
gfractileFUNC | |
gexpridFUNC | |
NRFUNC |
Definition at line 80 of file ExprFuncNode.h.
casacore::TableExprFuncNode::TableExprFuncNode | ( | FunctionType | , | |
NodeDataType | , | |||
ValueType | , | |||
const TableExprNodeSet & | source, | |||
const Table & | = Table() | |||
) |
Constructor.
casacore::TableExprFuncNode::~TableExprFuncNode | ( | ) |
Destructor.
static double casacore::TableExprFuncNode::angdist | ( | double | ra1, | |
double | dec1, | |||
double | ra2, | |||
double | dec2 | |||
) | [inline, static] |
Get the angular distance between two positions on a sphere.
Definition at line 432 of file ExprFuncNode.h.
References casacore::acos(), casacore::cos(), and casacore::sin().
NodeDataType casacore::TableExprFuncNode::argDataType | ( | ) | const [inline] |
Definition at line 383 of file ExprFuncNode.h.
References argDataType_p.
Referenced by casacore::TableExprFuncNodeArray::argDataType().
static NodeDataType casacore::TableExprFuncNode::checkOperands | ( | Block< Int > & | dtypeOper, | |
ValueType & | resVT, | |||
Block< Int > & | vtypeOper, | |||
FunctionType | , | |||
PtrBlock< TableExprNodeRep * > & | ||||
) | [static] |
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.
Reimplemented in casacore::TableExprConeNode.
static void casacore::TableExprFuncNode::fillChildNodes | ( | TableExprFuncNode * | thisNode, | |
PtrBlock< TableExprNodeRep * > & | nodes, | |||
const Block< Int > & | dtypeOper | |||
) | [static] |
Link the children to the node and convert the children to constants if possible.
Reimplemented in casacore::TableExprConeNode.
static TableExprNodeRep* casacore::TableExprFuncNode::fillNode | ( | TableExprFuncNode * | thisNode, | |
PtrBlock< TableExprNodeRep * > & | nodes, | |||
const Block< Int > & | dtypeOper | |||
) | [static] |
Link the children to the node and convert the children to constants if possible.
Also convert the node to constant if possible.
Reimplemented in casacore::TableExprConeNode.
static Double casacore::TableExprFuncNode::fillUnits | ( | TableExprNodeRep * | node, | |
PtrBlock< TableExprNodeRep * > & | nodes, | |||
FunctionType | func | |||
) | [static] |
Fill the result unit in the node.
Adapt the children nodes if their units need to be converted. It returns a possible scale factor in case result unit is SI (for sqrt).
FunctionType casacore::TableExprFuncNode::funcType | ( | ) | const [inline] |
Definition at line 381 of file ExprFuncNode.h.
References funcType_p.
Referenced by casacore::TableExprFuncNodeArray::funcType().
Bool casacore::TableExprFuncNode::getBool | ( | const TableExprId & | id | ) | [virtual] |
'get' Functions to get the desired result of a function
Reimplemented from casacore::TableExprNodeRep.
Reimplemented in casacore::TableExprAggrNode, and casacore::TableExprConeNode.
MVTime casacore::TableExprFuncNode::getDate | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Reimplemented in casacore::TableExprAggrNode.
DComplex casacore::TableExprFuncNode::getDComplex | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Reimplemented in casacore::TableExprAggrNode.
Double casacore::TableExprFuncNode::getDouble | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Reimplemented in casacore::TableExprAggrNode.
Int64 casacore::TableExprFuncNode::getInt | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Reimplemented in casacore::TableExprAggrNode, and casacore::TableExprConeNode.
static std::pair<int,int> casacore::TableExprFuncNode::getMVFormat | ( | const String & | fmt | ) | [static] |
Get the MVTime/Angle format and optional precision.
0,0 is returned if empty or unknown format.
static void casacore::TableExprFuncNode::getPrintFormat | ( | String & | fmt, | |
Int & | width, | |||
Int & | prec, | |||
const PtrBlock< TableExprNodeRep * > & | operands, | |||
const TableExprId & | id | |||
) | [static] |
Get the possible print format, width, and/or precision.
TaqlRegex casacore::TableExprFuncNode::getRegex | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Double casacore::TableExprFuncNode::getScale | ( | ) | const [inline] |
Get possible unit scale factor (needed for sqrt).
Definition at line 372 of file ExprFuncNode.h.
References scale_p.
String casacore::TableExprFuncNode::getString | ( | const TableExprId & | id | ) | [virtual] |
Reimplemented from casacore::TableExprNodeRep.
Reimplemented in casacore::TableExprAggrNode.
static const Unit& casacore::TableExprFuncNode::makeEqualUnits | ( | PtrBlock< TableExprNodeRep * > & | nodes, | |
uInt | starg, | |||
uInt | endarg | |||
) | [static, private] |
Make the units of nodes from starg
till endarg
equal.
Return the unit found.
const PtrBlock<TableExprNodeRep*>& casacore::TableExprFuncNode::operands | ( | ) | const [inline] |
Some functions to be used by TableExprNodeFuncArray.
Definition at line 377 of file ExprFuncNode.h.
References casacore::TableExprNodeMulti::operands_p.
Referenced by casacore::TableExprAggrNode::operand(), and casacore::TableExprFuncNodeArray::operands().
PtrBlock<TableExprNodeRep*>& casacore::TableExprFuncNode::rwOperands | ( | ) | [inline] |
Definition at line 379 of file ExprFuncNode.h.
References casacore::TableExprNodeMulti::operands_p.
Referenced by casacore::TableExprFuncNodeArray::rwOperands().
void casacore::TableExprFuncNode::setScale | ( | Double | scale | ) | [inline] |
Set unit scale factor (needed for sqrt).
Definition at line 368 of file ExprFuncNode.h.
References scale_p.
Referenced by casacore::TableExprFuncNodeArray::setScale().
static DComplex casacore::TableExprFuncNode::string2Complex | ( | const String & | ) | [static] |
Read a string as an integer, double, complex or bool.
static String casacore::TableExprFuncNode::stringAngle | ( | double | val, | |
Int | prec, | |||
MVAngle::formatTypes | type | |||
) | [static] |
Convert angle to a string (hms or dms).
static String casacore::TableExprFuncNode::stringDT | ( | const MVTime & | dt, | |
Int | prec, | |||
MVTime::formatTypes | ||||
) | [static] |
Convert the date and/or time to a string.
static String casacore::TableExprFuncNode::stringValue | ( | const MVTime & | val, | |
const String & | fmt, | |||
Int | width, | |||
const std::pair< int, int > & | mvFormat | |||
) | [static] |
static String casacore::TableExprFuncNode::stringValue | ( | const String & | val, | |
const String & | fmt, | |||
Int | width | |||
) | [static] |
static String casacore::TableExprFuncNode::stringValue | ( | const DComplex & | val, | |
const String & | fmt, | |||
Int | width, | |||
Int | prec | |||
) | [static] |
static String casacore::TableExprFuncNode::stringValue | ( | Double | val, | |
const String & | fmt, | |||
Int | width, | |||
Int | prec, | |||
const std::pair< int, int > & | mvFormat, | |||
const Unit & | unit | |||
) | [static] |
static String casacore::TableExprFuncNode::stringValue | ( | Int64 | val, | |
const String & | fmt, | |||
Int | width | |||
) | [static] |
static String casacore::TableExprFuncNode::stringValue | ( | Bool | val, | |
const String & | fmt, | |||
Int | width | |||
) | [static] |
Convert a value to a string.
If fmt
is empty, ostringstream is used. Otherwise the printf-like format is used. If possible, a double value is converted to radians if formatted as angle.
void casacore::TableExprFuncNode::tryToConst | ( | ) | [private] |
Try if the function gives a constant result.
If so, set the expression type to Constant.
Reimplemented in casacore::TableExprConeNode.
Definition at line 453 of file ExprFuncNode.h.
Referenced by argDataType().
Definition at line 452 of file ExprFuncNode.h.
Referenced by funcType().
Double casacore::TableExprFuncNode::scale_p [private] |
Definition at line 454 of file ExprFuncNode.h.
Referenced by getScale(), and setScale().
Table casacore::TableExprFuncNode::table_p [private] |
(needed for sqrt)
Reimplemented from casacore::TableExprNodeRep.
Definition at line 456 of file ExprFuncNode.h.