VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
factoryTemplate.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include <vrfutil/vrfutilDefines.h>
14 #include <map>
15 
16 #include <vlutil/vlString.h>
17 
28 template <typename T_CreationObject, typename T_Key>
30 {
31 public:
34 
35 private:
40  orig);
41 
42 public:
43  typedef T_CreationObject* (*DtCreatorFcn)();
44 
48  };
49 
50  typedef std::map<T_Key, DtFactoryTemplateEntry> DtCreatorMapType;
51 
53  virtual ~DtFactoryTemplate();
54 
56  virtual void addCreatorFcn(const T_Key& key, DtCreatorFcn fcn);
57 
60  virtual bool removeCreatorFcn(const T_Key& key);
61 
65 
66  virtual T_CreationObject* createNew(const T_Key& key) const;
68 
69  virtual bool isKeyRegistered(const T_Key& key) const;
70 
72 
76  virtual DtString creationObjectName() const;
77 
78  virtual const DtCreatorMapType& creatorMap() const;
79 
81  virtual void setAlwaysWarnOnlyOnce(bool);
82  bool alwaysWarnOnlyOnce() const;
83 
84 protected:
85 
88  mutable std::map<T_Key, bool> myMessageWarningFilters;
89 };
90 
92 
95 template <typename T_CreationObject, typename T_Key, typename T_Arg>
97 {
98 public:
101 
102 private:
107  orig);
108 
109 public:
110  typedef T_CreationObject* (*DtCreatorFcn)(T_Arg);
111 
115  };
116 
117  typedef std::map<T_Key, DtSingleArgFactoryTemplateEntry> DtCreatorMapType;
118 
120  virtual ~DtSingleArgFactoryTemplate();
121 
123  virtual void addCreatorFcn(const T_Key& key, DtCreatorFcn fcn);
124 
127  virtual bool removeCreatorFcn(const T_Key& key);
128 
132 
133  virtual T_CreationObject* createNew(const T_Key& key, T_Arg arg) const;
135 
136  virtual bool isKeyRegistered(const T_Key& key) const;
137 
139 
143  virtual DtString creationObjectName() const;
144 
145  virtual const DtCreatorMapType& creatorMap() const;
146 
148  virtual void setAlwaysWarnOnlyOnce(bool);
149  bool alwaysWarnOnlyOnce() const;
150 
151 protected:
152 
155  mutable std::map<T_Key, bool> myMessageWarningFilters;
156 };
157 
158 #define factoryTemplate_inl_
159 #include "vrfutil/factoryTemplate.inl"
160 #undef factoryTemplate_inl_

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)