VR-Exchange 2.1 API Documentation
hlaBroker/translatorFactory.h
Go to the documentation of this file.
1 /*********************************************************************
2  ** Copyright (c) 1992-2010 VT MAK
3  ** All rights reserved.
4  *********************************************************************/
5 #pragma once
6 
7 
8 
9 
10 #include "objectTrans.h"
11 #include "interactionTrans.h"
12 #include <map>
13 #include <vlutil/vlPrint.h>
14 #include <vlutil/vlString.h>
15 
16 namespace MAKVrExchange { namespace DtHlaBroker {
17 
18  class DtHlaBroker;
19 
21  //
24  template <typename ProducedType>
26  {
27  public:
28 
29  typedef ProducedType* (*DtObjectTranslatorCreatorFunction)(DtHlaBroker *);
30  typedef ProducedType* (*DtGenericObjectTranslatorCreatorFunction)(DtHlaBroker *, const DtString &className);
31 
32  public:
33 
36 
38  virtual ~DtTranslatorFactory();
39 
40  private:
41 
44 
47 
48 
49  public:
50 
51 
53  ProducedType *createGenericInstance(
54  const DtString &className, DtHlaBroker *broker);
55 
58  ProducedType *createInstance(const DtString &transName, DtHlaBroker *broker) const;
59 
60 
63  template<typename T>
64  void removeCreator();
65 
68  void removeCreator(const DtString& translatorName);
69 
71  void removeAllCreators();
72 
75  template<typename T>
76  void addGenericCreator();
77 
81  template<typename T>
82  void addCreator();
83 
86  template<typename T>
87  void addCreator(const DtString& translatorName, DtObjectTranslatorCreatorFunction fn);
88 
90  std::set<DtString> creatorNames() const;
91 
92  protected:
93 
95  template <typename T>
96  static ProducedType *instanceFactory(DtHlaBroker *broker);
97 
100  template <typename T>
101  static ProducedType *genericInstanceFactory(DtHlaBroker *broker, const DtString& className);
102 
103  protected:
104 
105  typedef std::map<DtString, DtObjectTranslatorCreatorFunction> StringOtcMap;
106 
107  protected:
108 
111 
112  };
113 
116 
119 
120 }}
121 
122 #define translatorFactory_INL_
123 #include "translatorFactory.inl"
124 #undef translatorFactory_INL_
125 
126 

Document ID: Generated on Tue Aug 7 22:07:13 EDT 2012 from SVN revision 117874
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)