VR-Exchange 2.2 API Documentation
pMessageFactory.h
Go to the documentation of this file.
1 /*********************************************************************
2  ** Copyright (c) 1992-2010 VT MAK
3  ** All rights reserved.
4  *********************************************************************/
5 
6 #ifndef pMessageFactory_H_
7 #define pMessageFactory_H_
8 
12 
13 
14 #include <portal/pMessage.h>
15 
16 namespace MAKVrExchange {
17 
21 //
26 class DT_DLL_LIBPORTAL DtPortalMessageFactory
27 {
28 public:
29 
31  virtual ~DtPortalMessageFactory();
32 
33 private:
34 
37 
40 
41 public:
42 
47  DtPortalMessage *create(const void *message) const;
48 
57  template <typename T_Message>
58  void registerCreator(const T_Message &msg);
59 
60 
61  typedef DtPortalMessage *(*ShmMessageCreator)();
62  void registerCreator(const DtPortalMessageKind& kind,
63  const ShmMessageCreator& creator );
64 
65 
66 protected:
67 
68  typedef std::map<DtPortalMessageKind, ShmMessageCreator> KindCreateFunctionMap;
70 };
71 
72 template <typename T_Message>
73 inline void DtPortalMessageFactory::registerCreator(const T_Message &)
74 {
75  myCreatorFunctionMap[T_Message::theKind] = T_Message::create;
76 }
77 
79  const ShmMessageCreator& creator )
80 {
81  myCreatorFunctionMap[kind] = creator;
82 }
83 
84 
85 }
86 
87 #endif //end #ifndef pMessageFactory_H_

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)