Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
berry::ExtensionType Class Reference

The ExtensionType class manages named types. More...

#include <berryExtensionType.h>

Public Types

typedef void(* Destructor) (QObject *)
 
typedef QObject *(* Constructor) ()
 

Static Public Member Functions

static int registerType (const char *typeName, Destructor destructor, Constructor constructor)
 
static int registerTypedef (const char *typeName, int aliasId)
 
static void unregisterType (const char *typeName)
 
static int type (const char *typeName)
 
static const char * typeName (int type)
 
static bool isRegistered (int type)
 
static QObject * construct (int type)
 
static void destroy (int type, QObject *data)
 

Detailed Description

The ExtensionType class manages named types.

The class associates a type name to a type so that it can be created and destructed dynamically at run-time. Call registerExtensionType() to make the type known.

Any class or struct that inherits from QObject and has a public default constructor, and a public destructor can be registered.

Definition at line 34 of file berryExtensionType.h.

Member Typedef Documentation

◆ Constructor

typedef QObject*(* berry::ExtensionType::Constructor) ()

Definition at line 40 of file berryExtensionType.h.

◆ Destructor

typedef void(* berry::ExtensionType::Destructor) (QObject *)

Definition at line 39 of file berryExtensionType.h.

Member Function Documentation

◆ construct()

static QObject* berry::ExtensionType::construct ( int  type)
static

Creates a default type.

See also
destroy()
isRegistered()

◆ destroy()

static void berry::ExtensionType::destroy ( int  type,
QObject *  data 
)
static

Destroys the data, assuming it is of the type given.

See also
construct()
isRegistered()

◆ isRegistered()

static bool berry::ExtensionType::isRegistered ( int  type)
static

Returns true if the datatype with ID type is registered; otherwise returns false.

See also
type()
typeName()

◆ registerType()

static int berry::ExtensionType::registerType ( const char *  typeName,
Destructor  destructor,
Constructor  constructor 
)
static

◆ registerTypedef()

static int berry::ExtensionType::registerTypedef ( const char *  typeName,
int  aliasId 
)
static

◆ type()

static int berry::ExtensionType::type ( const char *  typeName)
static

Returns a handle to the type called typeName, or 0 if there is no such type.

See also
isRegistered()
typeName()

◆ typeName()

static const char* berry::ExtensionType::typeName ( int  type)
static

Returns the type name associated with the given type, or 0 if no matching type was found. The returned pointer must not be deleted.

See also
type()
isRegistered()

◆ unregisterType()

static void berry::ExtensionType::unregisterType ( const char *  typeName)
static

Unregisters a type with typeName.

See also
type()
typeName()

The documentation for this class was generated from the following file: