Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_Dependency.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 
10 #include "Teuchos_Dependency.hpp"
11 
12 
13 namespace Teuchos{
14 
15 
17 ConstParameterEntryList dependees,
18 ParameterEntryList dependents):
19  dependees_(dependees), dependents_(dependents)
20 {
23 }
24 
26  ConstParameterEntryList dependees,
27  RCP<ParameterEntry> dependent):
28  dependees_(dependees),
29  dependents_(ParameterEntryList(&dependent, &dependent+1))
30 {
33 }
34 
35 
38  ParameterEntryList dependents):
39  dependees_(ConstParameterEntryList(&dependee, &dependee+1)),
40  dependents_(dependents)
41 {
44 }
45 
48  RCP<ParameterEntry> dependent):
49  dependees_(ConstParameterEntryList(&dependee, &dependee+1)),
50  dependents_(ParameterEntryList(&dependent, &dependent+1))
51 {
54 }
55 
56 
58  for(
59  ParameterEntryList::iterator it = dependents_.begin();
60  it != dependents_.end();
61  ++it)
62  {
63  constDependents_.insert(it->getConst());
64  }
65 }
66 
67 void Dependency::print(std::ostream& out) const{
68  out << "Type: " << getTypeAttributeValue() << std::endl;
69  out << "Number of dependees: " << dependees_.size() << std::endl;
70  out << "Number of dependents: " << dependents_.size() << std::endl;
71 
72 }
73 
75  ConstParameterEntryList::iterator it1 = dependees_.begin();
76  for(; it1 != dependees_.end(); ++it1){
77  TEUCHOS_TEST_FOR_EXCEPTION((*it1).is_null(),
79  "Cannot have a null dependee!" << std::endl << std::endl);
80  }
81 
82  ParameterEntryList::iterator it2 = dependents_.begin();
83  for(; it2 != dependents_.end(); ++it2){
84  TEUCHOS_TEST_FOR_EXCEPTION((*it2).is_null(),
86  "Cannot have a null dependent!" << std::endl << std::endl);
87  }
88 }
89 
90 } //namespace Teuchos
91 
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
virtual void print(std::ostream &out) const
prints out information about the dependency.
Dependency()
Declaring and defining the default constructor as private.
ConstParameterEntryList dependees_
The parameters being depended upon.
ParameterEntryList dependents_
The dependent paramters.
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...
void createConstDependents()
creates a const version of the dependent parameters.
ConstParameterEntryList constDependents_
A const version dependent paramters.
Smart reference counting pointer class for automatic garbage collection.
void checkDependeesAndDependents()
makes sure the none of the dependess and dependets are null.