40 #ifndef vtkObjectFactory_h
41 #define vtkObjectFactory_h
59 static vtkObject* CreateInstance(
const char* vtkclassname);
63 static void ConstructInstance(
const char* vtkclassname);
69 static void CreateAllInstance(
const char* vtkclassname,
80 static void UnRegisterAllFactories();
88 static int HasOverrideAny(
const char* className);
93 static void GetOverrideInformation(
const char*
name,
100 static void SetAllEnableFlags(
int flag,
101 const char* className);
106 static void SetAllEnableFlags(
int flag,
107 const char* className,
108 const char* subclassName);
124 virtual const char* GetVTKSourceVersion() = 0;
127 virtual const char* GetDescription() = 0;
130 virtual int GetNumberOfOverrides();
133 virtual const char* GetClassOverrideName(
int index);
137 virtual const char* GetClassOverrideWithName(
int index);
140 virtual int GetEnableFlag(
int index);
143 virtual const char* GetOverrideDescription(
int index);
148 virtual void SetEnableFlag(
int flag,
149 const char* className,
150 const char* subclassName);
151 virtual int GetEnableFlag(
const char* className,
152 const char* subclassName);
156 virtual int HasOverride(
const char* className);
158 virtual int HasOverride(
const char* className,
const char* subclassName);
162 virtual void Disable(
const char* className);
166 vtkGetStringMacro(LibraryPath);
177 void RegisterOverride(
const char* classOverride,
178 const char* overrideClassName,
181 CreateFunction createFunction);
190 virtual vtkObject* CreateObject(
const char* vtkclassname );
209 void GrowOverrideArray();
215 static void RegisterDefaults();
217 static void LoadDynamicFactories();
219 static void LoadLibrariesInPath(
const char*);
227 char* LibraryVTKVersion;
228 char* LibraryCompilerUsed;
238 #define VTK_CREATE_CREATE_FUNCTION(classname) \
239 static vtkObject* vtkObjectFactoryCreate##classname() \
240 { return classname::New(); }
244 #define VTK_FACTORY_INTERFACE_EXPORT VTKCOMMONCORE_EXPORT
251 #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
253 VTK_FACTORY_INTERFACE_EXPORT \
254 const char* vtkGetFactoryCompilerUsed() \
256 return VTK_CXX_COMPILER; \
259 VTK_FACTORY_INTERFACE_EXPORT \
260 const char* vtkGetFactoryVersion() \
262 return VTK_SOURCE_VERSION; \
265 VTK_FACTORY_INTERFACE_EXPORT \
266 vtkObjectFactory* vtkLoad() \
268 return factoryName ::New(); \
272 #define VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
273 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass); \
276 return static_cast<thisClass*>(ret); \
278 return new thisClass;
283 #define VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
284 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass); \
287 return static_cast<thisClass*>(ret); \
289 vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \
293 #if defined(VTK_ALL_NEW_OBJECT_FACTORY)
294 # define VTK_STANDARD_NEW_BODY(thisClass) \
295 VTK_OBJECT_FACTORY_NEW_BODY(thisClass)
296 #elif defined(VTK_DEBUG_LEAKS)
297 # define VTK_STANDARD_NEW_BODY(thisClass) \
298 thisClass *result = new thisClass; \
299 vtkObjectFactory::ConstructInstance(result->GetClassName()); \
302 # define VTK_STANDARD_NEW_BODY(thisClass) \
303 return new thisClass;
307 #define vtkStandardNewMacro(thisClass) \
308 thisClass* thisClass::New() \
310 VTK_STANDARD_NEW_BODY(thisClass) \
314 #define vtkObjectFactoryNewMacro(thisClass) \
315 thisClass* thisClass::New() \
317 VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
323 #define vtkAbstractObjectFactoryNewMacro(thisClass) \
324 thisClass* thisClass::New() \
326 VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
abstract base class for most VTK objects
#define VTKCOMMONCORE_EXPORT
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
OverrideInformation * OverrideArray
maintain a list of object factories
char ** OverrideClassNames
create and manipulate unsorted lists of objects
abstract base class for vtkObjectFactories