VR-Exchange 2.2 API Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
brokers
rprBroker
libRprBroker
brokers/rprBroker/libRprBroker/translatorFactory.h
Go to the documentation of this file.
1
/****************************************************************************
2
* Copyright (c) 2013 VT MAK
3
* All rights reserved.
4
****************************************************************************/
5
9
10
#pragma once
11
12
#include "
objectTrans.h
"
13
#include "
interactionTrans.h
"
14
#include <vlutil/vlString.h>
15
#include <vlutil/vlPrint.h>
16
#include <map>
17
18
namespace
MAKVrExchange
19
{
20
21
namespace
DtRprBroker
22
{
23
24
class
DtRprBroker;
25
27
//
30
template
<
typename
ProducedType>
31
class
DtTranslatorFactory
32
{
33
public
:
34
35
typedef
ProducedType* (*DtObjectTranslatorCreatorFunction)(
DtRprBroker
*);
36
typedef
ProducedType* (*DtGenericObjectTranslatorCreatorFunction)(
DtRprBroker
*,
const
DtString
&className);
37
38
public
:
39
41
DtTranslatorFactory
();
42
44
virtual
~DtTranslatorFactory
();
45
46
private
:
47
49
DtTranslatorFactory
(
const
DtTranslatorFactory
& other);
50
52
DtTranslatorFactory
&
operator=
(
const
DtTranslatorFactory
& other);
53
54
55
public
:
56
57
59
ProducedType *
createGenericInstance
(
60
const
DtString
&className,
DtRprBroker
*broker);
61
64
ProducedType *
createInstance
(
const
DtString
&transName,
DtRprBroker
*broker)
const
;
65
66
69
template
<
typename
T>
70
void
removeCreator
();
71
74
void
removeCreator
(
const
DtString
& translatorName);
75
77
void
removeAllCreators
();
78
81
template
<
typename
T>
82
void
addGenericCreator
();
83
88
template
<
typename
T>
89
bool
addCreator
();
90
94
template
<
typename
T>
95
bool
addCreator
(
const
DtString
& translatorName,
DtObjectTranslatorCreatorFunction
fn);
96
100
template
<
typename
T>
101
void
replaceCreator
();
102
105
template
<
typename
T>
106
void
replaceCreator
(
const
DtString
& translatorName,
DtObjectTranslatorCreatorFunction
fn);
107
109
std::set<DtString>
creatorNames
()
const
;
110
111
protected
:
112
114
template
<
typename
T>
115
static
ProducedType *
instanceFactory
(
DtRprBroker
*broker);
116
119
template
<
typename
T>
120
static
ProducedType *
genericInstanceFactory
(
DtRprBroker
*broker,
const
DtString
& className);
121
122
protected
:
123
124
typedef
std::map<DtString, DtObjectTranslatorCreatorFunction>
StringOtcMap
;
125
126
protected
:
127
128
StringOtcMap
myNamedCreatorMap
;
129
DtGenericObjectTranslatorCreatorFunction
myGenericTranslatorCreator
;
130
131
};
132
134
typedef
DtTranslatorFactory<DtObjectTranslator>
DtObjectTranslatorFactory
;
135
137
typedef
DtTranslatorFactory<DtInteractionTranslator>
DtInteractionTranslatorFactory
;
138
139
}
140
}
141
142
143
#define translatorFactory_INL_
144
#include "translatorFactory.inl"
145
#undef translatorFactory_INL_
Document ID: Generated on Mon Apr 15 17:15:50 EDT 2013 from SVN revision 126154
Copyright © 2005-2012 VT MÄK. All Rights Reserved (
www.mak.com
)