Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::PropertyPersistenceInfo Class Reference

Property persistence info. More...

#include <mitkPropertyPersistenceInfo.h>

Inheritance diagram for mitk::PropertyPersistenceInfo:
Collaboration diagram for mitk::PropertyPersistenceInfo:

Public Types

using DeserializationFunctionType = std::function< mitk::BaseProperty::Pointer(const std::string &)>
 Signature specification for functions that can be provided for deserialization of the property. More...
 
using SerializationFunctionType = std::function< std::string(const mitk::BaseProperty *)>
 Signature specification for functions that can be provided for serialization of the property. More...
 
using MimeTypeNameType = std::string
 Type alias for MIME type name strings. More...
 

Public Member Functions

 mitkClassMacroItkParent (PropertyPersistenceInfo, itk::LightObject)
 
Pointer Clone () const
 
 mitkNewMacro1Param (Self, const std::string &)
 
 mitkNewMacro2Param (Self, const std::string &, const std::string &)
 
std::string GetName () const
 Get the property name described by this info. More...
 
std::string GetKey () const
 Get the persistence key used for this property. More...
 
void SetName (const std::string &name)
 Set the property name (and key to the same value). More...
 
void SetNameAndKey (const std::string &name, const std::string &key)
 Set name and key independently. More...
 
bool IsRegEx () const
 Check whether this info uses regular expressions for name and key matching. More...
 
void UseRegEx (const std::string &nameRegEx, const std::string &nameTemplate)
 Set the name and key as a regular expression with a shared template. More...
 
void UseRegEx (const std::string &nameRegEx, const std::string &nameTemplate, const std::string &keyRegEx, const std::string keyTemplate)
 Set the name and key as separate regular expressions with individual templates. More...
 
const std::string & GetKeyTemplate () const
 Get the template string used for generating concrete keys from regex groups. More...
 
const std::string & GetNameTemplate () const
 Get the template string used for generating concrete names from regex groups. More...
 
const MimeTypeNameType & GetMimeTypeName () const
 Get the MIME type name this persistence info is associated with. More...
 
void SetMimeTypeName (const MimeTypeNameType &mimeTypeName)
 Set the MIME type name this persistence info should be associated with. More...
 
const DeserializationFunctionType GetDeserializationFunction () const
 Get the deserialization function used to convert a string back to a property. More...
 
void SetDeserializationFunction (const DeserializationFunctionType &fnc)
 Set the deserialization function. More...
 
const SerializationFunctionType GetSerializationFunction () const
 Get the serialization function used to convert a property to a string. More...
 
void SetSerializationFunction (const SerializationFunctionType &fnc)
 Set the serialization function. More...
 
PropertyPersistenceInfo::Pointer UnRegExByName (const std::string &propertyName) const
 Create a non-regex info by resolving the regex against a property name. More...
 
PropertyPersistenceInfo::Pointer UnRegExByKey (const std::string &key) const
 Create a non-regex info by resolving the regex against a persistence key. More...
 

Static Public Member Functions

static Pointer New ()
 
static MimeTypeNameType ANY_MIMETYPE_NAME ()
 Return the MIME type name that indicates compatibility with any MIME type. More...
 

Protected Member Functions

 PropertyPersistenceInfo (const std::string &name="")
 Constructor. More...
 
 PropertyPersistenceInfo (const std::string &name, const std::string &mimeTypeName)
 Constructor. More...
 
 ~PropertyPersistenceInfo () override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 

Detailed Description

Property persistence info.

This class is used to specify the way the persistence of a property of BaseData derived instances is handled. The info specifies the key for property, as well as the mime type the info is defined for and should be used. Additionally the functions for deserialization and serialization of the property can be defined. By default, serialization uses BaseProperty::GetValueAsString() and deserialization creates a StringProperty.

Definition at line 33 of file mitkPropertyPersistenceInfo.h.

Member Typedef Documentation

◆ DeserializationFunctionType

using mitk::PropertyPersistenceInfo::DeserializationFunctionType = std::function<mitk::BaseProperty::Pointer(const std::string &)>

Signature specification for functions that can be provided for deserialization of the property.

Postcondition
The function returns a valid instance derived from mitk::BaseProperty.

Definition at line 39 of file mitkPropertyPersistenceInfo.h.

◆ MimeTypeNameType

Type alias for MIME type name strings.

Definition at line 45 of file mitkPropertyPersistenceInfo.h.

◆ SerializationFunctionType

Signature specification for functions that can be provided for serialization of the property.

Definition at line 42 of file mitkPropertyPersistenceInfo.h.

Constructor & Destructor Documentation

◆ PropertyPersistenceInfo() [1/2]

mitk::PropertyPersistenceInfo::PropertyPersistenceInfo ( const std::string &  name = "")
protected

Constructor.

Parameters
[in]nameName is the name of the property that described by the info. Key will be the same.

◆ PropertyPersistenceInfo() [2/2]

mitk::PropertyPersistenceInfo::PropertyPersistenceInfo ( const std::string &  name,
const std::string &  mimeTypeName 
)
protected

Constructor.

Parameters
[in]nameName is the name of the property that described by the info. Key will be the same.
[in]mimeTypeNamemime type the info is defined for.

◆ ~PropertyPersistenceInfo()

mitk::PropertyPersistenceInfo::~PropertyPersistenceInfo ( )
overrideprotected

Member Function Documentation

◆ ANY_MIMETYPE_NAME()

static MimeTypeNameType mitk::PropertyPersistenceInfo::ANY_MIMETYPE_NAME ( )
static

Return the MIME type name that indicates compatibility with any MIME type.

An info using this MIME type name will be used as a fallback when no info with a more specific MIME type is available.

◆ Clone()

Pointer mitk::PropertyPersistenceInfo::Clone ( ) const

◆ GetDeserializationFunction()

const DeserializationFunctionType mitk::PropertyPersistenceInfo::GetDeserializationFunction ( ) const

Get the deserialization function used to convert a string back to a property.

◆ GetKey()

std::string mitk::PropertyPersistenceInfo::GetKey ( ) const

Get the persistence key used for this property.

The key is used as identifier when the property is persisted (e.g. as DICOM tag or file key). By default, the key equals the name.

◆ GetKeyTemplate()

const std::string& mitk::PropertyPersistenceInfo::GetKeyTemplate ( ) const

Get the template string used for generating concrete keys from regex groups.

◆ GetMimeTypeName()

const MimeTypeNameType& mitk::PropertyPersistenceInfo::GetMimeTypeName ( ) const

Get the MIME type name this persistence info is associated with.

◆ GetName()

std::string mitk::PropertyPersistenceInfo::GetName ( ) const

Get the property name described by this info.

◆ GetNameTemplate()

const std::string& mitk::PropertyPersistenceInfo::GetNameTemplate ( ) const

Get the template string used for generating concrete names from regex groups.

◆ GetSerializationFunction()

const SerializationFunctionType mitk::PropertyPersistenceInfo::GetSerializationFunction ( ) const

Get the serialization function used to convert a property to a string.

◆ IsRegEx()

bool mitk::PropertyPersistenceInfo::IsRegEx ( ) const

Check whether this info uses regular expressions for name and key matching.

◆ mitkClassMacroItkParent()

mitk::PropertyPersistenceInfo::mitkClassMacroItkParent ( PropertyPersistenceInfo  ,
itk::LightObject   
)

◆ mitkNewMacro1Param()

mitk::PropertyPersistenceInfo::mitkNewMacro1Param ( Self  ,
const std::string &   
)

◆ mitkNewMacro2Param()

mitk::PropertyPersistenceInfo::mitkNewMacro2Param ( Self  ,
const std::string &  ,
const std::string &   
)

◆ New()

static Pointer mitk::PropertyPersistenceInfo::New ( )
static

◆ PrintSelf()

void mitk::PropertyPersistenceInfo::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

◆ SetDeserializationFunction()

void mitk::PropertyPersistenceInfo::SetDeserializationFunction ( const DeserializationFunctionType &  fnc)

Set the deserialization function.

Parameters
[in]fncFunction that converts a serialized string to a BaseProperty.

◆ SetMimeTypeName()

void mitk::PropertyPersistenceInfo::SetMimeTypeName ( const MimeTypeNameType &  mimeTypeName)

Set the MIME type name this persistence info should be associated with.

Parameters
[in]mimeTypeNameThe MIME type name.

◆ SetName()

void mitk::PropertyPersistenceInfo::SetName ( const std::string &  name)

Set the property name (and key to the same value).

Resets any regular expression settings.

Parameters
[in]nameThe property name.

◆ SetNameAndKey()

void mitk::PropertyPersistenceInfo::SetNameAndKey ( const std::string &  name,
const std::string &  key 
)

Set name and key independently.

Resets any regular expression settings.

Parameters
[in]nameThe property name.
[in]keyThe persistence key.

◆ SetSerializationFunction()

void mitk::PropertyPersistenceInfo::SetSerializationFunction ( const SerializationFunctionType &  fnc)

Set the serialization function.

Parameters
[in]fncFunction that converts a BaseProperty to a serialized string.

◆ UnRegExByKey()

PropertyPersistenceInfo::Pointer mitk::PropertyPersistenceInfo::UnRegExByKey ( const std::string &  key) const

Create a non-regex info by resolving the regex against a persistence key.

If this info is a regex, generates a concrete PropertyPersistenceInfo by applying the key to the name template. If not a regex, returns a copy.

Parameters
[in]keyThe concrete persistence key to resolve against.
Returns
A new non-regex PropertyPersistenceInfo instance.

◆ UnRegExByName()

PropertyPersistenceInfo::Pointer mitk::PropertyPersistenceInfo::UnRegExByName ( const std::string &  propertyName) const

Create a non-regex info by resolving the regex against a property name.

If this info is a regex, generates a concrete PropertyPersistenceInfo by applying the name to the key template. If not a regex, returns a copy.

Parameters
[in]propertyNameThe concrete property name to resolve against.
Returns
A new non-regex PropertyPersistenceInfo instance.

◆ UseRegEx() [1/2]

void mitk::PropertyPersistenceInfo::UseRegEx ( const std::string &  nameRegEx,
const std::string &  nameTemplate 
)

Set the name and key as a regular expression with a shared template.

Both name and key will use the same regex and template.

Precondition
nameRegEx must be a valid regular expression, otherwise a regex_error exception is thrown and the info object is not changed.
Parameters
[in]nameRegExRegular expression for matching property names.
[in]nameTemplateTemplate string for generating concrete names from regex groups.

◆ UseRegEx() [2/2]

void mitk::PropertyPersistenceInfo::UseRegEx ( const std::string &  nameRegEx,
const std::string &  nameTemplate,
const std::string &  keyRegEx,
const std::string  keyTemplate 
)

Set the name and key as separate regular expressions with individual templates.

Precondition
nameRegEx must be a valid regular expression, otherwise a regex_error exception is thrown and the info object is not changed.
keyRegEx must be a valid regular expression, otherwise a regex_error exception is thrown and the info object is not changed.
Parameters
[in]nameRegExRegular expression for matching property names.
[in]nameTemplateTemplate string for generating concrete names from regex groups.
[in]keyRegExRegular expression for matching persistence keys.
[in]keyTemplateTemplate string for generating concrete keys from regex groups.

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