29#ifndef vtkObjectFactory_h
30#define vtkObjectFactory_h
32#include "vtkCommonCoreModule.h"
34#include "vtkFeatures.h"
39VTK_ABI_NAMESPACE_BEGIN
136 virtual const
char* GetDescription() VTK_FUTURE_CONST = 0;
141 virtual
int GetNumberOfOverrides() VTK_FUTURE_CONST;
146 virtual const
char* GetClassOverrideName(
int index) VTK_FUTURE_CONST;
152 virtual const
char* GetClassOverrideWithName(
int index) VTK_FUTURE_CONST;
163 virtual const
char* GetOverrideDescription(
int index) VTK_FUTURE_CONST;
170 virtual
void SetEnableFlag(
vtkTypeBool flag, const
char* className, const
char* subclassName);
172 const
char* className, const
char* subclassName) VTK_FUTURE_CONST;
178 virtual
vtkTypeBool HasOverride(const
char* className) VTK_FUTURE_CONST;
182 virtual
vtkTypeBool HasOverride(const
char* className, const
char* subclassName) VTK_FUTURE_CONST;
189 virtual
void Disable(const
char* className);
195 vtkGetFilePathMacro(LibraryPath);
204 void RegisterOverride(const
char* classOverride, const
char* overrideClassName,
205 const
char* description,
int enableFlag, CreateFunction createFunction);
212 virtual
vtkObject* CreateObject(const
char* vtkclassname);
231 void GrowOverrideArray();
241 static void RegisterDefaults();
245 static void LoadDynamicFactories();
249 static void LoadLibrariesInPath(
const std::string&);
257 char* LibraryVTKVersion;
280#define VTK_CREATE_CREATE_FUNCTION(classname) \
281 static vtkObject* vtkObjectFactoryCreate##classname() \
283 return classname::New(); \
289#define VTK_FACTORY_INTERFACE_EXPORT VTKCOMMONCORE_EXPORT
296#define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
297 extern "C" VTK_FACTORY_INTERFACE_EXPORT const char* vtkGetFactoryVersion() \
299 return VTK_SOURCE_VERSION; \
301 extern "C" VTK_FACTORY_INTERFACE_EXPORT vtkObjectFactory* vtkLoad() \
303 return factoryName ::New(); \
307#define VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
308 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, false); \
311 return static_cast<thisClass*>(ret); \
313 auto result = new thisClass; \
314 result->InitializeObjectBase(); \
320#define VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
321 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, true); \
324 return static_cast<thisClass*>(ret); \
326 vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \
330#if defined(VTK_ALL_NEW_OBJECT_FACTORY)
331#define VTK_STANDARD_NEW_BODY(thisClass) VTK_OBJECT_FACTORY_NEW_BODY(thisClass)
333#define VTK_STANDARD_NEW_BODY(thisClass) \
334 auto result = new thisClass; \
335 result->InitializeObjectBase(); \
340#define vtkStandardNewMacro(thisClass) \
341 thisClass* thisClass::New() \
343 VTK_STANDARD_NEW_BODY(thisClass); \
348#define vtkStandardExtendedNewMacro(thisClass) \
349 thisClass* thisClass::ExtendedNew() \
351 auto mkhold = vtkMemkindRAII(true); \
353 return thisClass::New(); \
357#define vtkObjectFactoryNewMacro(thisClass) \
358 thisClass* thisClass::New() \
360 VTK_OBJECT_FACTORY_NEW_BODY(thisClass); \
366#define vtkAbstractObjectFactoryNewMacro(thisClass) \
367 thisClass* thisClass::New() \
369 VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass); \
create and manipulate ordered lists of objects
a simple class to control print indentation
maintain a list of object factories
vtkObjectFactoryRegistryCleanup()
~vtkObjectFactoryRegistryCleanup()
abstract base class for vtkObjectFactories
void PrintSelf(ostream &os, vtkIndent indent) override
Print ObjectFactory to stream.
static void SetAllEnableFlags(vtkTypeBool flag, const char *className)
Set the enable flag for a given named class for all registered factories.
static vtkObject * CreateInstance(const char *vtkclassname, bool isAbstract=false)
Create and return an instance of the named vtk object.
static vtkObjectFactoryCollection * GetRegisteredFactories()
Return the list of all registered factories.
static void GetOverrideInformation(const char *name, vtkOverrideInformationCollection *)
Fill the given collection with all the overrides for the class with the given name.
char ** OverrideClassNames
static void CreateAllInstance(const char *vtkclassname, vtkCollection *retList)
Create all possible instances of the named vtk object.
static vtkTypeBool HasOverrideAny(const char *className)
return 1 if one of the registered factories overrides the given class name
OverrideInformation * OverrideArray
static void UnRegisterFactory(vtkObjectFactory *)
Remove a factory from the list of registered factories.
static void ReHash()
Re-check the VTK_AUTOLOAD_PATH for new factory libraries.
static void UnRegisterAllFactories()
Unregister all factories.
static void SetAllEnableFlags(vtkTypeBool flag, const char *className, const char *subclassName)
Set the enable flag for a given named class subclass pair for all registered factories.
static void RegisterFactory(vtkObjectFactory *)
Register a factory so it can be used to create vtk objects.
virtual const char * GetVTKSourceVersion() VTK_FUTURE_CONST=0
All sub-classes of vtkObjectFactory should must return the version of VTK they were built with.
abstract base class for most VTK objects
static vtkObjectFactoryRegistryCleanup vtkObjectFactoryRegistryCleanupInstance