28 #ifndef TABLES_UDFBASE_H
29 #define TABLES_UDFBASE_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/TaQL/ExprNodeRep.h>
34 #include <casacore/tables/Tables/Table.h>
35 #include <casacore/tables/TaQL/TaQLStyle.h>
36 #include <casacore/casa/Containers/Record.h>
37 #include <casacore/casa/Containers/Block.h>
38 #include <casacore/casa/stdmap.h>
String: the storage and methods of handling collections of characters.
NodeDataType
Define the data types of a node.
const Record & getAttributes() const
Get the attributes.
virtual Double getDouble(const TableExprId &id)
std::vector< TENShPtr > & operands()
Get the operands.
TableExprNodeRep::NodeDataType itsDataType
void setAttributes(const Record &attributes)
Set the attributes of the result.
virtual MArray< String > getArrayString(const TableExprId &id)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
const IPosition & shape() const
Get the result shape if the same for all results.
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
void setDataType(TableExprNodeRep::NodeDataType)
Set the data type.
virtual Int64 getInt(const TableExprId &id)
TableExprNodeRep::NodeDataType dataType() const
Get the data type.
virtual MVTime getDate(const TableExprId &id)
void init(const std::vector< TENShPtr > &arg, const Table &table, const TaQLStyle &)
Initialize the function object.
virtual TaqlRegex getRegex(const TableExprId &id)
void applySelection(const Vector< rownr_t > &rownrs)
If needed, let the UDF re-create column objects for a selection of rows.
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Int ndim() const
Get the dimensionality of the results.
void setAggregate(Bool isAggregate)
Define if the UDF is an aggregate function (usually used in GROUPBY).
Bool isAggregate() const
Tell if the UDF is an aggregate function.
UDFBase * MakeUDFObject(const String &functionName)
The signature of a global or static member function creating an object of the UDF.
void setUnit(const String &unit)
Set the unit of the result.
static UDFBase * createUDF(const String &name, const TaQLStyle &style)
Create a UDF object (thread-safe).
virtual void recreateColumnObjects(const Vector< rownr_t > &rownrs)
Let a derived class recreate its column objects in case a selection has to be applied.
std::vector< TENShPtr > itsOperands
UDFBase()
Only default constructor is needed.
virtual Bool getBool(const TableExprId &id)
Evaluate the function and return the result.
virtual DComplex getDComplex(const TableExprId &id)
void setConstant(Bool isConstant)
Define if the result is constant (e.g.
void getAggrNodes(vector< TableExprNodeRep * > &aggr)
Get the nodes in the function operands representing an aggregate function.
void setNDim(Int ndim)
Set the dimensionality of the results.
void getColumnNodes(vector< TableExprNodeRep * > &cols)
Get the nodes in the function operands representing a table column.
static std::recursive_mutex theirMutex
virtual ~UDFBase()
Destructor.
static map< String, MakeUDFObject * > theirRegistry
Bool isConstant() const
Tell if the UDF gives a constant result.
void disableApplySelection()
Do not apply the selection.
virtual String getString(const TableExprId &id)
static void registerUDF(const String &name, MakeUDFObject *func)
Register the name and construction function of a UDF (thread-safe).
void setShape(const IPosition &shape)
Set the shape of the results if it is fixed and known.
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
const String & getUnit() const
Get the unit.
virtual void setup(const Table &table, const TaQLStyle &)=0
Set up the function object.
std::complex< Double > DComplex
this file contains all the compiler specific defines
LatticeExprNode arg(const LatticeExprNode &expr)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
bool Bool
Define the standard types used by Casacore.