Go to the documentation of this file.
44 #ifndef vtkObjectFactory_h
45 #define vtkObjectFactory_h
48 #include "vtkCommonCoreModule.h"
73 bool isAbstract =
false);
125 const char* className);
131 const char* className,
132 const char* subclassName);
190 const char* className,
191 const char* subclassName);
193 const char* subclassName);
203 virtual int HasOverride(
const char* className,
const char* subclassName);
216 vtkGetStringMacro(LibraryPath);
227 const char* overrideClassName,
230 CreateFunction createFunction);
256 void GrowOverrideArray();
266 static void RegisterDefaults();
270 static void LoadDynamicFactories();
274 static void LoadLibrariesInPath(
const std::string&);
282 char* LibraryVTKVersion;
283 char* LibraryCompilerUsed;
307 #define VTK_CREATE_CREATE_FUNCTION(classname) \
308 static vtkObject* vtkObjectFactoryCreate##classname() \
309 { return classname::New(); }
313 #define VTK_FACTORY_INTERFACE_EXPORT VTKCOMMONCORE_EXPORT
320 #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
322 VTK_FACTORY_INTERFACE_EXPORT \
323 const char* vtkGetFactoryCompilerUsed() \
325 return VTK_CXX_COMPILER; \
328 VTK_FACTORY_INTERFACE_EXPORT \
329 const char* vtkGetFactoryVersion() \
331 return VTK_SOURCE_VERSION; \
334 VTK_FACTORY_INTERFACE_EXPORT \
335 vtkObjectFactory* vtkLoad() \
337 return factoryName ::New(); \
341 #define VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
342 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, false); \
345 return static_cast<thisClass*>(ret); \
347 thisClass *result = new thisClass; \
348 result->InitializeObjectBase(); \
354 #define VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
355 vtkObject* ret = vtkObjectFactory::CreateInstance(#thisClass, true); \
358 return static_cast<thisClass*>(ret); \
360 vtkGenericWarningMacro("Error: no override found for '" #thisClass "'."); \
364 #if defined(VTK_ALL_NEW_OBJECT_FACTORY)
365 # define VTK_STANDARD_NEW_BODY(thisClass) \
366 VTK_OBJECT_FACTORY_NEW_BODY(thisClass)
368 # define VTK_STANDARD_NEW_BODY(thisClass) \
369 thisClass *result = new thisClass; \
370 result->InitializeObjectBase(); \
375 #define vtkStandardNewMacro(thisClass) \
376 thisClass* thisClass::New() \
378 VTK_STANDARD_NEW_BODY(thisClass) \
382 #define vtkObjectFactoryNewMacro(thisClass) \
383 thisClass* thisClass::New() \
385 VTK_OBJECT_FACTORY_NEW_BODY(thisClass) \
391 #define vtkAbstractObjectFactoryNewMacro(thisClass) \
392 thisClass* thisClass::New() \
394 VTK_ABSTRACT_OBJECT_FACTORY_NEW_BODY(thisClass) \
virtual vtkObject * CreateObject(const char *vtkclassname)
This method is provided by sub-classes of vtkObjectFactory.
static void CreateAllInstance(const char *vtkclassname, vtkCollection *retList)
Create all possible instances of the named vtk object.
static void RegisterFactory(vtkObjectFactory *)
Register a factory so it can be used to create vtk objects.
virtual const char * GetOverrideDescription(int index)
Return the description for a the class override at the given index.
static vtkObjectFactoryRegistryCleanup vtkObjectFactoryRegistryCleanupInstance
static void GetOverrideInformation(const char *name, vtkOverrideInformationCollection *)
Fill the given collection with all the overrides for the class with the given name.
virtual void SetEnableFlag(vtkTypeBool flag, const char *className, const char *subclassName)
Set and Get the Enable flag for the specific override of className.
virtual int HasOverride(const char *className)
Return 1 if this factory overrides the given class name, 0 otherwise.
abstract base class for most VTK objects
virtual vtkTypeBool GetEnableFlag(int index)
Return the enable flag for the class at the given index.
static void ReHash()
Re-check the VTK_AUTOLOAD_PATH for new factory libraries.
virtual void Disable(const char *className)
Set all enable flags for the given class to 0.
virtual const char * GetClassOverrideName(int index)
Return the name of a class override at the given index.
virtual int GetNumberOfOverrides()
Return number of overrides this factory can create.
static void UnRegisterFactory(vtkObjectFactory *)
Remove a factory from the list of registered factories.
void RegisterOverride(const char *classOverride, const char *overrideClassName, const char *description, int enableFlag, CreateFunction createFunction)
Register object creation information with the factory.
char ** OverrideClassNames
vtkObjectFactoryRegistryCleanup()
~vtkObjectFactoryRegistryCleanup()
create and manipulate ordered lists of objects
abstract base class for vtkObjectFactories
static int HasOverrideAny(const char *className)
return 1 if one of the registered factories overrides the given class name
static vtkObjectFactoryCollection * GetRegisteredFactories()
Return the list of all registered factories.
a simple class to control print indentation
static void UnRegisterAllFactories()
Unregister all factories.
virtual int HasOverride(const char *className, const char *subclassName)
Return 1 if this factory overrides the given class name, 0 otherwise.
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 vtkObject * CreateInstance(const char *vtkclassname, bool isAbstract=false)
Create and return an instance of the named vtk object.
maintain a list of object factories
static void SetAllEnableFlags(vtkTypeBool flag, const char *className)
Set the enable flag for a given named class for all registered factories.
void PrintSelf(ostream &os, vtkIndent indent) override
Print ObjectFactory to stream.
~vtkObjectFactory() override
OverrideInformation * OverrideArray
virtual const char * GetDescription()=0
Return a descriptive string describing the factory.
virtual const char * GetClassOverrideWithName(int index)
Return the name of the class that will override the class at the given index.
virtual const char * GetVTKSourceVersion()=0
All sub-classes of vtkObjectFactory should must return the version of VTK they were built with.
virtual vtkTypeBool GetEnableFlag(const char *className, const char *subclassName)