38 #ifndef vtkObjectFactory_h 39 #define vtkObjectFactory_h 42 #include "vtkCommonCoreModule.h" 64 static vtkObject* CreateInstance(
const char* vtkclassname,
65 bool isAbstract =
false);
73 static void CreateAllInstance(
const char* vtkclassname,
91 static void UnRegisterAllFactories();
103 static int HasOverrideAny(
const char* className);
109 static void GetOverrideInformation(
const char*
name,
117 const char* className);
123 const char* className,
124 const char* subclassName);
142 virtual const char* GetVTKSourceVersion() = 0;
147 virtual const char* GetDescription() = 0;
152 virtual int GetNumberOfOverrides();
157 virtual const char* GetClassOverrideName(
int index);
163 virtual const char* GetClassOverrideWithName(
int index);
174 virtual const char* GetOverrideDescription(
int index);
182 const char* className,
183 const char* subclassName);
184 virtual vtkTypeBool GetEnableFlag(
const char* className,
185 const char* subclassName);
191 virtual int HasOverride(
const char* className);
195 virtual int HasOverride(
const char* className,
const char* subclassName);
202 virtual void Disable(
const char* className);
208 vtkGetStringMacro(LibraryPath);
218 void RegisterOverride(
const char* classOverride,
219 const char* overrideClassName,
222 CreateFunction createFunction);
229 virtual vtkObject* CreateObject(
const char* vtkclassname );
248 void GrowOverrideArray();
258 static void RegisterDefaults();
262 static void LoadDynamicFactories();
266 static void LoadLibrariesInPath(
const char*);
274 char* LibraryVTKVersion;
275 char* LibraryCompilerUsed;
299 #define VTK_CREATE_CREATE_FUNCTION(classname) \ 300 static vtkObject* vtkObjectFactoryCreate##classname() \ 301 { return classname::New(); } 305 #define VTK_FACTORY_INTERFACE_EXPORT VTKCOMMONCORE_EXPORT 312 #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \ 314 VTK_FACTORY_INTERFACE_EXPORT \ 315 const char* vtkGetFactoryCompilerUsed() \ 317 return VTK_CXX_COMPILER; \ 320 VTK_FACTORY_INTERFACE_EXPORT \ 321 const char* vtkGetFactoryVersion() \ 323 return VTK_SOURCE_VERSION; \ 326 VTK_FACTORY_INTERFACE_EXPORT \ 327 vtkObjectFactory* vtkLoad() \ 329 return factoryName ::New(); \ 333 #define VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \ 334 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, false); \ 337 return static_cast<thisClass*>(ret); \ 339 thisClass *result = new thisClass; \ 340 result->InitializeObjectBase(); \ 346 #define VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \ 347 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, true); \ 350 return static_cast<thisClass*>(ret); \ 352 vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \ 356 #if defined(VTK_ALL_NEW_OBJECT_FACTORY) 357 # define VTK_STANDARD_NEW_BODY(thisClass) \ 358 VTK_OBJECT_FACTORY_NEW_BODY(thisClass) 360 # define VTK_STANDARD_NEW_BODY(thisClass) \ 361 thisClass *result = new thisClass; \ 362 result->InitializeObjectBase(); \ 367 #define vtkStandardNewMacro(thisClass) \ 368 thisClass* thisClass::New() \ 370 VTK_STANDARD_NEW_BODY(thisClass) \ 374 #define vtkObjectFactoryNewMacro(thisClass) \ 375 thisClass* thisClass::New() \ 377 VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \ 383 #define vtkAbstractObjectFactoryNewMacro(thisClass) \ 384 thisClass* thisClass::New() \ 386 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