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
include
vrfutil
sequentialExecutionContainer.h
Go to the documentation of this file.
1
/****************************************************************************
2
* Copyright (c) 2014 VT MAK
3
* All rights reserved.
4
****************************************************************************/
5
8
9
#pragma once
10
11
#include <
vrfutil/executionContainer.h
>
12
#include <vector>
13
17
template
<
class
Texec>
18
class
DtSequentialExecutionContainer
:
public
DtExecutionContainer
<Texec>
19
{
20
public
:
21
22
typedef
typename
std::vector<Texec *>
SecContainerType
;
23
typedef
typename
SecContainerType::iterator
SecIteratorType
;
24
25
public
:
26
28
DtSequentialExecutionContainer
()
29
:
myExecVec
()
30
{
31
}
32
35
virtual
~DtSequentialExecutionContainer
() { }
36
39
virtual
void
add
(Texec *item) {
myExecVec
.push_back(item); }
40
43
virtual
void
remove
(Texec *item) {
myExecVec
.erase(std::remove(
myExecVec
.begin(),
myExecVec
.end(), item),
myExecVec
.end()); }
44
46
virtual
void
clear
() {
myExecVec
.clear(); }
47
51
virtual
void
deleteAndClear
();
52
55
virtual
bool
empty
()
const
{
return
myExecVec
.empty(); }
56
60
virtual
bool
contains
(Texec *item) {
return
std::find(
begin
(),
end
(), item) !=
end
(); }
61
64
virtual
SecIteratorType
begin
() {
return
myExecVec
.begin(); }
66
virtual
SecIteratorType
end
() {
return
myExecVec
.end(); }
67
70
virtual
void
executeMethod
(
void
(Texec::*theMethodPtr)());
71
72
protected
:
73
75
SecContainerType
myExecVec
;
76
77
};
78
79
template
<
class
Texec>
80
inline
void
DtSequentialExecutionContainer<Texec>::deleteAndClear
()
81
{
84
for
(
SecIteratorType
item = begin(); item != end(); ++item)
85
{
86
delete
(*item);
87
}
88
clear();
89
}
90
91
template
<
class
Texec>
92
inline
void
DtSequentialExecutionContainer<Texec>::executeMethod
(
void
(Texec::*theMethodPtr)())
93
{
94
if
(empty())
95
{
96
return
;
97
}
98
101
for
(
SecIteratorType
item = begin(); item != end(); ++item)
102
{
103
((**item).*theMethodPtr)();
104
}
105
}
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
)