Medical Imaging Interaction Toolkit  2016.11.0
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 39 of file berryExtensionType.h.

Member Typedef Documentation

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

Definition at line 45 of file berryExtensionType.h.

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

Definition at line 44 of file berryExtensionType.h.

Member Function Documentation

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

Creates a default type.

See also
destroy()
isRegistered()

Definition at line 170 of file berryExtensionType.cpp.

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 185 of file berryExtensionType.cpp.

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 145 of file berryExtensionType.cpp.

int berry::ExtensionType::registerType ( const char *  typeName,
Destructor  destructor,
Constructor  constructor 
)
static
int berry::ExtensionType::registerTypedef ( const char *  typeName,
int  aliasId 
)
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()

Definition at line 153 of file berryExtensionType.cpp.

References berry::extensionTypeCustomType_unlocked().

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 43 of file berryExtensionType.cpp.

Referenced by unregisterType().

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

Unregisters a type with typeName.

See also
type()
typeName()

Definition at line 124 of file berryExtensionType.cpp.

References typeName().


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