Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/BdbTag/BdbFastTagTFloatIter.hh

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: BdbFastTagTFloatIter.hh,v 1.3 2002/08/19 18:59:34 becla Exp $
00004 //
00005 // Description:
00006 //      Class BdbFastTagTFloatIter. Interface definition file for 
00007 //      the float iterator for the persistent tag wrapper
00008 //
00009 // Environment:
00010 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00011 //
00012 // Author List:
00013 //      Yemi Adesanya                Original Author
00014 //
00015 // Copyright Information:
00016 //      Copyright (C) 2002              Lawrence Berkeley Laboratory
00017 //
00018 //------------------------------------------------------------------------
00019 
00020 #ifndef BDBFASTTAGTFLOATITER_HH
00021 #define BDBFASTTAGTFLOATITER_HH
00022 
00023 //-----------------
00024 // BaBar Headers --
00025 //-----------------
00026 #include "BaBar/BaBar.hh"
00027 
00028 //----------------------
00029 // Base Class Headers --
00030 //----------------------
00031 #include "AbsEventTag/AbsEventTagFloatIter.hh"
00032 
00033 //-------------------------------
00034 // Collaborating Class Headers --
00035 //-------------------------------
00036 #include "rw/tvhdict.h"
00037 #include "rw/cstring.h"
00038 
00039 //              ---------------------
00040 //              -- Class Interface --
00041 //              ---------------------
00042  
00043 /**
00044  ** The BdbFastTagTFloarIter class. This is an interface for the iterator
00045  ** that retrives float tag elements from the persistent event tag wrapper.
00046  **
00047  ** The event tag contains named integer, float and boolean elements. The
00048  ** name of each element must be unique, independent of the data type.
00049  **
00050  ** Copyright (C) 2002              Lawrence Berkeley National Laboratory
00051  **
00052  ** @version $Id: BdbFastTagTFloatIter.hh,v 1.3 2002/08/19 18:59:34 becla Exp $ 
00053  **
00054  ** @author (David R. Quarrie)          Originator
00055  **/
00056 
00057 class BdbFastTagTFloatIter : public AbsEventTagFloatIter{
00058 
00059 //--------------------
00060 // Instance Members --
00061 //--------------------
00062 
00063 public:
00064 
00065     // Constructors
00066     BdbFastTagTFloatIter( BdbFastTagT& theFastTagT )
00067         : _theFastTagT(theFastTagT),
00068           _fid(0) ,
00069           _returnedFloats(0),
00070           _key(),
00071           _nFields(theFastTagT._theDescr.noOfFields()),
00072           _maxFloats(theFastTagT.numberOfFloats()),
00073           _value(false)
00074     {
00075 
00076 
00077     }
00078 
00079   // Destructor
00080     virtual ~BdbFastTagTFloatIter()
00081     {
00082 
00083     }
00084 
00085     // Operations
00086 
00087     /**
00088      ** Return the next float element from the current tag. The
00089      ** function value indicates whether a new element was located
00090      ** or whether the iterator was exhausted.
00091      **/
00092     virtual bool next( )
00093     {
00094         
00095         if( _returnedFloats >= _maxFloats){
00096             return false; 
00097         }
00098 
00099         HepExplorableFieldType type = eTypeUnused;
00100 
00101         
00102         for(; (type != eTypeFloat) && (_fid < _nFields); _fid++){            
00103             type = _theFastTagT._theDescr.getFieldTypeById( _fid );
00104         } 
00105 
00106         if(type == eTypeUnused){
00107             return false;
00108         }
00109 
00110         _returnedFloats++;
00111         const char* newkey= _theFastTagT._theDescr.getFieldNameById(_fid -1);
00112         _key = newkey;
00113         return _theFastTagT.getFloat(_value,newkey);
00114     
00115        
00116     }
00117 
00118     /**
00119      ** Return the name of the current boolean element within the tag.
00120      **/
00121     virtual const char* key( )
00122     {
00123         return _key.c_str();
00124     }
00125 
00126     /**
00127      ** Return the value of the current boolean element within the tag.
00128      **/
00129     virtual float value( )
00130     {
00131         return _value;
00132     }
00133 
00134 private:
00135 
00136     int _fid;
00137     BdbFastTagT _theFastTagT;
00138     int _returnedFloats;
00139     int _maxFloats;
00140     int _nFields;
00141     float _value;
00142     std::string _key;
00143 };
00144 
00145 #endif

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002