Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

AbstractAggregator Class Reference

#include <coherence/util/aggregator/AbstractAggregator.hpp>

Inherits Object, PortableObject, and InvocableMap::ParallelAwareAggregator.

Inherited by AbstractComparableAggregator, AbstractFloat64Aggregator, AbstractInteger64Aggregator, DistinctValues, and ReducerAggregator.

List of all members.


Detailed Description

Abstract base class implementation of coherence::util::InvocableMap::EntryAggregator that supports parallel aggregation.

Author:
djl 2008.05.09

Public Types

typedef spec::Handle Handle
 AbstractAggregator Handle definition.
typedef spec::View View
 AbstractAggregator View definition.
typedef spec::Holder Holder
 AbstractAggregator Holder definition.

Public Member Functions

virtual Object::Holder aggregate (Set::View vSetEntries)
 Process a set of InvocableMap::Entry objects in order to produce an aggregated result.

Parameters:
vSetEntries a Set of read-only InvocableMap::Entry objects to aggregate
Returns:
the aggregated result from processing the entries

virtual
InvocableMap::EntryAggregator::Handle 
getParallelAggregator ()
 Get an aggregator that can take the place of this aggregator in situations in which the InvocableMap can aggregate in parallel.

Returns:
the aggregator that will be run in parallel

virtual Object::Holder aggregateResults (Collection::View vCollResults)
 Aggregate the results of the parallel aggregations.

Parameters:
vCollResults the parallel aggregation results
Returns:
the aggregation of the parallel aggregation results

virtual void readExternal (PofReader::Handle hIn)
 
virtual void writeExternal (PofWriter::Handle hOut) const
 
virtual bool equals (Object::View v) const
 
virtual size32_t hashCode () const
 Return a hash code value for the Object.

This method is supported for the benefit of hash-based containers.

The general contract of hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object

virtual void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
out the stream used to output the description

virtual
ValueExtractor::View 
getValueExtractor () const
 Determine the ValueExtractor whose values this aggregator is aggregating.

Protected Member Functions

 AbstractAggregator (String::View vsMethod)
 Construct an AbstractAggregator that will aggregate values extracted from a set of InvocableMap::Entry objects.
virtual void init (bool fFinal)=0
 Initialize the aggregation result.
virtual void process (Object::View vO, bool fFinal)=0
 Incorporate one aggregatable value into the result.
virtual Object::Holder finalizeResult (bool fFinal)=0
 Obtain the result of the aggregation.

Protected Attributes

bool m_fParallel
 Set to true if this aggregator realizes that it is going to be used in parallel.
FinalView
< ValueExtractor
f_vExtractor
 The ValueExtractor that obtains the value to aggregate from the value that is stored in the Map.

Constructor & Destructor Documentation

AbstractAggregator ( String::View  vsMethod  )  [protected]

Construct an AbstractAggregator that will aggregate values extracted from a set of InvocableMap::Entry objects.

Parameters:
vsMethod the name of the method that could be invoked via reflection and that returns values to aggregate; this parameter can also be a dot-delimited sequence of method names which would result in an aggregator based on the ChainedExtractor that is based on an array of corresponding ReflectionExtractor objects
Since:
Coherence 12.1.2


Member Function Documentation

virtual void init ( bool  fFinal  )  [protected, pure virtual]

Initialize the aggregation result.

Parameters:
fFinal true is passed if the aggregation process that is being initialized must produce a final aggregation result; this will only be false if a parallel approach is being used and the initial (partial) aggregation process is being initialized

Implemented in AbstractComparableAggregator, AbstractFloat64Aggregator, AbstractInteger64Aggregator, DistinctValues, Float64Average, Float64Max, Float64Min, Float64Sum, Integer64Max, Integer64Min, Integer64Sum, and ReducerAggregator.

virtual void process ( Object::View  vO,
bool  fFinal 
) [protected, pure virtual]

Incorporate one aggregatable value into the result.

If the fFinal parameter is true, the given object is a partial result (returned by an individual parallel aggregator) that should be incorporated into the final result; otherwise, the object is a value extracted from an coherence::util::InvocableMap::Entry.

Parameters:
vO the value to incorporate into the aggregated result
fFinal true to indicate that the given object is a partial result returned by a parallel aggregator

Implemented in ComparableMax, ComparableMin, DistinctValues, Float64Average, Float64Max, Float64Min, Float64Sum, Integer64Max, Integer64Min, Integer64Sum, and ReducerAggregator.

virtual Object::Holder finalizeResult ( bool  fFinal  )  [protected, pure virtual]

Obtain the result of the aggregation.

If the fFinal parameter is true, the returned object must be the final result of the aggregation; otherwise, the returned object will be treated as a partial result that should be incorporated into the final result.

Parameters:
fFinal true to indicate that the final result of the aggregation process should be returned; this will only be false if a parallel approach is being used
Returns:
the result of the aggregation process

Implemented in AbstractComparableAggregator, AbstractFloat64Aggregator, AbstractInteger64Aggregator, DistinctValues, Float64Average, and ReducerAggregator.

virtual ValueExtractor::View getValueExtractor (  )  const [virtual]

Determine the ValueExtractor whose values this aggregator is aggregating.

Returns:
the ValueExtractor used by this aggregator


The documentation for this class was generated from the following file:
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.