26#ifndef TABLES_EXPRNODESETOPT_H
27#define TABLES_EXPRNODESETOPT_H
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/ExprNodeRep.h>
32#include <unordered_map>
37 class TableExprNodeSet;
123 template <
typename T>
131 void show (ostream& os,
uInt indent)
const override;
170 const std::vector<T>& starts,
171 const std::vector<T>& ends);
176 void show (ostream& os,
uInt indent)
const override;
187 const std::vector<T>& start,
188 const std::vector<T>& end,
189 const std::vector<Bool>& leftC,
190 const std::vector<Bool>& rightC);
221 template <
typename T>
226 const std::vector<T>& starts,
227 const std::vector<T>& ends,
228 const std::vector<Bool>& leftC,
229 const std::vector<Bool>& rightC);
231 void show (ostream& os,
uInt indent)
const override;
265 template <
typename T,
typename LeftComp,
typename RightComp>
270 const std::vector<T>& starts,
271 const std::vector<T>& ends,
272 LeftComp leftCmp, RightComp rightCmp,
275 void show (ostream& os,
uInt indent)
const override;
String: the storage and methods of handling collections of characters.
Abstract base class for a node in a table column expression tree.
virtual Bool contains(const TableExprId &id, Bool value)
Does a set or array contain the value? The default implementation assumes the set is a single scalar,...
TableExprNodeSetOptBase(const TableExprNodeRep &orig)
Bool contains(const TableExprId &id, String value) override
Bool contains(const TableExprId &id, Double value) override
MArray< Bool > contains(const TableExprId &id, const MArray< Double > &value) override
MArray< Bool > contains(const TableExprId &id, const MArray< Int64 > &value) override
Tell for each array value if the set contains that value.
MArray< Bool > contains(const TableExprId &id, const MArray< String > &value) override
Bool contains(const TableExprId &id, Int64 value) override
Does the set contain the given value? They call the find function.
virtual Int64 find(String value) const
virtual Int64 find(Double value) const
virtual Int64 find(Int64 value) const
Tell which key matches a value.
An optimized representation of a selection set with continuous intervals.
static TENShPtr createOptSet(const TableExprNodeSet &set, const std::vector< T > &start, const std::vector< T > &end, const std::vector< Bool > &leftC, const std::vector< Bool > &rightC)
Create the appropriate optimized OptContSet object.
static TENShPtr transform(const TableExprNodeSet &set, Bool combine=True)
Transform a set into an optimized one by ordering the intervals and optionally combining adjacent int...
std::vector< T > itsStarts
TableExprNodeSetOptContSetBase(const TableExprNodeSet &orig, const std::vector< T > &starts, const std::vector< T > &ends)
Construct from the original set and the start and end values of the intervals.
size_t size() const
Get the size (nr of intervals).
void show(ostream &os, uInt indent) const override
Show the node.
An optimized representation of a selection set with continuous intervals.
TableExprNodeSetOptContSetMixOC(const TableExprNodeSet &orig, const std::vector< T > &starts, const std::vector< T > &ends, const std::vector< Bool > &leftC, const std::vector< Bool > &rightC)
std::vector< Bool > itsLeftC
Int64 find(T value) const override
Tell which interval contains a value.
void show(ostream &os, uInt indent) const override
Show the node.
std::vector< Bool > itsRightC
An optimized representation of a selection set with similar intervals.
void show(ostream &os, uInt indent) const override
Show the node.
TableExprNodeSetOptContSet(const TableExprNodeSet &orig, const std::vector< T > &starts, const std::vector< T > &ends, LeftComp leftCmp, RightComp rightCmp, const String &cmpType)
Int64 find(T value) const override
Tell which interval contains a value.
An optimized representation of a discrete selection set.
std::unordered_map< T, Int64 > itsMap
Int64 find(T value) const override
Where does a value occur in the set? -1 is no match.
void show(ostream &os, uInt indent) const override
Show the node.
TableExprNodeSetOptUSet(const TableExprNodeRep &orig, const Array< T > &)
Construct an empty set.
this file contains all the compiler specific defines
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
std::shared_ptr< TableExprNodeRep > TENShPtr
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.