solarpowerlog trunk
/home/tobi/workspace/solarpowerlog/src/Inverters/interfaces/ICapaIterator.h
Go to the documentation of this file.
00001 /* ----------------------------------------------------------------------------
00002  solarpowerlog
00003  Copyright (C) 2009  Tobias Frost
00004 
00005  This file is part of solarpowerlog.
00006 
00007  Solarpowerlog is free software; However, it is dual-licenced
00008  as described in the file "COPYING".
00009 
00010  For this file (ICapaIterator.h), the license terms are:
00011 
00012  You can redistribute it and/or  modify it under the terms of the GNU Lesser
00013  General Public License (LGPL) as published by the Free Software Foundation;
00014  either version 3 of the License, or (at your option) any later version.
00015 
00016  This program is distributed in the hope that it will be useful, but
00017  WITHOUT ANY WARRANTY; without even the implied warranty of
00018  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  Lesser General Public License for more details.
00020 
00021  You should have received a copy of the GNU Library General Public
00022  License along with this proramm; if not, see
00023  <http://www.gnu.org/licenses/>.
00024  ----------------------------------------------------------------------------
00025  */
00026 
00033 #ifndef ICAPAITERATOR_H_
00034 #define ICAPAITERATOR_H_
00035 
00036 #ifdef HAVE_CONFIG_H
00037 #include "config.h"
00038 #endif
00039 
00040 
00041 #include <string>
00042 #include <map>
00043 #include "Inverters/interfaces/InverterBase.h"
00044 
00045 class CCapability;
00046 
00052 class ICapaIterator
00053 {
00054 public:
00055 private:
00056      IInverterBase *base;
00057      map<string, CCapability*>::iterator it;
00058 protected:
00059      IInverterBase *parent;
00060 public:
00061      ICapaIterator( IInverterBase *b, IInverterBase *parent = 0 );
00062 
00063      virtual ~ICapaIterator();
00064 
00065      IInverterBase *GetBase();
00066 
00067      virtual void SetBase( IInverterBase *b );
00068 
00069      virtual bool HasNext();
00070 
00071      virtual pair<string, CCapability*> GetNext();
00072 
00073      virtual pair<string, CCapability*> GetElement();
00074 
00075      // TODO Rename that meethod. It has nothing to do with "the parent element",
00076      // but the "parent hierachy element", the one-level-deeper....
00077      IInverterBase *getParent() const
00078      {
00079           return parent;
00080      }
00081 
00082      void setParent( IInverterBase *parent )
00083      {
00084           this->parent = parent;
00085      }
00086 
00087 };
00088 
00089 #endif /* ICAPAITERATOR_H_ */
00090