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