Teuchos Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Teuchos_DependencySheet.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Teuchos: Common Tools Package
5// Copyright (2004) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38//
39// ***********************************************************************
40// @HEADER
41
42
43
44#ifndef TEUCHOS_DEPENDENCYSHEET_HPP_
45#define TEUCHOS_DEPENDENCYSHEET_HPP_
46
52
53
54namespace Teuchos{
55
56
62
63public:
64
67
71 typedef std::set<RCP<Dependency>, RCPComp > DepSet;
72
78
80
83
88
94 DependencySheet(const std::string &name);
95
97
100
107
115 void addDependencies(RCP<DependencySheet> otherSheet);
116
123 void removeDependency(RCP<Dependency> dependency);
124
128 void setName(const std::string newName){
129 name_ = newName;
130 }
131
133
135
136
145 return (dependenciesMap_.find(dependee) != dependenciesMap_.end()
146 && dependenciesMap_.find(dependee)->second.size() > 0);
147 }
148
157 RCP<const DepSet> getDependenciesForParameter(
159
163 inline const std::string& getName() const{
164 return name_;
165 }
166
170 inline bool empty() const{
171 return dependencies_.empty();
172 }
173
175
178
183 inline DepSet::iterator depBegin(){
184 return dependencies_.begin();
185 }
186
192 inline DepSet::iterator depEnd(){
193 return dependencies_.end();
194 }
195
199 inline DepSet::const_iterator depBegin() const{
200 return dependencies_.begin();
201 }
202
206 inline DepSet::const_iterator depEnd() const{
207 return dependencies_.end();
208 }
209
217 inline DepSet::size_type size(){
218 return dependencies_.size();
219 }
220
222
225
229 void printDeps(std::ostream& out) const;
230
231
234 static const std::string& getNameAttributeName(){
235 static const std::string NAME_ATTRIBUTE_NAME="name";
236 return NAME_ATTRIBUTE_NAME;
237 }
239
240private:
241
244
253
258
262 std::string name_;
263
265
266};
267
268
269}
270#endif //TEUCHOS_DEPENDENCYSHEET_HPP_
#define TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
A Dependency sheet keeps track of dependencies between various ParameterEntries.
DepSet::const_iterator depEnd() const
Returns a const iterator to the end of all of the dependees in the sheet.
bool hasDependents(RCP< const ParameterEntry > dependee) const
Determines whether or not a parameter is depended upon by any another parameters or parameter lists.
void setName(const std::string newName)
sets the name of the dependency sheet
DepSet::iterator depBegin()
Returns an iterator to the beginning of all the dependees in the sheet.
DepSet::const_iterator depBegin() const
Returns a const iterator to the beginning of all the dependees in the sheet.
bool empty() const
Determines whether or not this dependency sheet has any dependencies.
std::set< RCP< Dependency >, RCPComp > DepSet
Convience typedef representing a set of dependencies.
DepMap dependenciesMap_
A map containing all the depenecies for a list.
const std::string & getName() const
Gets the name of the dependency sheet.
DepSet dependencies_
A simple set of all the dependencies in this Dependency Sheet.
std::string name_
The Name of the dependency sheet.
DepSet::size_type size()
Returns the number of Dependencies in this DependencySheet.
map< RCP< const ParameterEntry >, DepSet, RCPConstComp > DepMap
Convience typedef. Maps dependee parameter entries to a set of their corresponding dependencies.
static const std::string & getNameAttributeName()
When serializing to XML, this string should be used as the name of the name attribute.
Concrete serial communicator subclass.
myDepSheet addDependency(basicStringValiDep)
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.