functionalcontainer.h

Go to the documentation of this file.
00001 /*----------------------------   functionalcontainer.h     ---------------------------*/
00002 /*      $Id: functionalcontainer.h,v 1.1 2005/11/01 11:31:51 richter Exp $                 */
00003 #ifndef __functionalcontainer_H
00004 #define __functionalcontainer_H
00005 /*----------------------------   functionalcontainer.h     ---------------------------*/
00006 
00007 
00008 #include <map>
00009 #include <string> 
00010 #include "functional.h"
00011 
00012 namespace Gascoigne
00013 {
00014   
00015  class  FunctionalContainer : public std::map<std::string, const Functional*>
00016    {
00017      public:
00018 
00019      void AddFunctional(const std::string& label, const Functional* P)
00020        {
00021          if (find(label)!=end())
00022            {
00023              std::cerr << "Functional " << label << " already present!\n";
00024              assert(0);
00025            }
00026          (*this)[label]=P;
00027        }
00028      
00029      void RemoveFunctional(const std::string& label)
00030        {
00031          if (find(label)==end())
00032            {
00033              std::cerr << "Problemdescriptor " << label << " not present!\n";
00034              assert(0);
00035            }
00036          this->erase(label);
00037        }
00038      
00039      const Functional* GetFunctional(const std::string& label) const
00040        {
00041          if (find(label)==end())
00042            {
00043              std::cerr << "Functional " << label << " not present!\n";
00044              assert(0);
00045            }
00046          return find(label)->second;
00047        }
00048      
00049    };
00050  
00051 }
00052 
00053 
00054 /*----------------------------   functionalcontainer.h     ---------------------------*/
00055 /* end of #ifndef __functionalcontainer_H */
00056 #endif
00057 /*----------------------------   functionalcontainer.h     ---------------------------*/

Generated on Thu Sep 14 10:34:38 2006 for Gascoigne by  doxygen 1.4.7