VR-Exchange 2.4 API Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
broker
translatorFactory.h
Go to the documentation of this file.
1
/****************************************************************************
2
* Copyright (c) 2015 VT MAK
3
* All rights reserved.
4
****************************************************************************/
5
9
10
#pragma once
11
12
#include <
broker/baseInteractionTranslator.h
>
13
#include <
broker/baseObjectTranslator.h
>
14
#include <vlutil/vlString.h>
15
#include <vlutil/vlPrint.h>
16
#include <map>
17
#include <set>
18
19
namespace
MAKVrExchange
20
{
21
25
template
<
typename
ProducedType>
26
class
DtTranslatorFactory
27
{
28
public
:
29
30
typedef
ProducedType* (*DtObjectTranslatorCreatorFunction)(
DtBroker
* );
31
typedef
ProducedType* (*DtGenericObjectTranslatorCreatorFunction)(
DtBroker
*,
const
DtString
& className );
32
33
public
:
34
36
DtTranslatorFactory
();
37
39
virtual
~DtTranslatorFactory
();
40
42
ProducedType*
createGenericInstance
(
const
DtString
& className,
DtBroker
* broker );
43
46
ProducedType*
createInstance
(
const
DtString
& transName,
DtBroker
* broker )
const
;
47
50
template
<
typename
T>
51
void
removeCreator
();
52
55
void
removeCreator
(
const
DtString
& translatorName );
56
58
void
removeAllCreators
();
59
62
template
<
typename
T>
63
void
addGenericCreator
();
64
68
template
<
typename
T>
69
void
addCreator
();
70
74
template
<
typename
T>
75
void
addCreator
(
const
DtString
& str );
76
79
template
<
typename
T>
80
void
addCreator
(
const
DtString
& translatorName,
DtObjectTranslatorCreatorFunction
fn );
81
83
std::set<DtString>
creatorNames
()
const
;
84
85
protected
:
86
88
template
<
typename
T>
89
static
ProducedType*
instanceFactory
(
DtBroker
* broker );
90
93
template
<
typename
T>
94
static
ProducedType*
genericInstanceFactory
(
DtBroker
* broker,
const
DtString
& className );
95
96
private
:
97
99
DtTranslatorFactory
(
const
DtTranslatorFactory
& other );
100
102
DtTranslatorFactory
&
operator =
(
const
DtTranslatorFactory
& other );
103
104
protected
:
105
106
typedef
std::map<DtString, DtObjectTranslatorCreatorFunction>
StringOtcMap
;
107
StringOtcMap
myNamedCreatorMap
;
108
109
DtGenericObjectTranslatorCreatorFunction
myGenericTranslatorCreator
;
110
111
};
112
113
}
114
115
#define translatorFactory_INL_
116
#include <broker/translatorFactory.inl>
117
#undef translatorFactory_INL_
Document ID: Generated on Thu Jul 23 10:25:22 EDT 2015 from SVN revision 155065
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)