Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
core
example
ExplicitInstantiation
four_files
evilMain.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
11
// The client just includes the basic *.hpp forms without having the worry
12
// about implicit or explicit instantiation!
13
#include "
EvilBase.hpp
"
14
#include "
AEvil.hpp
"
15
#include "
BEvil.hpp
"
16
17
18
template
<
class
T>
19
void
testEvil
(
const
T& obj)
20
{
21
22
using
Teuchos::RCP
;
23
using
Teuchos::rcp_dynamic_cast;
24
using
EvilPack::EvilBase
;
25
using
EvilPack::AEvil
;
26
using
EvilPack::BEvil
;
27
28
RCP<AEvil<T> >
aEvil
=
29
rcp_dynamic_cast
<AEvil<T> >(EvilBase<T>::createEvil(
"AEvil"
));
30
RCP<BEvil<T> >
bEvil
=
31
rcp_dynamic_cast
<BEvil<T> >(EvilBase<T>::createEvil(
"BEvil"
));
32
33
aEvil->soundOff(obj);
34
bEvil->soundOff(obj);
35
aEvil->callBEvil(*bEvil, obj);
36
bEvil->callAEvil(*aEvil, obj);
37
38
}
39
40
41
int
main
()
42
{
43
testEvil<double>(1.0);
44
testEvil<int>(2);
45
return
0;
46
}
Teuchos::RCP::rcp_dynamic_cast
RCP< T2 > rcp_dynamic_cast(const RCP< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying RCP type from T1* to T2*.
EvilPack::AEvil
A subclass of EvilBase that calls BEvil.
Definition:
AEvil_decl.hpp:28
testEvil
void testEvil(const T &obj)
Definition:
evilMain.cpp:19
EvilBase.hpp
EvilPack::AEvil::aEvil
RCP< AEvil< T > > aEvil()
Nonmember constructor.
Definition:
AEvil_decl.hpp:43
main
int main(int argc, char *argv[])
Definition:
core/example/CommandLineProcessor/cxx_main.cpp:21
AEvil.hpp
BEvil.hpp
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition:
Teuchos_RCPDecl.hpp:397
EvilPack::EvilBase
Evil base class that people often write with a factory function to all of the subclasses in the inter...
Definition:
EvilBase_decl.hpp:28
EvilPack::BEvil::bEvil
RCP< BEvil< T > > bEvil()
Nonmember constructor.
Definition:
BEvil_decl.hpp:43
EvilPack::BEvil
A subclass of EvilBase that calls AEvil.
Definition:
AEvil_decl.hpp:22
Generated on Fri Dec 20 2024 09:21:21 for Teuchos Package Browser (Single Doxygen Collection) by
1.8.5