Sacado_ParameterLibraryBase.hpp

Go to the documentation of this file.
00001 // $Id: Sacado_ParameterLibraryBase.hpp,v 1.4 2007/07/09 17:04:03 etphipp Exp $ 
00002 // $Source: /space/CVS/Trilinos/packages/sacado/src/parameter/Sacado_ParameterLibraryBase.hpp,v $ 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 //                           Sacado Package
00007 //                 Copyright (2006) Sandia Corporation
00008 // 
00009 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00010 // the U.S. Government retains certain rights in this software.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
00027 // (etphipp@sandia.gov).
00028 // 
00029 // ***********************************************************************
00030 // @HEADER
00031 
00032 #ifndef SACADO_PARAMETERLIBRARYBASE_HPP
00033 #define SACADO_PARAMETERLIBRARYBASE_HPP
00034 
00035 #include "Teuchos_Array.hpp"
00036 
00037 #include "Sacado_ParameterFamilyBase.hpp"
00038 #include "Sacado_ParameterVectorBase.hpp"
00039 
00040 namespace Sacado {
00041 
00042   using std::string;
00043 
00048   template <typename FamilyType, template<typename> class EntryType>
00049   class ParameterLibraryBase  {
00050 
00051   protected:
00052 
00054     typedef std::map<string, Teuchos::RCP<FamilyType> > FamilyMap;
00055 
00056   public:
00057 
00059     typedef typename FamilyMap::iterator iterator;
00060 
00062     typedef typename FamilyMap::const_iterator const_iterator;
00063   
00065     ParameterLibraryBase();
00066 
00068     virtual ~ParameterLibraryBase();
00069 
00071     bool isParameter(const std::string& name) const;
00072 
00074     template <typename ValueType>
00075     bool isParameterForType(const std::string& name) const;
00076 
00078 
00082     bool addParameterFamily(const std::string& name, bool supports_ad, 
00083           bool supports_analytic);
00084     
00085 
00087 
00091     template <typename ValueType>
00092     bool addEntry(const std::string& name, 
00093       const Teuchos::RCP< EntryType<ValueType> >& entry);
00094 
00096     template <typename ValueType>
00097     Teuchos::RCP< EntryType<ValueType> >
00098     getEntry(const std::string& name);
00099 
00101     unsigned int size() const { return library.size(); }
00102 
00104     iterator begin() { return library.begin(); }
00105 
00107     const_iterator begin() const { return library.begin(); }
00108 
00110     iterator end() { return library.end(); }
00111 
00113     const_iterator end() const { return library.end(); }
00114 
00116     template <typename BaseValueType>
00117     void
00118     fillVector(const Teuchos::Array<std::string>& names,
00119          const Teuchos::Array<BaseValueType>& values,
00120          ParameterVectorBase<FamilyType,BaseValueType>& pv);
00121 
00122   private:
00123 
00125     ParameterLibraryBase(const ParameterLibraryBase&);
00126 
00128     ParameterLibraryBase& operator = (const ParameterLibraryBase&);
00129 
00130   protected:
00131 
00133     FamilyMap library;
00134   };
00135 }
00136 
00137 // Include template definitions
00138 #include "Sacado_ParameterLibraryBaseImp.hpp"
00139 
00140 #endif

Generated on Wed May 12 21:59:04 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7