VTK  9.1.0
Functions
vtkObjectFactory.cmake File Reference

In VTK, certain classes can have what are called "implementations". More...

Go to the source code of this file.

Functions

function vtk_object_factory_declare ()
 Declare a factory override. More...
 
function vtk_object_factory_configure ()
 Generate source for overrides in a module. More...
 

Detailed Description

In VTK, certain classes can have what are called "implementations".

When the base class is requested, it instead looks into a list of available implementations. One of the implementations is then constructed and returned instead.

For instance, there is a vtkRenderWindow class in VTK. When this is constructed, it instead actually returns a window for the X window system, Cocoa, or Win32 depending on what is available.

VTK's implementation utilizes the autoinit logic of the module system. A module which contains an object factory must declare itself as IMPLEMENTABLE and modules which contain an implementation of an object factory must claim that they IMPLEMENTS modules containing those base object factories (a module may contain the object factory and an implementation; it then says that it IMPLEMENTS itself).

Definition in file vtkObjectFactory.cmake.

Function Documentation

◆ vtk_object_factory_declare()

function vtk_object_factory_declare ( )

Declare a factory override.

Declare that a class in this module (the implementation) is an OVERRIDE for a base class.

BASE <base>
OVERRIDE <implementation>)
function vtk_object_factory_declare()
Declare a factory override.

Definition at line 35 of file vtkObjectFactory.cmake.

◆ vtk_object_factory_configure()

function vtk_object_factory_configure ( )

Generate source for overrides in a module.

A module may only have a single declaration of all its object factory implementations. This function generates the source for all of the overrides declared using vtk_object_factory_declare.

SOURCE_FILE <variable>
[HEADER_FILE <variable>]
[EXPORT_MACRO <macro>]
[INITIAL_CODE <code>]
[EXTRA_INCLUDES <include>...])
function vtk_object_factory_configure()
Generate source for overrides in a module.
  • SOURCE_FILE: (Required) A variable to set to the path to generated source file.
  • HEADER_FILE: (Recommended) A variable to set to the path to generated header file. This should not be treated as a public header.
  • EXPORT_MACRO: (Recommended) The export macro to add to the generated class.
  • INITIAL_CODE: C++ code to run when the object factory is initialized.
  • EXTRA_INCLUDES: A list of headers to include. The header names need to include the <> or "" quoting.

Definition at line 91 of file vtkObjectFactory.cmake.