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
factoryTemplate.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2012 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
8
10
11
#pragma once
12
13
#include <
vrfutil/vrfutilDefines.h
>
14
#include <map>
15
16
#include <vlutil/vlString.h>
17
28
template
<
typename
T_CreationObject,
typename
T_Key>
29
class
DtFactoryTemplate
30
{
31
public
:
33
DtFactoryTemplate
();
34
35
private
:
37
DtFactoryTemplate
(
const
DtFactoryTemplate
& orig);
39
const
DtFactoryTemplate
&
operator=
(
const
DtFactoryTemplate
&
40
orig);
41
42
public
:
43
typedef
T_CreationObject* (*DtCreatorFcn)();
44
45
struct
DtFactoryTemplateEntry
{
46
T_Key
myTypeToCreate
;
47
DtCreatorFcn
myCreatorFcn
;
48
};
49
50
typedef
std::map<T_Key, DtFactoryTemplateEntry>
DtCreatorMapType
;
51
53
virtual
~DtFactoryTemplate
();
54
56
virtual
void
addCreatorFcn
(
const
T_Key& key,
DtCreatorFcn
fcn);
57
60
virtual
bool
removeCreatorFcn
(
const
T_Key& key);
61
65
66
virtual
T_CreationObject*
createNew
(
const
T_Key& key)
const
;
68
69
virtual
bool
isKeyRegistered
(
const
T_Key& key)
const
;
70
71
static
DtFactoryTemplate<T_CreationObject, T_Key>
*
create
();
72
76
virtual
DtString
creationObjectName
()
const
;
77
78
virtual
const
DtCreatorMapType
&
creatorMap
()
const
;
79
81
virtual
void
setAlwaysWarnOnlyOnce
(
bool
);
82
bool
alwaysWarnOnlyOnce
()
const
;
83
84
protected
:
85
86
DtCreatorMapType
myCreatorMap
;
87
bool
myAlwaysWarnOnlyOnce
;
88
mutable
std::map<T_Key, bool>
myMessageWarningFilters
;
89
};
90
92
95
template
<
typename
T_CreationObject,
typename
T_Key,
typename
T_Arg>
96
class
DtSingleArgFactoryTemplate
97
{
98
public
:
100
DtSingleArgFactoryTemplate
();
101
102
private
:
104
DtSingleArgFactoryTemplate
(
const
DtSingleArgFactoryTemplate
& orig);
106
const
DtSingleArgFactoryTemplate
&
operator=
(
const
DtSingleArgFactoryTemplate
&
107
orig);
108
109
public
:
110
typedef
T_CreationObject* (*DtCreatorFcn)(T_Arg);
111
112
struct
DtSingleArgFactoryTemplateEntry
{
113
T_Key
myTypeToCreate
;
114
DtCreatorFcn
myCreatorFcn
;
115
};
116
117
typedef
std::map<T_Key, DtSingleArgFactoryTemplateEntry>
DtCreatorMapType
;
118
120
virtual
~DtSingleArgFactoryTemplate
();
121
123
virtual
void
addCreatorFcn
(
const
T_Key& key,
DtCreatorFcn
fcn);
124
127
virtual
bool
removeCreatorFcn
(
const
T_Key& key);
128
132
133
virtual
T_CreationObject*
createNew
(
const
T_Key& key, T_Arg arg)
const
;
135
136
virtual
bool
isKeyRegistered
(
const
T_Key& key)
const
;
137
138
static
DtSingleArgFactoryTemplate<T_CreationObject, T_Key, T_Arg>
*
create
();
139
143
virtual
DtString
creationObjectName
()
const
;
144
145
virtual
const
DtCreatorMapType
&
creatorMap
()
const
;
146
148
virtual
void
setAlwaysWarnOnlyOnce
(
bool
);
149
bool
alwaysWarnOnlyOnce
()
const
;
150
151
protected
:
152
153
DtCreatorMapType
myCreatorMap
;
154
bool
myAlwaysWarnOnlyOnce
;
155
mutable
std::map<T_Key, bool>
myMessageWarningFilters
;
156
};
157
158
#define factoryTemplate_inl_
159
#include "vrfutil/factoryTemplate.inl"
160
#undef factoryTemplate_inl_
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
)