Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestClasses.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 "TestClasses.hpp"
11 
12 
13 int C::A_g_on_delete_ = -2;
14 
15 
16 void deallocA(A* ptr)
17 {
18  std::cout << "\nCalled deallocA(...)!\n";
19  delete ptr;
20 }
21 
22 
23 void deallocHandleA(A** handle)
24 {
25  std::cout << "\nCalled deallocHandleA(...)!\n";
26  A *ptr = *handle;
27  delete ptr;
28  *handle = 0;
29 }
30 
31 
32 struct UndefinedType {
33  int val_;
34 };
35 
36 
38 {
39  Opaque_handle obj = new UndefinedType;
41  return obj;
42 }
43 
44 
46 {
47  return opaque->val_;
48 }
49 
50 
51 void destroyOpaque( Opaque_handle * opaque )
52 {
53  std::cout << "\nCalled destroyOpaque(...)!\n";
54  delete *opaque;
55  *opaque = 0;
56 }
57 
58 
60  int val_;
61 };
62 
63 
65 {
68  return obj;
69 }
70 
71 
73 {
74  return opaque->val_;
75 }
76 
77 
79 {
80  std::cout << "\nCalled destroyOpaque2(...)!\n";
81  delete *opaque;
82  *opaque = 0;
83 }
void destroyOpaque(Opaque_handle *opaque)
Definition: TestClasses.cpp:51
const int getOpaqueValue_return
void destroyOpaque2(Opaque2_handle *opaque)
Definition: TestClasses.cpp:78
const int getOpaque2Value_return
static int A_g_on_delete_
void deallocHandleA(A **handle)
Definition: TestClasses.cpp:23
int getOpaqueValue(Opaque_handle opaque)
Definition: TestClasses.cpp:45
Opaque2_handle createOpaque2()
Definition: TestClasses.cpp:64
Ptr< T > ptr(T *p)
Create a pointer to an object from a raw pointer.
int getOpaque2Value(Opaque2_handle opaque)
Definition: TestClasses.cpp:72
Opaque_handle createOpaque()
Definition: TestClasses.cpp:37
void deallocA(A *ptr)
Definition: TestClasses.cpp:16