AggComputer.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/exec/AggComputer.h#10 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2005-2009 SQLstream, Inc.
00006 // Copyright (C) 2005-2009 LucidEra, Inc.
00007 //
00008 // This program is free software; you can redistribute it and/or modify it
00009 // under the terms of the GNU General Public License as published by the Free
00010 // Software Foundation; either version 2 of the License, or (at your option)
00011 // any later version approved by The Eigenbase Project.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 #ifndef Fennel_AggComputer_Included
00024 #define Fennel_AggComputer_Included
00025 
00026 #include <boost/ptr_container/ptr_vector.hpp>
00027 #include "fennel/common/FemEnums.h"
00028 
00029 FENNEL_BEGIN_NAMESPACE
00030 
00031 class StoredTypeDescriptor;
00032 class TupleAttributeDescriptor;
00033 class TupleData;
00034 class TupleDatum;
00035 
00047 class FENNEL_EXEC_EXPORT AggComputer
00048 {
00049 protected:
00050     int iInputAttr;
00051 
00052 public:
00053     explicit AggComputer();
00054 
00055     virtual ~AggComputer();
00056 
00065     static AggComputer *newAggComputer(
00066         AggFunction aggFunction,
00067         TupleAttributeDescriptor const *pAttrDesc);
00068 
00075     virtual void setInputAttrIndex(uint iInputAttrIndex);
00076 
00082     virtual void clearAccumulator(
00083         TupleDatum &accumulatorDatum) = 0;
00084 
00093     virtual void updateAccumulator(
00094         TupleDatum &accumulatorDatum,
00095         TupleData const &inputTuple) = 0;
00096 
00105     virtual void computeOutput(
00106         TupleDatum &outputDatum,
00107         TupleDatum const &accumulatorDatum) = 0;
00108 
00118     virtual void initAccumulator(
00119         TupleDatum &accumulatorDatumDest,
00120         TupleData const &inputTuple) = 0;
00121 
00129     virtual void initAccumulator(
00130         TupleDatum &accumulatorDatumSrc,
00131         TupleDatum &accumulatorDatumDest) = 0;
00132 
00143     virtual void updateAccumulator(
00144         TupleDatum &accumulatorDatumSrc,
00145         TupleDatum &accumulatorDatumDest,
00146         TupleData const &inputTuple) = 0;
00147 };
00148 
00149 typedef boost::ptr_vector<AggComputer> AggComputerList;
00150 typedef boost::ptr_vector<AggComputer>::iterator AggComputerIter;
00151 typedef boost::ptr_vector<AggComputer>::const_iterator AggComputerConstIter;
00152 
00153 FENNEL_END_NAMESPACE
00154 
00155 #endif
00156 
00157 // End AggComputer.h

Generated on Mon Jun 22 04:00:18 2009 for Fennel by  doxygen 1.5.1