Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_DependencySheet.cpp
Go to the documentation of this file.
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 
11 
12 
13 namespace Teuchos{
14 
15 
17  name_("DEP_ANONYMOUS")
18 {}
19 
20 DependencySheet::DependencySheet(const std::string &name):
21  name_(name)
22 {}
23 
25  Dependency::ConstParameterEntryList dependees = dependency->getDependees();
26  for(
27  Dependency::ConstParameterEntryList::iterator it = dependees.begin();
28  it != dependees.end();
29  ++it)
30  {
31  dependenciesMap_[*it].insert(dependency);
32  }
33  dependencies_.insert(dependency);
34 }
35 
37  Dependency::ConstParameterEntryList dependees = dependency->getDependees();
38  for(
39  Dependency::ConstParameterEntryList::iterator it = dependees.begin();
40  it != dependees.end();
41  ++it)
42  {
43  dependenciesMap_[*it].erase(dependency);
44  }
45  dependencies_.erase(dependency);
46 }
47 
49  RCP<const ParameterEntry> dependee) const
50 {
51  if(dependenciesMap_.find(dependee) != dependenciesMap_.end()){
52  return rcpFromRef(dependenciesMap_.find(dependee)->second);
53  }
54  return null;
55 }
56 
57 void DependencySheet::printDeps(std::ostream& out) const {
58  out << "Dependency Sheet: " << name_ << std::endl << std::endl;
59  for(DepSet::const_iterator it = depBegin(); it != depEnd(); ++it){
60  (*it)->print(out);
61  }
62 }
63 
65  for(
66  DepSet::iterator it = otherSheet->depBegin();
67  it != otherSheet->depEnd();
68  ++it
69  )
70  {
71  addDependency(*it);
72  }
73 }
74 
75 
76 } //namespace Teuchos
77 
DepSet dependencies_
A simple set of all the dependencies in this Dependency Sheet.
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
DepSet::iterator depBegin()
Returns an iterator to the beginning of all the dependees in the sheet.
std::string name_
The Name of the dependency sheet.
void printDeps(std::ostream &out) const
Prints out a list of the dependencies in the DependencySheet.
void addDependency(RCP< Dependency > dependency)
Adds a dependency to the sheet.
void removeDependency(RCP< Dependency > dependency)
Removes a particular dependency between two parameters.
DependencySheet()
Constructs an empty DependencySheet with the name DEP_ANONYMOUS.
void addDependencies(RCP< DependencySheet > otherSheet)
Adds a dependencies from another she to this sheet.
DataStructure keeping track of dependencies.
DepMap dependenciesMap_
A map containing all the depenecies for a list.
Smart reference counting pointer class for automatic garbage collection.
RCP< const DepSet > getDependenciesForParameter(RCP< const ParameterEntry > dependee) const
Returns a set of all the dependencies associated with a particular dependee. If no dependencies with ...