VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAgentFactory.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
14 #include <vrvCore/DtUniqueID.h>
15 
16 #include <boost/unordered_map.hpp>
17 #include <string>
18 #include <list>
19 
20 namespace makVrv
21 {
22 
23  class DtDe;
24  class DtAgentManagerInterface;
25  class DtAgentUpdateResolverInterface;
26  class DtAgentCreator;
27  class DtAgent;
28 
34  {
35  public:
36 
38  {
39  public:
40  DtAutoUnregistrar( const std::string& className )
41  : myClassName( className )
42  {
43  };
44 
46  {
47  DtAgentFactory::autoUnregister( myClassName );
48  }
49  private:
50  std::string myClassName;
51  };
52 
53  typedef DtAgentCreator* (*AutoRegisterFunction)();
54 
56  static DtAgentFactory& instance(DtDe& de);
57 
59  virtual ~DtAgentFactory();
60 
63  virtual void registerAgentCreator(const std::string& className,
64  DtAgentCreator* creator);
65 
69  virtual DtAgent* createAgent(const std::string& className,
70  DtAgentManagerInterface& sceneInterface) const;
71 
75  virtual DtAgentUpdateResolverInterface* createResolver(const std::string& className, DtUniqueID id) const;
76 
78  virtual void processAutoUnregisters();
79 
81  static bool autoRegister(const std::string& className,AutoRegisterFunction function );
82  static void autoUnregister( const std::string& className );
83 
84  protected:
87  DtAgentFactory(DtDe& de);
88 
89 
90  protected:
91  typedef boost::unordered_map<std::string,DtAgentCreator*> RegistrationMap;
92  typedef boost::unordered_map<std::string,AutoRegisterFunction> AutoRegistrationMap;
93  typedef std::list<std::string> RemoveList;
94 
97 
99  static AutoRegistrationMap& autoTypes();
100  static RemoveList& removeTypes();
101  static bool& destructed();
102  };
103 }
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
Definition: DtAgentFactory.h:37
Abstract base class for object updaters.
Definition: DtAgentUpdateResolverInterface.h:20
A distributed object agent base class.
Definition: DtAgent.h:54
static void autoUnregister(const std::string &className)
std::string myClassName
Definition: DtAgentFactory.h:50
RegistrationMap myTypes
Definition: DtAgentFactory.h:96
DtAutoUnregistrar(const std::string &className)
Definition: DtAgentFactory.h:40
Contains makVrv::DtVirtualBaseClass class.
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
~DtAutoUnregistrar()
Definition: DtAgentFactory.h:45
Abstract base class for the scene object creators. SceneObject creators do not actually create scene ...
Definition: DtAgentCreator.h:27
Contains makVrv::DtUniqueID type.
DtDe & myDe
Definition: DtAgentFactory.h:95
The abstract interface necessary for agents.
Definition: DtAgentManagerInterface.h:33
The scene object creators are registered with the scene object factory for accessing DtSceneObjectCre...
Definition: DtAgentFactory.h:33
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
boost::unordered_map< std::string, DtAgentCreator * > RegistrationMap
Definition: DtAgentFactory.h:91
std::list< std::string > RemoveList
Definition: DtAgentFactory.h:93
boost::unordered_map< std::string, AutoRegisterFunction > AutoRegistrationMap
Definition: DtAgentFactory.h:92
Contains DLL export macros.

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)