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;
120 template <
typename T>
128 void show (ostream& os,
uInt indent)
const override;
165 const std::vector<T>& starts,
166 const std::vector<T>& ends);
171 void show (ostream& os,
uInt indent)
const override;
182 const std::vector<T>& start,
183 const std::vector<T>& end,
184 const std::vector<Bool>& leftC,
185 const std::vector<Bool>& rightC);
216 template <
typename T>
221 const std::vector<T>& starts,
222 const std::vector<T>& ends,
223 const std::vector<Bool>& leftC,
224 const std::vector<Bool>& rightC);
226 void show (ostream& os,
uInt indent)
const override;
257 template <
typename T,
typename LeftComp,
typename RightComp>
262 const std::vector<T>& starts,
263 const std::vector<T>& ends,
264 LeftComp leftCmp, RightComp rightCmp,
267 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.
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.