Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
berry::ParameterType Class Reference

#include <berryParameterType.h>

Inheritance diagram for berry::ParameterType:
Collaboration diagram for berry::ParameterType:

Public Member Functions

 berryObjectMacro (ParameterType)
 
void AddListener (IParameterTypeListener *listener)
 
bool operator< (const Object *object) const override
 
void Define (const QString &type, const QSharedPointer< IParameterValueConverter > &parameterTypeConverter)
 
IParameterValueConverterGetValueConverter () const
 
bool IsCompatible (const QObject *const value) const
 
void RemoveListener (IParameterTypeListener *listener)
 
QString ToString () const override
 
void Undefine () override
 
- Public Member Functions inherited from berry::HandleObject
 berryObjectMacro (HandleObject)
 
bool operator== (const Object *object) const override
 
QString GetId () const
 
uint HashCode () const override
 
bool IsDefined () const
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 

Protected Member Functions

 ParameterType (const QString &id)
 
- Protected Member Functions inherited from berry::HandleObject
 HandleObject (const QString &id)
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 

Additional Inherited Members

- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 
- Protected Attributes inherited from berry::HandleObject
bool defined
 
const QString id
 
QString str
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Provides information about the type of a command parameter. Clients can use a parameter type to check if an object matches the type of the parameter with IsCompatible(Object::Pointer) and can get an IParameterValueConverter to convert between objects matching the parameter type and strings that encode the object's identity.

A command parameter is not required to declare a type. To determine if a given parameter has a type, check if an IParameter implements ITypedParameter and if so, use ITypedParameter#GetParameterType() like this:

                  IParameter::Pointer parameter = // ... get IParameter from Command
                  if (ITypedParameter::Pointer typedParameter = parameter.Cast<ITypedParameter>())
                  {
                    ParameterType::Pointer type = typedParameter->GetParameterType();
                    if (type) {
                      // this parameter has a ParameterType
                    }
                  }
See also
IParameter
ITypedParameter::GetParameterType()

Definition at line 56 of file berryParameterType.h.

Constructor & Destructor Documentation

◆ ParameterType()

berry::ParameterType::ParameterType ( const QString &  id)
protected

Constructs a new instance based on the given identifier. When a parameter type is first constructed, it is undefined. Parameter types should only be constructed by the CommandManager to ensure that the identifier remains unique.

Parameters
idThe identifier for this type. This value must not be null, and must be unique amongst all parameter types.

Member Function Documentation

◆ AddListener()

void berry::ParameterType::AddListener ( IParameterTypeListener listener)

Adds a listener to this parameter type that will be notified when its state changes.

Parameters
listenerThe listener to be added; must not be null.

◆ berryObjectMacro()

berry::ParameterType::berryObjectMacro ( ParameterType  )

◆ Define()

void berry::ParameterType::Define ( const QString &  type,
const QSharedPointer< IParameterValueConverter > &  parameterTypeConverter 
)

Defines this parameter type, setting the defined property to true.

Notification is sent to all listeners that something has changed.

Parameters
typea string identifying the object type for this parameter type; null is interpreted as "QObject"
parameterTypeConverteran AbstractParameterValueConverter to perform string/object conversions for parameter values; may be null

◆ GetValueConverter()

IParameterValueConverter* berry::ParameterType::GetValueConverter ( ) const

Returns the value converter associated with this parameter, if any.

Returns
The parameter value converter, or null if there is no value converter for this parameter.
Exceptions
NotDefinedExceptionif the parameter type is not currently defined

◆ IsCompatible()

bool berry::ParameterType::IsCompatible ( const QObject *const  value) const

Returns whether the provided value is compatible with this parameter type. An object is compatible with a parameter type if the object is an instance of the class defined as the parameter's type class.

Parameters
valuean object to check for compatibility with this parameter type; may be null.
Returns
true if the value is compatible with this type, false otherwise
Exceptions
NotDefinedExceptionif the parameter type is not currently defined

◆ operator<()

bool berry::ParameterType::operator< ( const Object object) const
overridevirtual

Compares this parameter type with another object by comparing each of the non-transient attributes.

Parameters
objectThe object with which to compare; must be an instance of ParameterType.
Returns
A negative integer, zero or a positive integer, if the object is greater than, equal to or less than this parameter type.

Reimplemented from berry::Object.

◆ RemoveListener()

void berry::ParameterType::RemoveListener ( IParameterTypeListener listener)

Unregisters listener for changes to properties of this parameter type.

Parameters
listenerthe instance to unregister. Must not be null. If an attempt is made to unregister an instance which is not already registered with this instance, no operation is performed.

◆ ToString()

QString berry::ParameterType::ToString ( ) const
overridevirtual

The string representation of this parameter type. For debugging purposes only. This string should not be shown to an end user.

Returns
The string representation; never null.

Reimplemented from berry::Object.

◆ Undefine()

void berry::ParameterType::Undefine ( )
overridevirtual

Makes this parameter type become undefined. Notification is sent to all listeners.

Implements berry::HandleObject.


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