VR-Exchange 2.2 API Documentation
include/broker/translatorFactory.h
Go to the documentation of this file.
1 /*********************************************************************
2  ** Copyright (c) 2012 VT MAK
3  ** All rights reserved.
4  *********************************************************************/
5 #pragma once
6 
9 #include <map>
10 #include <vlutil/vlPrint.h>
11 #include <vlutil/vlString.h>
12 
13 namespace MAKVrExchange {
14 
16  //
19  template <typename BrokerType, typename ProducedType>
21  {
22  public:
23 
24  typedef ProducedType* (*DtObjectTranslatorCreatorFunction)(BrokerType *);
25  typedef ProducedType* (*DtGenericObjectTranslatorCreatorFunction)(BrokerType *, const DtString &className);
26 
27  public:
28 
31 
33  virtual ~DtTranslatorFactory();
34 
35  private:
36 
39 
42 
43 
44  public:
45 
46 
48  ProducedType *createGenericInstance(const DtString &className, BrokerType *broker);
49 
52  ProducedType *createInstance(const DtString &transName, BrokerType *broker) const;
53 
54 
57  template<typename T>
58  void removeCreator();
59 
62  void removeCreator(const DtString& translatorName);
63 
65  void removeAllCreators();
66 
69  template<typename T>
70  void addGenericCreator();
71 
75  template<typename T> void addCreator();
76 
80  template<typename T> void addCreator(DtString str);
81 
84  template<typename T>
85  void addCreator(const DtString& translatorName, DtObjectTranslatorCreatorFunction fn);
86 
88  std::set<DtString> creatorNames() const;
89 
90  protected:
91 
93  template <typename T>
94  static ProducedType *instanceFactory(BrokerType *broker);
95 
98  template <typename T>
99  static ProducedType *genericInstanceFactory(BrokerType *broker, const DtString& className);
100 
101  protected:
102 
103  typedef std::map<DtString, DtObjectTranslatorCreatorFunction> StringOtcMap;
104 
105  protected:
106 
109 
110  };
111 }
112 
113 #define translatorFactory_INL_
114 #include "translatorFactory.inl"
115 #undef translatorFactory_INL_
116 
117 

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)