Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_Dependency.hpp
1// @HEADER
2// *****************************************************************************
3// Teuchos: Common Tools Package
4//
5// Copyright 2004 NTESS and the Teuchos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TEUCHOS_DEPENDENCY_HPP_
11#define TEUCHOS_DEPENDENCY_HPP_
12#include "Teuchos_RCP.hpp"
14#include "Teuchos_InvalidDependencyException.hpp"
15#include <set>
22namespace Teuchos{
23
24
31class TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT Dependency : public Describable{
32
33public:
34
37
41 typedef std::set<RCP<ParameterEntry>, RCPComp > ParameterEntryList;
42
46 typedef std::set<RCP<const ParameterEntry>, RCPConstComp > ConstParameterEntryList;
47
49
52
62
72
82
92
94
96
97
104 return dependees_;
105 }
106
113 return dependents_;
114 }
115
122 return constDependents_;
123 }
124
125
130 return *(dependees_.begin());
131 }
132
139 template<class S>
140 inline S getFirstDependeeValue() const{
141 return getValue<S>(*(*(dependees_.begin())));
142 }
143
148 virtual std::string getTypeAttributeValue() const = 0;
149
150
154 static const std::string& getXMLTagName(){
155 static const std::string xmlTagName = "Dependency";
156 return xmlTagName;
157 }
158
160
163
168 virtual void evaluate() = 0;
169
171
174
176 virtual void print(std::ostream& out) const;
177
179
180protected:
181
184
190 virtual void validateDep() const = 0;
191
193
194 private:
195
198
202 ConstParameterEntryList dependees_;
203
207 ParameterEntryList dependents_;
208
212 ConstParameterEntryList constDependents_;
213
217 Dependency(){}
218
222 void createConstDependents();
223
227 void checkDependeesAndDependents();
228
230
231};
232
233
234} //namespace Teuchos
235#endif //TEUCHOS_DEPENDENCY_HPP_
Templated Parameter List class.
Reference-counted pointer class and non-member templated function implementations.
This class represents a depndency between elements in a Parameter List.
virtual std::string getTypeAttributeValue() const =0
Returns the string to be used for the value of the type attribute when converting the dependency to X...
ParameterEntryList & getDependents()
Gets the dependents of the dependency.
static const std::string & getXMLTagName()
Returns the XML tag to use when serializing Dependencies.
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
S getFirstDependeeValue() const
Convienence function. Returns the first dependee in the list of dependees.
const ConstParameterEntryList & getDependents() const
Gets the dependents of the dependency.
virtual void evaluate()=0
Evaluates the dependency and makes any appropriate changes to the dependee based on the dependent.
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
virtual void validateDep() const =0
Validates the dependency to make sure it's valid/has been setup properly. If subclassing,...
RCP< const ParameterEntry > getFirstDependee() const
Gets the first dependee in the dependees list. This is a convience function.
const ConstParameterEntryList & getDependees() const
Gets the dependees of the dependency.
Base class for all objects that can describe themselves.
Smart reference counting pointer class for automatic garbage collection.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Struct for comparing two RCPs. Simply compares the raw pointers contained within the RCPs.
Struct for comparing two RCPs. Simply compares the raw pointers contained within the RCPs.