User-Defined Function API  9.0
 All Classes Functions Typedefs Enumerations Enumerator
marklogic::TupleIterator Class Referenceabstract

Iterator over a sequence of N-way co-occurrences of range index values from a single stand. You do not need to subclass this class. More...

#include <MarkLogic.h>

Public Member Functions

virtual void  next ()=0
  Advance to the next tuple in the sequence.
 
virtual bool  done () const =0
  Test whether or not there are more tuples in the sequence.
 
virtual bool  descending () const =0
  Test whether tuples are in descending order in the sequence.
 
virtual size_t  width () const =0
  Determine the number of values in each tuple.
 
virtual RangeIndex::Type  type (size_t i) const =0
  Determine the type of the Ith value in each tuple.
 
virtual const char *  collation (size_t i) const =0
  If the Ith value in each tuple is a string, determine its collation.
 
virtual const char *  coordinateSystem (size_t i) const =0
  If the Ith value in each tuple is a Point (cts:point), determine its coordinate system.
 
virtual uint64_t  frequency () const =0
  Determine the number of times the current tuple occurs. More...
 
virtual bool  null (size_t i) const =0
  Determine whether or not the Ith position in the current tuple contains a value.
 
Value Extraction

Extract the Ith value from the current tuple.

virtual void  value (size_t i, int &) const =0
  Extract the Ith value in the current tuple. More...
 
virtual void  value (size_t i, unsigned &) const =0
 
virtual void  value (size_t i, int64_t &) const =0
 
virtual void  value (size_t i, uint64_t &) const =0
 
virtual void  value (size_t i, float &) const =0
 
virtual void  value (size_t i, double &) const =0
 
virtual void  value (size_t i, Decimal &) const =0
 
virtual void  value (size_t i, DateTime &) const =0
 
virtual void  value (size_t i, Date &) const =0
 
virtual void  value (size_t i, Time &) const =0
 
virtual void  value (size_t i, GYearMonth &) const =0
 
virtual void  value (size_t i, GYear &) const =0
 
virtual void  value (size_t i, GMonth &) const =0
 
virtual void  value (size_t i, GDay &) const =0
 
virtual void  value (size_t i, YearMonthDuration &) const =0
 
virtual void  value (size_t i, DayTimeDuration &) const =0
 
virtual void  value (size_t i, String &) const =0
 
virtual void  value (size_t i, Point &) const =0
 
virtual void  value (size_t i, LangString &) const =0
 

Detailed Description

Iterator over a sequence of N-way co-occurrences of range index values from a single stand. You do not need to subclass this class.

This class is used to walk the values supplied to your AggregateUDF::map implementation. Each tuple represents one co-occurrence. A tuple contains at most TupleIterator::width values, one value from each range index under consideration. The values within a single tuple are indexed beginning at 0.

Use the positional index when extracting a value from a tuple or accessing metadata such as type or collation. For example, the following walks all values in a tuple sequence:

TupleIterator& iter = ...;
for (; !iter.done(); iter.next()) {
for (int i = 0; i < iter.width(); i++) {
int value;
value(i, value);
...do something with the values...
}

For more details, see "Iterating Over Index Values With TupleIterator" in the Application Developer's Guide.

Member Function Documentation

virtual uint64_t marklogic::TupleIterator::frequency ( ) const
pure virtual

Determine the number of times the current tuple occurs.

If width is one, this is the number of times the value occurs in the range index. If width > 1, this is the number of times the co-occurrence occurs across the input indexes.

virtual void marklogic::TupleIterator::value ( size_t  i,
int &   
) const
pure virtual

Extract the Ith value in the current tuple.

C-style casting between primitive types is performed for you by the API. For example, you can extract a tuple value of type xs:int as a double directly by calling value(size_t, double&). For more details, see "Type Conversions in Aggregate UDFs" in the Application Developer's Guide.


The documentation for this class was generated from the following file: