Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
Medical Imaging Interaction Toolkit
berry::Object Class Reference

Light weight base class for most BlueBerry classes. More...

#include <berryObject.h>

Inherited by berry::AbstractBitSetEvent [virtual], berry::AbstractContributionFactory, berry::ActionBarAdvisor, berry::CommandContributionItemParameter [virtual], berry::CommandManagerEvent, berry::ElementHandler, berry::EvaluationResult, berry::ExecutionEvent, berry::Expression, berry::GuiTk::Event, berry::GuiTk::IControlListener [virtual], berry::GuiTk::ISelectionListener [virtual], berry::HandleObject [virtual], berry::IActionBarConfigurer, berry::IActionBars, berry::IAdapterManager, berry::IConfigurationElement [virtual], berry::IContributionItem [virtual], berry::IContributionManager [virtual], berry::IContributionManagerOverrides [virtual], berry::IContributionRoot, berry::IContributor, berry::ICountable, berry::IDisposable [virtual], berry::IEditorInput [virtual], berry::IEditorMatchingStrategy, berry::IElementReference, berry::IElementUpdater [virtual], berry::IEvaluationContext, berry::IExtension [virtual], berry::IExtensionPoint [virtual], berry::IFileEditorMapping, berry::IHandler [virtual], berry::IIntroPart [virtual], berry::IIterable, berry::IJobChangeEvent, berry::IJobManager, berry::ILock, berry::IMemento, berry::INestable [virtual], berry::IntroContentDetector, berry::IObjectWithState [virtual], berry::IPageLayout, berry::IParameter [virtual], berry::IPerspectiveDescriptor [virtual], berry::IPerspectiveFactory, berry::IPlaceholderFolderLayout, berry::IPluginContribution [virtual], berry::IPreferencePage [virtual], berry::IPreferences [virtual], berry::IPresentablePart, berry::IProduct [virtual], berry::IProgressMonitor, berry::IPropertyTester, berry::ISafeRunnable, berry::ISafeRunnableRunner, berry::ISaveablePart [virtual], berry::ISaveablesLifecycleListener [virtual], berry::ISaveablesSource [virtual], berry::ISchedulingRule, berry::ISelection, berry::ISelectionProvider [virtual], berry::IServiceLocator [virtual], berry::IShellProvider [virtual], berry::IShowInSource [virtual], berry::IShowInTarget [virtual], berry::ISourceProvider [virtual], berry::ISourceProviderService [virtual], berry::IStackPresentationSite, berry::IStatus, berry::IStickyViewDescriptor, berry::ITypedParameter [virtual], berry::IViewCategory [virtual], berry::IViewLayout, berry::IWorkbenchConfigurer, berry::IWorkbenchPage, berry::IWorkbenchPart [virtual], berry::IWorkbenchPartDescriptor [virtual], berry::IWorkbenchPartReference, berry::IWorkbenchWindow [virtual], berry::IWorkbenchWindowConfigurer, berry::LockListener, berry::ObjectGeneric< T >, berry::ObjectList< T >, berry::ObjectString, berry::ObjectStringMap, berry::ObjectTypeInfo, berry::ParameterizedCommand, berry::PlatformObject [virtual], berry::ProgressProvider, berry::PropertyChangeEvent, berry::QModelIndexObject, berry::Saveable [virtual], berry::SaveablesLifecycleEvent, berry::SelectionChangedEvent, berry::Shell [virtual], berry::ShellEvent, berry::ShowInContext [virtual], berry::StackDropResult, berry::StackPresentation, berry::State, berry::UIElement, berry::UndefinedVariable, berry::Window::IExceptionHandler, IChangeText [virtual], mitk::DataNodeObject, mitk::IDataStorageReference, mitk::IInputDevice, mitk::IInputDeviceDescriptor, mitk::MAPAlgorithmInfoObject, berry::ObjectGeneric< bool >, berry::ObjectGeneric< double >, berry::ObjectGeneric< float >, and berry::ObjectGeneric< int >.

Public Types

typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 

Public Member Functions

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
 
virtual QString ToString () const
 
virtual uint HashCode () 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
 
virtual bool operator== (const Object *) const
 

Static Public Member Functions

static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 

Protected Member Functions

 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

QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Light weight base class for most BlueBerry classes.

Object is copied from itk::LightObject and is the highest level base class for most BlueBerry objects. It implements reference counting and the API for object printing.

Definition at line 72 of file berryObject.h.

Member Typedef Documentation

◆ ConstPointer

Definition at line 83 of file berryObject.h.

◆ ConstWeakPtr

Definition at line 85 of file berryObject.h.

◆ Pointer

Definition at line 82 of file berryObject.h.

◆ Self

Definition at line 81 of file berryObject.h.

◆ WeakPtr

Definition at line 84 of file berryObject.h.

Constructor & Destructor Documentation

◆ Object()

berry::Object::Object ( )
protected

Definition at line 163 of file berryObject.cpp.

References berry::DebugUtil::RegisterObject().

Referenced by berry::EvaluationResult::operator!=().

◆ ~Object()

berry::Object::~Object ( )
protectedvirtual

warn user if reference counting is on and the object is being referenced by another object.

notifies the registered functions that the object is being destroyed

Definition at line 173 of file berryObject.cpp.

References BERRY_WARN, GetClassName(), m_ReferenceCount, berry::Message< A >::Send(), and berry::DebugUtil::UnregisterObject().

Member Function Documentation

◆ AddDestroyListener()

void berry::Object::AddDestroyListener ( const MessageAbstractDelegate<> &  delegate) const
inline

Definition at line 153 of file berryObject.h.

◆ Delete()

void berry::Object::Delete ( )
virtual

Delete an BlueBerry object. This method should always be used to delete an object when the new operator was used to create it. Using the C delete method will not work with reference counting.

Definition at line 31 of file berryObject.cpp.

References UnRegister().

◆ GetClassName()

◆ GetReferenceCount()

int berry::Object::GetReferenceCount ( ) const
inline

Gets the reference count on this object.

Definition at line 144 of file berryObject.h.

◆ GetStaticClassName()

const char * berry::Object::GetStaticClassName ( )
static

Definition at line 66 of file berryObject.cpp.

◆ GetStaticSuperclasses()

QList< Reflection::TypeInfo > berry::Object::GetStaticSuperclasses ( )
static

Definition at line 86 of file berryObject.cpp.

Referenced by GetSuperclasses().

◆ GetStaticTypeInfo()

Reflection::TypeInfo berry::Object::GetStaticTypeInfo ( )
static

Definition at line 76 of file berryObject.cpp.

Referenced by GetTypeInfo().

◆ GetSuperclasses()

QList< Reflection::TypeInfo > berry::Object::GetSuperclasses ( ) const
virtual

Reimplemented in berry::ObjectTypeInfo.

Definition at line 91 of file berryObject.cpp.

References GetStaticSuperclasses().

◆ GetTypeInfo()

Reflection::TypeInfo berry::Object::GetTypeInfo ( ) const
virtual

Reimplemented in berry::ObjectTypeInfo.

Definition at line 81 of file berryObject.cpp.

References GetStaticTypeInfo().

◆ HashCode()

uint berry::Object::HashCode ( ) const
virtual

Returns a hash code value for the object.

Reimplemented in berry::Saveable, berry::ParameterizedCommand, berry::Expression, berry::HandleObject, and berry::QActionContributionItem.

Definition at line 111 of file berryObject.cpp.

References qHash().

Referenced by qHash().

◆ operator<()

bool berry::Object::operator< ( const Object o) const
virtual

Override this method to implement a specific "less than" operator for associative STL containers.

Reimplemented in berry::Command, berry::Saveable, berry::ParameterizedCommand, and berry::ParameterType.

Definition at line 116 of file berryObject.cpp.

◆ operator==()

◆ Print()

QDebug berry::Object::Print ( QDebug  os,
Indent  Indent = 0 
) const

Cause the object to print itself out. This is usually used to provide detailed information about the object's state. It just calls the header/self/trailer virtual print methods, which can be overriden by subclasses.

Definition at line 96 of file berryObject.cpp.

References berry::Indent::GetNextIndent(), PrintHeader(), PrintSelf(), and PrintTrailer().

Referenced by operator<<(), and ToString().

◆ PrintHeader()

QDebug berry::Object::PrintHeader ( QDebug  os,
Indent  Indent 
) const
protectedvirtual

Define a default print header for all objects.

Definition at line 212 of file berryObject.cpp.

References GetClassName().

Referenced by Print().

◆ PrintSelf()

QDebug berry::Object::PrintSelf ( QDebug  os,
Indent  indent 
) const
protectedvirtual

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Definition at line 201 of file berryObject.cpp.

References berry::Reflection::DemangleName(), and m_ReferenceCount.

Referenced by Print().

◆ PrintTrailer()

QDebug berry::Object::PrintTrailer ( QDebug  os,
Indent  indent 
) const
protectedvirtual

Define a default print trailer for all objects.

Definition at line 221 of file berryObject.cpp.

Referenced by Print().

◆ Register()

void berry::Object::Register ( ) const

◆ RemoveDestroyListener()

void berry::Object::RemoveDestroyListener ( const MessageAbstractDelegate<> &  delegate) const
inline

Definition at line 155 of file berryObject.h.

References mitk::operator==().

◆ SetReferenceCount()

void berry::Object::SetReferenceCount ( int  ref)

Sets the reference count on this object. This is a dangerous method, use it with care.

Definition at line 134 of file berryObject.cpp.

References m_ReferenceCount, and m_ReferenceCountLock.

◆ ToString()

QString berry::Object::ToString ( ) const
virtual

◆ UnRegister()

void berry::Object::UnRegister ( bool  del = true) const

Decrease the reference count (release by another object). Set del to false if you do not want the object to be deleted if the reference count is zero (use with care!)

Definition at line 126 of file berryObject.cpp.

References m_ReferenceCount.

Referenced by berry::QScopedPointerObjectDeleter::cleanup(), Delete(), berry::SmartPointer< berry::MenuManager >::operator=(), QmitkAbstractView::~QmitkAbstractView(), and QmitkFunctionality::~QmitkFunctionality().

Member Data Documentation

◆ m_ReferenceCount

QAtomicInt berry::Object::m_ReferenceCount
mutableprotected

Number of uses of this object by other objects.

Definition at line 191 of file berryObject.h.

Referenced by PrintSelf(), Register(), SetReferenceCount(), UnRegister(), and ~Object().

◆ m_ReferenceCountLock

QMutex berry::Object::m_ReferenceCountLock
mutableprotected

Mutex lock to protect modification to the reference count

Definition at line 194 of file berryObject.h.

Referenced by SetReferenceCount().


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