Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxReduceAdaptor.h

00001 /*
00002  *  Copyright (c) 2000, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *  Author(s):
00006  *  Edo Poll                (poll@wins.uva.nl)
00007  */
00008 
00009 #ifndef HxReduceAdaptor_h
00010 #define HxReduceAdaptor_h
00011 
00012 #include "HxTagList.h"
00013 #include "HxString.h"
00014 
00015 
00016 template<class ReduceOpT>
00017 class HxReduceAdaptor
00018 {
00019 public:
00020     typedef HxTagPixOpOut       DirectionCategory;
00021     typedef HxTagTransInVar     TransVarianceCategory;
00022     typedef HxTagNPhase         PhaseCategory;
00023 
00024     typedef typename ReduceOpT::ArithType ArithType;
00025 
00026                         HxReduceAdaptor(HxTagList& tags)
00027                             : _redOp(tags), _tags(tags) {}
00028 
00029     void                doIt(const ArithType& v) { _redOp.doIt(_r, v); }
00030 
00031     int                 nrPhases() const { return 1; }
00032     void                init(int) { _r = ReduceOpT::neutralElement(); }
00033     void                done(int) { HxAddTag<HxValue>(_tags, "result", _r); }
00034 
00035     static HxString     className() { return ReduceOpT::className(); }
00036 
00037 private:
00038     ArithType           _r;
00039     ReduceOpT           _redOp;
00040     HxTagList&          _tags;
00041 };
00042 
00043 #endif

Generated on Tue Feb 3 14:18:41 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001