29 #ifndef vtkObjectFactory_h
30 #define vtkObjectFactory_h
32 #include "vtkCommonCoreModule.h"
34 #include "vtkFeatures.h"
39 VTK_ABI_NAMESPACE_BEGIN
59 static vtkObject* CreateInstance(
const char* vtkclassname,
bool isAbstract =
false);
67 static void CreateAllInstance(
const char* vtkclassname,
vtkCollection* retList);
84 static void UnRegisterAllFactories();
96 static vtkTypeBool HasOverrideAny(
const char* className);
108 static void SetAllEnableFlags(
vtkTypeBool flag,
const char* className);
113 static void SetAllEnableFlags(
vtkTypeBool flag,
const char* className,
const char* subclassName);
131 virtual const char* GetVTKSourceVersion() = 0;
136 virtual const char* GetDescription() = 0;
141 virtual int GetNumberOfOverrides();
146 virtual const char* GetClassOverrideName(
int index);
152 virtual const char* GetClassOverrideWithName(
int index);
163 virtual const char* GetOverrideDescription(
int index);
170 virtual void SetEnableFlag(
vtkTypeBool flag,
const char* className,
const char* subclassName);
171 virtual vtkTypeBool GetEnableFlag(
const char* className,
const char* subclassName);
177 virtual vtkTypeBool HasOverride(
const char* className);
181 virtual vtkTypeBool HasOverride(
const char* className,
const char* subclassName);
188 virtual void Disable(
const char* className);
194 vtkGetFilePathMacro(LibraryPath);
203 void RegisterOverride(
const char* classOverride,
const char* overrideClassName,
204 const char*
description,
int enableFlag, CreateFunction createFunction);
211 virtual vtkObject* CreateObject(
const char* vtkclassname);
230 void GrowOverrideArray();
240 static void RegisterDefaults();
244 static void LoadDynamicFactories();
248 static void LoadLibrariesInPath(
const std::string&);
256 char* LibraryVTKVersion;
279 #define VTK_CREATE_CREATE_FUNCTION(classname) \
280 static vtkObject* vtkObjectFactoryCreate##classname() { return classname::New(); }
282 VTK_ABI_NAMESPACE_END
285 #define VTK_FACTORY_INTERFACE_EXPORT VTKCOMMONCORE_EXPORT
292 #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
293 extern "C" VTK_FACTORY_INTERFACE_EXPORT const char* vtkGetFactoryVersion() \
295 return VTK_SOURCE_VERSION; \
297 extern "C" VTK_FACTORY_INTERFACE_EXPORT vtkObjectFactory* vtkLoad() \
299 return factoryName ::New(); \
303 #define VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
304 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, false); \
307 return static_cast<thisClass*>(ret); \
309 auto result = new thisClass; \
310 result->InitializeObjectBase(); \
316 #define VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
317 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, true); \
320 return static_cast<thisClass*>(ret); \
322 vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \
326 #if defined(VTK_ALL_NEW_OBJECT_FACTORY)
327 #define VTK_STANDARD_NEW_BODY(thisClass) VTK_OBJECT_FACTORY_NEW_BODY(thisClass)
329 #define VTK_STANDARD_NEW_BODY(thisClass) \
330 auto result = new thisClass; \
331 result->InitializeObjectBase(); \
336 #define vtkStandardNewMacro(thisClass) \
337 thisClass* thisClass::New() { VTK_STANDARD_NEW_BODY(thisClass); }
341 #define vtkStandardExtendedNewMacro(thisClass) \
342 thisClass* thisClass::ExtendedNew() \
344 auto mkhold = vtkMemkindRAII(true); \
346 return thisClass::New(); \
350 #define vtkObjectFactoryNewMacro(thisClass) \
351 thisClass* thisClass::New() { VTK_OBJECT_FACTORY_NEW_BODY(thisClass); }
356 #define vtkAbstractObjectFactoryNewMacro(thisClass) \
357 thisClass* thisClass::New() { VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass); }
abstract base class for most VTK objects
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkObjectFactoryRegistryCleanup vtkObjectFactoryRegistryCleanupInstance
a simple class to control print indentation
OverrideInformation * OverrideArray
maintain a list of object factories
char ** OverrideClassNames
create and manipulate ordered lists of objects
abstract base class for vtkObjectFactories