Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parameterlist
src
Teuchos_Dependency.cpp
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
16
Dependency::Dependency
(
17
ConstParameterEntryList
dependees,
18
ParameterEntryList
dependents):
19
dependees_(dependees), dependents_(dependents)
20
{
21
checkDependeesAndDependents();
22
createConstDependents();
23
}
24
25
Dependency::Dependency
(
26
ConstParameterEntryList
dependees,
27
RCP<ParameterEntry>
dependent):
28
dependees_(dependees),
29
dependents_(
ParameterEntryList
(&dependent, &dependent+1))
30
{
31
checkDependeesAndDependents();
32
createConstDependents();
33
}
34
35
36
Dependency::Dependency
(
37
RCP<const ParameterEntry>
dependee,
38
ParameterEntryList
dependents):
39
dependees_(
ConstParameterEntryList
(&dependee, &dependee+1)),
40
dependents_(dependents)
41
{
42
checkDependeesAndDependents();
43
createConstDependents();
44
}
45
46
Dependency::Dependency
(
47
RCP<const ParameterEntry>
dependee,
48
RCP<ParameterEntry>
dependent):
49
dependees_(
ConstParameterEntryList
(&dependee, &dependee+1)),
50
dependents_(
ParameterEntryList
(&dependent, &dependent+1))
51
{
52
checkDependeesAndDependents();
53
createConstDependents();
54
}
55
56
57
void
Dependency::createConstDependents(){
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
74
void
Dependency::checkDependeesAndDependents(){
75
ConstParameterEntryList::iterator it1 = dependees_.begin();
76
for
(; it1 != dependees_.end(); ++it1){
77
TEUCHOS_TEST_FOR_EXCEPTION
((*it1).is_null(),
78
InvalidDependencyException
,
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(),
85
InvalidDependencyException,
86
"Cannot have a null dependent!"
<< std::endl << std::endl);
87
}
88
}
89
90
}
//namespace Teuchos
91
Teuchos::Dependency::getTypeAttributeValue
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...
Teuchos::Dependency::Dependency
Dependency(ConstParameterEntryList dependees, ParameterEntryList dependents)
Constructs a Dependency.
Definition
Teuchos_Dependency.cpp:16
Teuchos::Dependency::ParameterEntryList
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
Definition
Teuchos_Dependency.hpp:41
Teuchos::Dependency::print
virtual void print(std::ostream &out) const
prints out information about the dependency.
Definition
Teuchos_Dependency.cpp:67
Teuchos::Dependency::ConstParameterEntryList
std::set< RCP< const ParameterEntry >, RCPConstComp > ConstParameterEntryList
A list of dependents.
Definition
Teuchos_Dependency.hpp:46
Teuchos::InvalidDependencyException
Definition
Teuchos_InvalidDependencyException.hpp:19
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:397
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
Definition
Teuchos_TestForException.hpp:146
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0