Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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()

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

Creates a default type.

See also
destroy()
isRegistered()

Definition at line 166 of file berryExtensionType.cpp.

◆ destroy()

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

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

See also
construct()
isRegistered()

Definition at line 181 of file berryExtensionType.cpp.

◆ isRegistered()

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

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

See also
type()
typeName()

Definition at line 141 of file berryExtensionType.cpp.

◆ registerType()

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

◆ registerTypedef()

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

◆ type()

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()

Definition at line 149 of file berryExtensionType.cpp.

References berry::extensionTypeCustomType_unlocked().

◆ typeName()

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()

Definition at line 39 of file berryExtensionType.cpp.

◆ unregisterType()

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

Unregisters a type with typeName.

See also
type()
typeName()

Definition at line 120 of file berryExtensionType.cpp.


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