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

A sequence of values produced by your AggregateUDF::finish implementation. More...

#include <MarkLogic.h>

Public Member Functions

Atomic Value Inserters

Use these methods to insert atomic values into a sequence or map.

virtual void  writeValue (int)=0
 
virtual void  writeValue (unsigned)=0
 
virtual void  writeValue (int64_t)=0
 
virtual void  writeValue (uint64_t)=0
 
virtual void  writeValue (float)=0
 
virtual void  writeValue (double)=0
 
virtual void  writeValue (Decimal)=0
 
virtual void  writeValue (DateTime)=0
 
virtual void  writeValue (Date)=0
 
virtual void  writeValue (Time)=0
 
virtual void  writeValue (GYearMonth)=0
 
virtual void  writeValue (GYear)=0
 
virtual void  writeValue (GMonth)=0
 
virtual void  writeValue (GDay)=0
 
virtual void  writeValue (YearMonthDuration)=0
 
virtual void  writeValue (DayTimeDuration)=0
 
virtual void  writeValue (const String &)=0
 
virtual void  writeValue (Point)=0
 
virtual void  writeValue (bool)=0
 
virtual void  writeValue (const LangString &)=0
 
Map Value Construction

Use these methods to construct values of type Map (map:map).

virtual void  startMap ()=0
  Begin adding a map value to the sequence. More...
 
virtual void  writeMapKey (const char *)=0
  Add a key to the map. Use OutputSequence::writeValue to add the value.
 
virtual void  endMap ()=0
  Close off the current map.
 

Detailed Description

A sequence of values produced by your AggregateUDF::finish implementation.

This class encapsulates the sequence of final results returned to calling application. You do not need to subclass this class.

Each item in the sequence can be either an atomic value or a map of key-value pairs. The value in a map key-value pair can be a sequence of atomic values or a map.

For details, see "Implementing AggregateUDF::finish" in the Application Developer's Guide.

Member Function Documentation

virtual void marklogic::OutputSequence::startMap ( )
pure virtual

Begin adding a map value to the sequence.

Add a map to a sequence (or map value) by calling OutputSequence::startMap(). Make alternating calls to OutputSequence::writeMapKey and OutputSequence::writeValue to insert key-value pairs in the map. Call OutputSequence::endMap to close the map. For example:

void Variance::finish(OutputSequence os, Reporter& r)
{
double mean = ...;
double variance = ...;
os.startMap();
os.writeKey("mean");
os.writeValue(mean);
os.writeMapKey("variance");
os.writeValue(variance);
os.endMap();
}

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