Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sacado_ParameterAccessor.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Sacado Package
4 //
5 // Copyright 2006 NTESS and the Sacado contributors.
6 // SPDX-License-Identifier: LGPL-2.1-or-later
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef SACADO_PARAMETERACCESSOR_HPP
11 #define SACADO_PARAMETERACCESSOR_HPP
12 
13 #include <vector>
14 #include "Teuchos_RCP.hpp"
17 
18 namespace Sacado {
19 
20  template <typename EvalType, typename EvalTypeTraits>
22 
28  template<typename EvalType,
29  typename EvalTypeTraits = DefaultEvalTypeTraits>
31  private:
32  typedef typename EvalTypeTraits::template apply<EvalType>::type ScalarT;
33 
34  public:
35 
37 
38  virtual ~ParameterAccessor() {};
39 
42  virtual ScalarT& getValue(const std::string &n) = 0;
43 
46  virtual void setValue(const std::string &n, const ScalarT& v) {
47  getValue(n) = v;
48  }
49 
50  void registerSacadoParameter(const std::string& name,
51  ParamLib& paramLib);
52 
53  void registerSacadoParameter(const std::string& name,
54  const Teuchos::RCP<ParamLib>& paramLib);
55 
56  private:
57  std::vector< Teuchos::RCP< ParameterRegistration<EvalType, EvalTypeTraits> > > pr_;
58  };
59 }
60 
61 // Include implementation
63 
64 #endif
EvalTypeTraits::template apply< EvalType >::type ScalarT
virtual ScalarT & getValue(const std::string &n)=0
Parameter class for simple registration of a parameter with a Parameter Library. Requires a parameter...
virtual void setValue(const std::string &n, const ScalarT &v)
std::vector< Teuchos::RCP< ParameterRegistration< EvalType, EvalTypeTraits > > > pr_
ScalarParameterLibrary< EvalTypeTraits > ParamLib
void registerSacadoParameter(const std::string &name, ParamLib &paramLib)
Specialization of Sacado::ParameterLibraryBase for scalar parameters.
Base traits definition mapping evaluation types to value types.
Abstract class that provides access to a parameter value in a code for the parameter library...