VR-Exchange 2.6 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
translatorFactory.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2016 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
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>
27  {
28  public:
29 
30  typedef ProducedType* (*DtObjectTranslatorCreatorFunction)( DtBroker* );
31  typedef ProducedType* (*DtGenericObjectTranslatorCreatorFunction)( DtBroker*, const DtString& className );
32 
33  public:
34 
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 
100 
103 
104  protected:
105 
106  typedef std::map<DtString, DtObjectTranslatorCreatorFunction> StringOtcMap;
108 
110 
111  };
112 
113 }
114 
115 #define _translatorFactory_INL_
116 #include <broker/translatorFactory.inl>
117 #undef _translatorFactory_INL_

Document ID: Generated on Wed Jan 30 18:15:18 EST 2019 from SVN revision 195534
Copyright © 2005-2019 VT MÄK. All Rights Reserved (www.mak.com)