Medical Imaging Interaction Toolkit  2023.12.99-63768887
Medical Imaging Interaction Toolkit
berry::IMemento Struct Referenceabstract

#include <berryIMemento.h>

Inheritance diagram for berry::IMemento:
Collaboration diagram for berry::IMemento:

Public Member Functions

 berryObjectMacro (berry::IMemento)
 
virtual IMemento::Pointer CreateChild (const QString &type)=0
 
virtual IMemento::Pointer CreateChild (const QString &type, const QString &id)=0
 
virtual IMemento::Pointer GetChild (const QString &type) const =0
 
virtual QList< IMemento::PointerGetChildren (const QString &type) const =0
 
virtual bool GetFloat (const QString &key, double &value) const =0
 
virtual bool GetInteger (const QString &key, int &value) const =0
 
virtual bool GetString (const QString &key, QString &value) const =0
 
virtual bool GetBoolean (const QString &key, bool &value) const =0
 
virtual QString GetTextData () const =0
 
virtual QList< QString > GetAttributeKeys () const =0
 
virtual QString GetType () const =0
 
virtual QString GetID () const =0
 
virtual void PutFloat (const QString &key, double value)=0
 
virtual void PutInteger (const QString &key, int value)=0
 
virtual void PutMemento (IMemento::Pointer memento)=0
 
virtual void PutString (const QString &key, const QString &value)=0
 
virtual void PutBoolean (const QString &key, bool value)=0
 
virtual void PutTextData (const QString &data)=0
 
 ~IMemento () override
 
- 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
 
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 Attributes

static const QString TAG_ID
 

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 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 inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

Interface to a memento used for saving the important state of an object in a form that can be persisted in the file system.

Mementos were designed with the following requirements in mind:

  1. Certain objects need to be saved and restored across platform sessions.
  2. When an object is restored, an appropriate class for an object might not be available. It must be possible to skip an object in this case.
  3. When an object is restored, the appropriate class for the object may be different from the one when the object was originally saved. If so, the new class should still be able to read the old form of the data.

Mementos meet these requirements by providing support for storing a mapping of arbitrary string keys to primitive values, and by allowing mementos to have other mementos as children (arranged into a tree). A robust external storage format based on XML is used.

The key for an attribute may be any alpha numeric value. However, the value of TAG_ID is reserved for internal use.

This interface is not intended to be implemented or extended by clients.

See also
IPersistableElement
IElementFactory

Definition at line 58 of file berryIMemento.h.

Constructor & Destructor Documentation

◆ ~IMemento()

berry::IMemento::~IMemento ( )
override

Member Function Documentation

◆ berryObjectMacro()

berry::IMemento::berryObjectMacro ( berry::IMemento  )

◆ CreateChild() [1/2]

virtual IMemento::Pointer berry::IMemento::CreateChild ( const QString &  type)
pure virtual

Creates a new child of this memento with the given type.

The GetChild and GetChildren methods are used to retrieve children of a given type.

Parameters
typethe type
Returns
a new child memento
See also
GetChild
GetChildren

Implemented in berry::XMLMemento.

◆ CreateChild() [2/2]

virtual IMemento::Pointer berry::IMemento::CreateChild ( const QString &  type,
const QString &  id 
)
pure virtual

Creates a new child of this memento with the given type and id. The id is stored in the child memento (using a special reserved key, TAG_ID) and can be retrieved using GetID.

The GetChild and GetChildren methods are used to retrieve children of a given type.

Parameters
typethe type
idthe child id
Returns
a new child memento with the given type and id
See also
GetID

Implemented in berry::XMLMemento.

◆ GetAttributeKeys()

virtual QList<QString> berry::IMemento::GetAttributeKeys ( ) const
pure virtual

Returns an array of all the attribute keys of the memento. This will not be null. If there are no keys, an array of length zero will be returned.

Returns
an array with all the attribute keys of the memento

Implemented in berry::XMLMemento.

◆ GetBoolean()

virtual bool berry::IMemento::GetBoolean ( const QString &  key,
bool &  value 
) const
pure virtual

Gets the boolean value of the given key.

Parameters
keythe key
valuethe value of the given key
Returns
false if the key was not found, else true

Implemented in berry::XMLMemento.

◆ GetChild()

virtual IMemento::Pointer berry::IMemento::GetChild ( const QString &  type) const
pure virtual

Returns the first child with the given type id.

Parameters
typethe type id
Returns
the first child with the given type

Implemented in berry::XMLMemento.

◆ GetChildren()

virtual QList<IMemento::Pointer> berry::IMemento::GetChildren ( const QString &  type) const
pure virtual

Returns all children with the given type id.

Parameters
typethe type id
Returns
an array of children with the given type

Implemented in berry::XMLMemento.

◆ GetFloat()

virtual bool berry::IMemento::GetFloat ( const QString &  key,
double &  value 
) const
pure virtual

Gets the floating point value of the given key.

Parameters
keythe key
valuethe value of the given key
Returns
false if the key was not found or was found but was not a floating point number, else true

Implemented in berry::XMLMemento.

◆ GetID()

virtual QString berry::IMemento::GetID ( ) const
pure virtual

Returns the id for this memento.

Returns
the memento id, or "" if none
See also
CreateChild(const QString&, const QString&)

Implemented in berry::XMLMemento.

◆ GetInteger()

virtual bool berry::IMemento::GetInteger ( const QString &  key,
int &  value 
) const
pure virtual

Gets the integer value of the given key.

Parameters
keythe key
valuethe value of the given key
Returns
false if the key was not found or was found but was not an integer, else true

Implemented in berry::XMLMemento.

◆ GetString()

virtual bool berry::IMemento::GetString ( const QString &  key,
QString &  value 
) const
pure virtual

Gets the string value of the given key.

Parameters
keythe key
valuethe value of the given key
Returns
false if the key was not found, else true

Implemented in berry::XMLMemento.

◆ GetTextData()

virtual QString berry::IMemento::GetTextData ( ) const
pure virtual

Returns the data of the Text node of the memento. Each memento is allowed only one Text node.

Returns
the data of the Text node of the memento, or null if the memento has no Text node.

Implemented in berry::XMLMemento.

◆ GetType()

virtual QString berry::IMemento::GetType ( ) const
pure virtual

Returns the type for this memento.

Returns
the memento type
See also
CreateChild(const QString&)
CreateChild(const QString&, const QString&)

Implemented in berry::XMLMemento.

◆ PutBoolean()

virtual void berry::IMemento::PutBoolean ( const QString &  key,
bool  value 
)
pure virtual

Sets the value of the given key to the given boolean value.

Parameters
keythe key
valuethe value

Implemented in berry::XMLMemento.

◆ PutFloat()

virtual void berry::IMemento::PutFloat ( const QString &  key,
double  value 
)
pure virtual

Sets the value of the given key to the given floating point number.

Parameters
keythe key
valuethe value

Implemented in berry::XMLMemento.

◆ PutInteger()

virtual void berry::IMemento::PutInteger ( const QString &  key,
int  value 
)
pure virtual

Sets the value of the given key to the given integer.

Parameters
keythe key
valuethe value

Implemented in berry::XMLMemento.

◆ PutMemento()

virtual void berry::IMemento::PutMemento ( IMemento::Pointer  memento)
pure virtual

Copy the attributes and children from memento to the receiver.

Parameters
mementothe IMemento to be copied.

Implemented in berry::XMLMemento.

◆ PutString()

virtual void berry::IMemento::PutString ( const QString &  key,
const QString &  value 
)
pure virtual

Sets the value of the given key to the given const QString&.

Parameters
keythe key
valuethe value

Implemented in berry::XMLMemento.

◆ PutTextData()

virtual void berry::IMemento::PutTextData ( const QString &  data)
pure virtual

Sets the memento's Text node to contain the given data. Creates the Text node if none exists. If a Text node does exist, it's current contents are replaced. Each memento is allowed only one text node.

Parameters
datathe data to be placed on the Text node

Implemented in berry::XMLMemento.

Member Data Documentation

◆ TAG_ID

const QString berry::IMemento::TAG_ID
static

Special reserved key used to store the memento id (value "IMemento.internal.id").

See also
GetID

Definition at line 68 of file berryIMemento.h.


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