Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
Common/vtkObjectFactory.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00054 #ifndef __vtkObjectFactory_h
00055 #define __vtkObjectFactory_h
00056
00057
00058
00059
00060 #include "vtkObject.h"
00061
00062 class vtkObjectFactoryCollection;
00063 class vtkOverrideInformationCollection;
00064 class vtkCollection;
00065
00066 class VTK_COMMON_EXPORT vtkObjectFactory : public vtkObject
00067 {
00068 public:
00069
00070
00075 static vtkObject* CreateInstance(const char* vtkclassname);
00076
00078
00081 static void CreateAllInstance(const char* vtkclassname,
00082 vtkCollection* retList);
00083
00084
00085
00086 static void ReHash();
00087
00088
00089 static void RegisterFactory(vtkObjectFactory* );
00090
00091
00092 static void UnRegisterFactory(vtkObjectFactory*);
00093
00094
00095 static void UnRegisterAllFactories();
00097
00100 static vtkObjectFactoryCollection* GetRegisteredFactories();
00101
00104 static int HasOverrideAny(const char* className);
00105
00107
00109 static void GetOverrideInformation(const char* name,
00110 vtkOverrideInformationCollection*);
00112
00114
00116 static void SetAllEnableFlags(int flag,
00117 const char* className);
00118
00119
00120
00121 static void SetAllEnableFlags(int flag,
00122 const char* className,
00123 const char* subclassName);
00125
00126
00127
00128
00129 vtkTypeRevisionMacro(vtkObjectFactory,vtkObject);
00131 virtual void PrintSelf(ostream& os, vtkIndent indent);
00132
00139 virtual const char* GetVTKSourceVersion() = 0;
00140
00142 virtual const char* GetDescription() = 0;
00143
00145 virtual int GetNumberOfOverrides();
00146
00148 virtual const char* GetClassOverrideName(int index);
00149
00152 virtual const char* GetClassOverrideWithName(int index);
00153
00155 virtual int GetEnableFlag(int index);
00156
00158 virtual const char* GetOverrideDescription(int index);
00159
00161
00163 virtual void SetEnableFlag(int flag,
00164 const char* className,
00165 const char* subclassName);
00166 virtual int GetEnableFlag(const char* className,
00167 const char* subclassName);
00169
00171
00172 virtual int HasOverride(const char* className);
00173
00174
00175 virtual int HasOverride(const char* className, const char* subclassName);
00177
00180 virtual void Disable(const char* className);
00181
00183
00184 vtkGetStringMacro(LibraryPath);
00186
00187
00188 typedef vtkObject* (*CreateFunction)();
00189
00190 protected:
00191
00192
00194
00195 void RegisterOverride(const char* classOverride,
00196 const char* overrideClassName,
00197 const char* description,
00198 int enableFlag,
00199 CreateFunction createFunction);
00201
00202
00203
00204
00208 virtual vtkObject* CreateObject(const char* vtkclassname );
00209
00210 vtkObjectFactory();
00211 ~vtkObjectFactory();
00212
00213 struct OverrideInformation
00214 {
00215 char* Description;
00216 char* OverrideWithName;
00217 int EnabledFlag;
00218 CreateFunction CreateCallback;
00219 };
00220
00221 OverrideInformation* OverrideArray;
00222 char** OverrideClassNames;
00223 int SizeOverrideArray;
00224 int OverrideArrayLength;
00225
00226 private:
00227 void GrowOverrideArray();
00228
00230
00232 static void Init();
00233
00234
00235 static void RegisterDefaults();
00236
00237
00238 static void LoadDynamicFactories();
00239
00240
00241 static void LoadLibrariesInPath( const char*);
00243
00244
00245 static vtkObjectFactoryCollection* RegisteredFactories;
00246
00247
00248
00249 void* LibraryHandle;
00250 char* LibraryVTKVersion;
00251 char* LibraryCompilerUsed;
00252 char* LibraryPath;
00253 private:
00254 vtkObjectFactory(const vtkObjectFactory&);
00255 void operator=(const vtkObjectFactory&);
00256 };
00257
00258
00259
00260
00261 #define VTK_CREATE_CREATE_FUNCTION(classname) \
00262 static vtkObject* vtkObjectFactoryCreate##classname() \
00263 { return classname::New(); }
00264
00265 #endif
00266
00267
00268 #ifdef _WIN32
00269 #define VTK_FACTORY_INTERFACE_EXPORT __declspec( dllexport )
00270 #else
00271 #define VTK_FACTORY_INTERFACE_EXPORT
00272 #endif
00273
00274
00275
00276
00277
00278
00279 #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
00280 extern "C" \
00281 VTK_FACTORY_INTERFACE_EXPORT \
00282 const char* vtkGetFactoryCompilerUsed() \
00283 { \
00284 return VTK_CXX_COMPILER; \
00285 } \
00286 extern "C" \
00287 VTK_FACTORY_INTERFACE_EXPORT \
00288 const char* vtkGetFactoryVersion() \
00289 { \
00290 return VTK_SOURCE_VERSION; \
00291 } \
00292 extern "C" \
00293 VTK_FACTORY_INTERFACE_EXPORT \
00294 vtkObjectFactory* vtkLoad() \
00295 { \
00296 return factoryName ::New(); \
00297 }