Go to the documentation of this file.
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/OS/Mutex.h>
39 #include <casacore/casa/stdmap.h>
void getColumnNodes(vector< TableExprNodeRep * > &cols)
Get the nodes in the function operands representing a table column.
void setConstant(Bool isConstant)
Define if the result is constant (e.g.
void setShape(const IPosition &shape)
Set the shape of the results if it is fixed and known.
A Vector of integers, for indexing into Array<T> objects.
const Record & getAttributes() const
Get the attributes.
std::vector< TENShPtr > & operands()
Get the operands.
static void registerUDF(const String &name, MakeUDFObject *func)
Register the name and construction function of a UDF (thread-safe).
const String & getUnit() const
Get the unit.
std::complex< Double > DComplex
Class to handle date/time type conversions and I/O.
virtual void recreateColumnObjects(const Vector< uInt > &rownrs)
Let a derived class recreate its column objects in case a selection has to be applied.
const IPosition & shape() const
Get the result shape if the same for all results.
virtual TaqlRegex getRegex(const TableExprId &id)
virtual void setup(const Table &table, const TaQLStyle &)=0
Set up the function object.
void setUnit(const String &unit)
Set the unit of the result.
UDFBase()
Only default constructor is needed.
void disableApplySelection()
Do not apply the selection.
Abstract base class for a user-defined TaQL function.
virtual Bool getBool(const TableExprId &id)
Evaluate the function and return the result.
static map< String, MakeUDFObject * > theirRegistry
Main interface class to a read/write table.
void init(const std::vector< TENShPtr > &arg, const Table &table, const TaQLStyle &)
Initialize the function object.
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
void getAggrNodes(vector< TableExprNodeRep * > &aggr)
Get the nodes in the function operands representing an aggregate function.
virtual ~UDFBase()
Destructor.
void setAttributes(const Record &attributes)
Set the attributes of the result.
TableExprNodeRep::NodeDataType dataType() const
Get the data type.
std::vector< TENShPtr > itsOperands
void setAggregate(Bool isAggregate)
Define if the UDF is an aggregate function (usually used in GROUPBY).
virtual Int64 getInt(const TableExprId &id)
this file contains all the compiler specific defines
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
virtual MArray< String > getArrayString(const TableExprId &id)
The identification of a TaQL selection subject.
UDFBase * MakeUDFObject(const String &functionName)
The signature of a global or static member function creating an object of the UDF.
void applySelection(const Vector< uInt > &rownrs)
If needed, let the UDF re-create column objects for a selection of rows.
Class with static members defining the TaQL style.
Int ndim() const
Get the dimensionality of the results.
NodeDataType
Define the data types of a node.
virtual MArray< Bool > getArrayBool(const TableExprId &id)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
LatticeExprNode arg(const LatticeExprNode &expr)
virtual String getString(const TableExprId &id)
Bool isConstant() const
Tell if the UDF gives a constant result.
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
void setNDim(Int ndim)
Set the dimensionality of the results.
String: the storage and methods of handling collections of characters.
Wrapper around a pthreads mutex.
bool Bool
Define the standard types used by Casacore.
TableExprNodeRep::NodeDataType itsDataType
virtual MArray< Double > getArrayDouble(const TableExprId &id)
A hierarchical collection of named fields of various types.
void setDataType(TableExprNodeRep::NodeDataType)
Set the data type.
virtual MVTime getDate(const TableExprId &id)
virtual DComplex getDComplex(const TableExprId &id)
Class to handle a Regex or StringDistance.
virtual Double getDouble(const TableExprId &id)
Bool isAggregate() const
Tell if the UDF is an aggregate function.
static UDFBase * createUDF(const String &name, const TaQLStyle &style)
Create a UDF object (thread-safe).