Sacado Package Browser (Single Doxygen Collection) Version of the Day
Sacado_ParameterFamilyBase.hpp
Go to the documentation of this file.
00001 // $Id$ 
00002 // $Source$ 
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_PARAMETERFAMILYBASE_HPP
00033 #define SACADO_PARAMETERFAMILYBASE_HPP
00034 
00035 #include <map>
00036 #include <string>
00037 #include <iostream>
00038 
00039 #include "Teuchos_RCP.hpp"
00040 #include "Sacado_mpl_apply.hpp"
00041 
00042 namespace Sacado {
00043   
00048   template <typename EntryBase, typename EntryType>
00049   class ParameterFamilyBase  {
00050 
00051   public:
00052   
00054     ParameterFamilyBase(const std::string& name, 
00055       bool supports_ad, 
00056       bool supports_analytic);
00057 
00059     virtual ~ParameterFamilyBase();
00060 
00062     std::string getName() const;
00063 
00065     bool supportsAD() const;
00066 
00068     bool supportsAnalytic() const;
00069 
00071     template <typename EvalType>
00072     bool hasType() const;
00073 
00075 
00079     template <typename EvalType>
00080     bool 
00081     addEntry(const Teuchos::RCP< typename Sacado::mpl::apply<EntryType,EvalType>::type >& entry);
00082 
00084     template <typename EvalType>
00085     Teuchos::RCP< typename Sacado::mpl::apply<EntryType,EvalType>::type > 
00086     getEntry();
00087 
00089     template <typename EvalType>
00090     Teuchos::RCP< const typename Sacado::mpl::apply<EntryType,EvalType>::type >
00091     getEntry() const;
00092 
00094 
00098     void print(std::ostream& os, bool print_values = false) const;
00099 
00100   protected: 
00101 
00103     typedef std::map<std::string, Teuchos::RCP<EntryBase> > EvalMap;
00104 
00106     typedef typename EvalMap::const_iterator const_iterator;
00107 
00109     typedef typename EvalMap::iterator iterator;
00110     
00112     template <class EvalType> std::string getTypeName() const;
00113 
00114   private:
00115 
00117     ParameterFamilyBase(const ParameterFamilyBase&);
00118     
00120     ParameterFamilyBase& operator = (const ParameterFamilyBase&);
00121 
00122   protected:
00123 
00125     EvalMap family;
00126 
00128     const std::string name;
00129 
00131     bool supports_ad;
00132     
00134     bool supports_analytic;
00135 
00136   };
00137 }
00138 
00139 // Include template definitions
00140 #include "Sacado_ParameterFamilyBaseImp.hpp"
00141 
00142 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines