Aggregator(3pm)
π Aggregator(3pm) β Lire::Aggregator
okay bestie, welcome to Lire::Aggregator, the base class for all aggregator operators in LogReport's Lire docs. She's the mother of aggregators, the blueprint, the main character that all the other aggregator operators inherit their whole vibe from π
β¨ SYNOPSIS β¨
use base qw/ Lire::Aggregator /;
that's it. one line. she's lowkey humble like that π
πΈ DESCRIPTION πΈ
Lire::Aggregator is the base class for all the aggregator operators available in Lire. She implements the behavior that's common to every aggregator, and she also defines the methods that subclasses have to implement themselves (yeah, homework, sorry bestie π).
So what even is an aggregator in Lire? Okay so: an aggregator is an operator which will group DLF records. That's her whole job. Then other operators like avg or sum come in and compute values inside these groups of DLF records. And the cute part? Aggregators can be nested, so you can compute values on hierarchical groups. Layers on layers, iykyk π¦
π 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 $new_ops is used, it changes the content of this aggragagor to these new values. $new_ops should be a reference to an array containing Lire::ReportOperator objects.
π«Ά op_by_name( $name )
Returns the operator named $name in this aggregator. An exception is thrown if there is no such operator β so like, don't go asking for operators that don't exist, she will literally throw hands π
π«Ά is_name_defined( $name )
Returns true if this aggregator contains an operator named $name. Just a lil vibe check, returns true or false, no drama β¨
π§ METHODS FOR SUBCLASSES π§
β print( $fh, $pfx )
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. Slay, customization π
β xml_attrs()
This method can be used to write additional XML attributes. The returned string will be output in the XML element.
β print_content( $fh, $pfx )
This method prints the operators contained in this aggregator. It can be overriden to add some other elements. Fancy π
β create_group_info( $info )
FIXME
Subclasses have to override the create_categorical_info() method for this implementation. (yes girl, the FIXME is canon, I don't make the rules π)
β create_categorical_info( $info )
This method is used by the implementation of create_group_info() to add the categorical ColumnInfo provided by the aggregator.
β create_entries( $subreport )
This method is used by Lire::ReportSpec to fill the Lire::Report::Subreport with the entries when creating the subreport.
The $subreport parameter contains the Subreport object to which the subreport's entries should get added.
Heads up bestie: this method will only be called on the top-level aggregator in the report. Only the queen bee gets this call π
β build_query( $query )
FIXME
β set_group_summary( $group, $row )
FIXME
β create_entry( $group, $row )
FIXME
π₯ MERGING AGGRATOR API π₯
It defines additional methods required by Aggregator implementation to be able to merge data.. (the double period is hers, we respect it π)
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 π
π init_merge( $period_start, $period_end )
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. no skipping, bestie, chain up π
π 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().
π merge_group_data( $value, $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().
π add_entry_value( $entry, $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. don't do it, she's already handling it π
π¦ 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().
πΈ merge_aggregator_data( $value, $data )
This method is the equivalent than merge_group_data() and is called from Aggregator's implementation of merge_group_data().
πΈ end_aggregator_data( $data )
This method is the equivalent of the end_group_data() and is called from Aggregator's implementation of end_group_data().
πΈ create_group_entries( $group, $data )
In this method, the aggregator should add one Lire::Report::Entry object for every group merged by the aggregator. one entry per group, no cap π
$group is an instance of Lire::Report::Group to which the entries should be added. $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. literally mandatory, bestie π«Ά
β SEE ALSO β
Lire::ReportSpec(3pm)Lire::Aggregate(3pm)Lire::ReportOperator(3pm)Lire::Group(3pm)Lire::Timegroup(3pm)Lire::Timeslot(3pm)Lire::Rangegroup(3pm)
go read those next, they're the friend group π
π AUTHORS π
- Francis J. Lacoste
<flacoste@logreport.org> - Wolgang Sourdeau
<wsourdeau@logreport.org>
π VERSION π
$Id: Aggregator.pm,v 1.29 2006/07/23 13:16:27 vanbaal 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.
ngl the all-caps warranty disclaimer is giving "mom reading the terms and conditions out loud" but it's real and it matters, so bestie please actually read it ππ
and that's the whole page, bestie!! this was Lire 2.1.1, dated 2025-09-28 β go forth and aggregate hierarchically, you absolute icon π§β¨π
π¦ where this page comes from
- arch rolling: lire 2.1.1-8 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms