man Lire::Aggregator () - Base class for all aggregator operators

NAME

Lire::Aggregator - Base class for all aggregator operators

SYNOPSIS

    use base qw/ Lire::Aggregator /;

DESCRIPTION

The Lire::Aggregator is the base class for all the aggregator operators available in Lire. It implements behavior common to all the aggregator as well as defining some methods that need to be implemented by subclasses.

In Lire, an aggregator is an operator which will group DLF records. Other operators like avg or sum will then compute values in these groups of DLF records. Aggregators can be nested to compute values on hierarchical groups.

METHODS

ops( [$new_ops] )

Returns the operators contained in this aggregator. The returned value is a reference to an array of Lire::ReportOperator objects.

If the CW$new_ops is used, it changes the content of this aggragagor to these new values. CW$new_ops should be a reference to an array containing Lire::ReportOperator objects. Returns the operator named CW$name in this aggregator. An exception is thrown if there is no such operator. Returns true if this aggregator contains an operator named CW$name.

METHODS FOR SUBCLASSES

This methods implements the print() method required by Lire::ReportOpetor. It prints the XML element named after op() and takes care of writing the XML representation of all the children operation. It also takes care of writing the name and label attribute. Other attributes can be added to the XML element by overriding the xml_attrs() method. Other children elements could be added to the output stream by overriding the print_content() method.

xml_attrs()

This method can be used to write additional XML attributes. The returned string will be output in the XML element. This method prints the operators contained in this aggregator. It can be overriden to add some other elements. FIXME

Subclasses have to override the create_categorical_info() method for this implementation. This method is used by the implementation of create_group_info() to add the categorical ColumnInfo provided by the aggregator. This method is used by Lire::ReportSpec to fill the Lire::Report::Subreport with the entries when creating the subreport.

The CW$subreport parameter contains the Subreport object to which the subreport's entries should get added.

This method will only be called on the top-level aggregator in the report. FIXME FIXME FIXME

MERGING AGGRATOR API

It defines additional methods required by Aggregator implementation to be able to merge data..

The base Aggregator implementation takes care of merging the summary information included in the Lire XML reports.

The merging specifics to the aggregator should be implemented in the init_agggregator_data(), update_aggregator_data() and end_aggregator_data() methods.

This class also takes care of the case when the aggregator is the top-level aggregator, that is the immediate child of the report-calc-spec element in the report specification),

IMPLEMENTATION OF Lire::ReportOperator MERGING METHODS

The default implementation makes sure that all contained operators are inited.

Implementation of specific aggregator must chain up to this method, if they override it.

end_merge()

The default implementation makes sure that all operators gets the end_report() event.

Subclasses should chain up to this method, if they override it.

init_group_data()

The Aggregator implements init_group_data(). It takes care of computing the summary information. Subclass does the equivalent in init_aggregator_data(). The Aggregator implements merge_group_data(). It takes care of merging the summary information. Subclass does the equivalent in merge_aggregator_data().

end_group_data($data)

The Aggregator implements end_group_data(). It takes care of computing the summary information. Subclass does the equivalent in end_aggregator_data(). This method will make sure that the entries of nested aggregator are wrapped up in a Lire::Report::Group element.

There is no reason to override that method since the entries of the aggregator are added in the create_group_entries() method.

METHODS THAT SHOULD BE IMPLEMENTED BY SUBCLASSES FOR MERGING

init_aggregator_data()

This is the equivalent of init_group_data() and is called from Aggregator's implementation of init_group_data(). This method is the equivalent than merge_group_data() and is called from Aggregator's implementation of merge_group_data(). This method is the equivalent of the end_group_data() and is called from Aggregator's implementation of end_group_data(). In this method, the aggregator should add one Lire::Report::Entry object for every group merged by the aggregator.

$group is an instance of Lire::Report::Group to which the entries should be added. CW$data is the data structure returned by init_group_data() for the group in which the aggregator is nested (or the only structure that was created when the aggregator is the top-level aggregator).

In this method, the aggregator must make sure to call add_entry_value() on its contained operators for each entry created.

SEE ALSO

AUTHORS

 Francis J. Lacoste <flacoste@logreport.org>
 Wolgang Sourdeau <wsourdeau@logreport.org>

VERSION

$Id: Aggregator.pm,v 1.28 2004/07/02 16:09:24 flacoste Exp $

COPYRIGHT

Copyright (C) 2001-2004 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.