VR-Forces 4.1.1 Class Documentation
DtAgentFactory.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: DtAgentFactory.h,v $ $Revision: 1.13 $ $State: Exp $
7 *******************************************************************************/
8 
12 
13 #pragma once
14 
15 #include <vrvCore/vrvCore.h>
17 #include <vrvCore/DtUniqueID.h>
18 
19 #include <boost/unordered_map.hpp>
20 #include <string>
21 #include <list>
22 
23 namespace makVrv
24 {
25 
26  class DtDe;
27  class DtAgentManagerInterface;
28  class DtAgentUpdateResolverInterface;
29  class DtAgentCreator;
30  class DtAgent;
31 
37  {
38  public:
39 
41  {
42  public:
43  DtAutoUnregistrar( const std::string& className )
44  : myClassName( className )
45  {
46  };
47 
49  {
50  DtAgentFactory::autoUnregister( myClassName );
51  }
52  private:
53  std::string myClassName;
54  };
55 
56  typedef DtAgentCreator* (*AutoRegisterFunction)();
57 
59  static DtAgentFactory& instance(DtDe& de);
60 
62  virtual ~DtAgentFactory();
63 
66  virtual void registerAgentCreator(const std::string& className,
67  DtAgentCreator* creator);
68 
72  virtual DtAgent* createAgent(const std::string& className,
73  DtAgentManagerInterface& sceneInterface) const;
74 
78  virtual DtAgentUpdateResolverInterface* createResolver(const std::string& className, DtUniqueID id) const;
79 
81  virtual void processAutoUnregisters();
82 
84  static bool autoRegister(const std::string& className,AutoRegisterFunction function );
85  static void autoUnregister( const std::string& className );
86 
87  protected:
90  DtAgentFactory(DtDe& de);
91 
92 
93  protected:
94  typedef boost::unordered_map<std::string,DtAgentCreator*> RegistrationMap;
95  typedef boost::unordered_map<std::string,AutoRegisterFunction> AutoRegistrationMap;
96  typedef std::list<std::string> RemoveList;
97 
100 
102  static AutoRegistrationMap& autoTypes();
103  static RemoveList& removeTypes();
104  static bool& destructed();
105  };
106 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)