Medical Imaging Interaction Toolkit
2023.12.00
Medical Imaging Interaction Toolkit
|
#include <berryHandleObject.h>
Public Member Functions | |
berryObjectMacro (HandleObject) | |
bool | operator== (const Object *object) const override |
QString | GetId () const |
uint | HashCode () const override |
bool | IsDefined () const |
virtual void | Undefine ()=0 |
Public Member Functions inherited from berry::Object | |
virtual QString | GetClassName () const |
virtual Reflection::TypeInfo | GetTypeInfo () const |
virtual QList< Reflection::TypeInfo > | GetSuperclasses () const |
virtual void | Delete () |
QDebug | Print (QDebug os, Indent Indent=0) const |
virtual QString | ToString () const |
virtual bool | operator< (const Object *) 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 | |
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 |
Protected Attributes | |
bool | defined |
const QString | id |
QString | str |
Protected Attributes inherited from berry::Object | |
QAtomicInt | m_ReferenceCount |
QMutex | m_ReferenceCountLock |
Additional Inherited Members | |
Public Types inherited from berry::Object | |
typedef Object | Self |
typedef berry::SmartPointer< Self > | Pointer |
typedef berry::SmartPointer< const Self > | ConstPointer |
typedef berry::WeakPointer< Self > | WeakPtr |
typedef berry::WeakPointer< const Self > | ConstWeakPtr |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
An object that can exist in one of two states: defined and undefined. This is used by APIs that want to give a handle to an object, even though the object does not fully exist yet. This way, users can attach listeners to objects before they come into existence. It also protects the API from users that do not release references when they should.
To enforce good coding practice, all handle objects must implement equals
and toString
. Please use string
to cache the result for toString
once calculated.
All handle objects are referred to using a single identifier. This identifier is a instance of String
. It is important that this identifier remain unique within whatever context that handle object is being used. For example, there should only ever be one instance of Command
with a given identifier.
Definition at line 48 of file berryHandleObject.h.
|
protected |
Constructs a new instance of HandleObject
.
id | The id of this handle; must not be null . |
berry::HandleObject::berryObjectMacro | ( | HandleObject | ) |
QString berry::HandleObject::GetId | ( | ) | const |
|
inlineoverridevirtual |
Computes the hash code for this object based on the id.
Reimplemented from berry::Object.
Definition at line 131 of file berryHandleObject.h.
References qHash().
bool berry::HandleObject::IsDefined | ( | ) | const |
Whether this instance is defined. A defined instance is one that has been fully initialized. This allows objects to effectively disappear even though other objects may still have references to them.
true
if this object is defined; false
otherwise.
|
overridevirtual |
Tests whether this object is equal to another object. A handle object is only equal to another handle object with the same id and the same class.
object | The object with which to compare; may be null . |
true
if the objects are equal; false
otherwise. Reimplemented from berry::Object.
|
pure virtual |
Makes this object becomes undefined. This method should make any defined properties null
. It should also send notification to any listeners that these properties have changed.
Implemented in berry::Command, berry::ParameterType, and berry::CommandCategory.
|
protected |
Whether this object is defined. A defined object is one that has been fully initialized. By default, all objects start as undefined.
Definition at line 85 of file berryHandleObject.h.
|
protected |
The identifier for this object. This identifier should be unique across all objects of the same type and should never change. This value will never be null
.
Definition at line 92 of file berryHandleObject.h.
|
mutableprotected |
The string representation of this object. This string is for debugging purposes only, and is not meant to be displayed to the user. This value is computed lazily, and is cleared if one of its dependent values changes.
Definition at line 100 of file berryHandleObject.h.