VR-Forces 4.7 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
appsrc
vrvTester
testDtSubjectBinder.h
Go to the documentation of this file.
1
2
#include <UnitTest++.h>
3
#include "
commonFixutres.h
"
4
#include <
vrvCore/DtSubjectAnnouncer.h
>
5
#include <
vrvCore/DtSubjectObserver.h
>
6
7
9
// TestSubject
11
12
class
TestSubject
13
{
14
15
public
:
16
17
TestSubject
(
makVrv::DtDe
& de);
18
19
virtual
~TestSubject
();
20
23
static
const
char
*
className
();
24
25
protected
:
26
27
makVrv::DtDe
&
myDe
;
28
static
const
char
*
myClassName
;
29
30
};
31
32
33
typedef
makVrv::DtSubjectAnnouncer<TestSubject>
TestSubjectAnnouncer
;
34
35
const
char
*
TestSubject::myClassName
=
"TestSubject"
;
36
37
TestSubject::TestSubject
(
makVrv::DtDe
& de)
38
: myDe(de)
39
{
40
// Activate user interface components
41
TestSubjectAnnouncer
* announcer =
TestSubjectAnnouncer::findInstance
(
myDe
);
42
if
(announcer)
43
{
44
announcer->
activate
(
this
);
45
}
46
};
47
48
TestSubject::~TestSubject
()
49
{
50
// Deactivate user interface components
51
TestSubjectAnnouncer
* announcer =
TestSubjectAnnouncer::findInstance
(
myDe
);
52
if
(announcer)
53
{
54
announcer->
deactivate
(
this
);
55
}
56
}
57
58
const
char
*
TestSubject::className
()
59
{
60
return
myClassName
;
61
}
62
63
65
// TestObserverLogic
67
68
typedef
makVrv::DtSubjectObserver<TestSubject>
TestSubjectObserver
;
69
70
class
TestObserverLogic
:
TestSubjectObserver
71
{
72
73
public
:
74
75
static
TestObserverLogic
*
create
(
makVrv::DtDe
& de);
76
77
bool
slotActivateCalled
();
78
79
virtual
void
slot_activate
(
TestSubject
* subject);
80
81
virtual
void
slot_deactivate
(
TestSubject
* subject);
82
83
protected
:
84
85
TestObserverLogic
(
makVrv::DtDe
& de);
86
87
bool
mySlotActivatedCalledFlag
;
88
89
};
90
91
TestObserverLogic
*
TestObserverLogic::create
(
makVrv::DtDe
& de )
92
{
93
TestObserverLogic
* logic =
new
TestObserverLogic
(de);
94
logic->
bind
(de);
95
return
logic;
96
}
97
98
TestObserverLogic::TestObserverLogic
(
makVrv::DtDe
& de )
99
: mySlotActivatedCalledFlag(false)
100
{
101
}
102
103
bool
TestObserverLogic::slotActivateCalled
()
104
{
105
return
mySlotActivatedCalledFlag
;
106
}
107
108
void
TestObserverLogic::slot_activate
(
TestSubject
* subject )
109
{
110
mySlotActivatedCalledFlag
=
true
;
111
}
112
113
void
TestObserverLogic::slot_deactivate
(
TestSubject
* subject )
114
{
115
}
Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (
www.mak.com
)