47 #ifndef vtkObjectFactory_h
48 #define vtkObjectFactory_h
50 #include "vtkCommonCoreModule.h"
52 #include "vtkFeatures.h"
58 VTK_ABI_NAMESPACE_BEGIN
79 static vtkObject* CreateInstance(
const char* vtkclassname,
bool isAbstract =
false);
87 static void CreateAllInstance(
const char* vtkclassname,
vtkCollection* retList);
104 static void UnRegisterAllFactories();
116 static vtkTypeBool HasOverrideAny(
const char* className);
128 static void SetAllEnableFlags(
vtkTypeBool flag,
const char* className);
133 static void SetAllEnableFlags(
vtkTypeBool flag,
const char* className,
const char* subclassName);
151 virtual const char* GetVTKSourceVersion() VTK_FUTURE_CONST = 0;
156 virtual const
char* GetDescription() VTK_FUTURE_CONST = 0;
161 virtual
int GetNumberOfOverrides() VTK_FUTURE_CONST;
166 virtual const
char* GetClassOverrideName(
int index) VTK_FUTURE_CONST;
172 virtual const
char* GetClassOverrideWithName(
int index) VTK_FUTURE_CONST;
183 virtual const
char* GetOverrideDescription(
int index) VTK_FUTURE_CONST;
190 virtual
void SetEnableFlag(
vtkTypeBool flag, const
char* className, const
char* subclassName);
192 const
char* className, const
char* subclassName) VTK_FUTURE_CONST;
203 virtual
vtkTypeBool HasOverride(const
char* className) VTK_FUTURE_CONST;
207 virtual
vtkTypeBool HasOverride(const
char* className, const
char* subclassName) VTK_FUTURE_CONST;
214 virtual
void Disable(const
char* className);
220 vtkGetFilePathMacro(LibraryPath);
236 static
bool InitializePreferencesFromCommandLineArgs(
int& argc,
char* argv[]);
243 static
void SetPreferences(
std::
string preferences);
244 static
std::
string GetPreferences();
256 void RegisterOverride(const
char* classOverride, const
char* overrideClassName,
257 const
char*
description,
int enableFlag, CreateFunction createFunction,
265 virtual
vtkObject* CreateObject(const
char* vtkclassname);
285 void GrowOverrideArray();
295 static void RegisterDefaults();
299 static void LoadDynamicFactories();
303 static void LoadLibrariesInPath(
const std::string&);
311 char* LibraryVTKVersion;
336 #define VTK_CREATE_CREATE_FUNCTION(classname) \
337 static vtkObject* vtkObjectFactoryCreate##classname() \
339 return classname::New(); \
342 VTK_ABI_NAMESPACE_END
345 #define VTK_FACTORY_INTERFACE_EXPORT VTKCOMMONCORE_EXPORT
352 #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
353 extern "C" VTK_FACTORY_INTERFACE_EXPORT const char* vtkGetFactoryVersion() \
355 return VTK_SOURCE_VERSION; \
357 extern "C" VTK_FACTORY_INTERFACE_EXPORT vtkObjectFactory* vtkLoad() \
359 return factoryName ::New(); \
363 #define VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
364 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, false); \
367 return static_cast<thisClass*>(ret); \
369 auto result = new thisClass; \
370 result->InitializeObjectBase(); \
376 #define VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
377 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, true); \
380 return static_cast<thisClass*>(ret); \
382 vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \
386 #if defined(VTK_ALL_NEW_OBJECT_FACTORY)
387 #define VTK_STANDARD_NEW_BODY(thisClass) VTK_OBJECT_FACTORY_NEW_BODY(thisClass)
389 #define VTK_STANDARD_NEW_BODY(thisClass) \
390 auto result = new thisClass; \
391 result->InitializeObjectBase(); \
396 #define vtkStandardNewMacro(thisClass) \
397 thisClass* thisClass::New() \
399 VTK_STANDARD_NEW_BODY(thisClass); \
404 #define vtkStandardExtendedNewMacro(thisClass) \
405 thisClass* thisClass::ExtendedNew() \
407 auto mkhold = vtkMemkindRAII(true); \
409 return thisClass::New(); \
413 #define vtkObjectFactoryNewMacro(thisClass) \
414 thisClass* thisClass::New() \
416 VTK_OBJECT_FACTORY_NEW_BODY(thisClass); \
422 #define vtkAbstractObjectFactoryNewMacro(thisClass) \
423 thisClass* thisClass::New() \
425 VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass); \
Attribute for vtkObjectFactory overrides.
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