ITK  6.0.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
itk::MetaDataObject< MetaDataObjectType > Class Template Reference

#include <itkMetaDataObject.h>

Detailed Description

template<typename MetaDataObjectType>
class itk::MetaDataObject< MetaDataObjectType >

Allows arbitrary data types to be stored as MetaDataObjectBase types, and to be stored in a MetaDataDictionary.

Author
Hans J. Johnson

The MetaDataObject class is a templated class that is a specialization of the MetaDataObjectBase type. This class allows arbitrary data types to be stored as MetaDataObjectBase types, and to be stored in a MetaDataDictionary.

Any class or built in type that has valid copy constructor and operator= can be wrapped directly with this simple template type.

Classes or built in types that do not have valid copy constructors or operator= implemented will have to implement those functions by deriving from MetaDataObject<MetaDataObjectType> and redefining the copy constructor and initializing constructor and the Get/Set functions to work around those deficiencies.

The default implementation prints uses the MetaDataObjectType's Print or operator<< if available. Otherwise, it prints string "[UNKNOWN PRINT CHARACTERISTICS]".

Examples
Examples/IO/DicomImageReadPrintTags.cxx, Examples/IO/DicomSeriesReadPrintTags.cxx, SphinxExamples/src/IO/GDCM/ReadAndPrintDICOMTags/Code.cxx, and SphinxExamples/src/IO/GDCM/ResampleDICOMSeries/Code.cxx.

Definition at line 68 of file itkMetaDataObject.h.

+ Inheritance diagram for itk::MetaDataObject< MetaDataObjectType >:
+ Collaboration diagram for itk::MetaDataObject< MetaDataObjectType >:

Public Types

using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = MetaDataObject
 
using Superclass = MetaDataObjectBase
 
- Public Types inherited from itk::MetaDataObjectBase
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = MetaDataObjectBase
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

const std::type_info & GetMetaDataObjectTypeInfo () const override
 
const char * GetMetaDataObjectTypeName () const override
 
const MetaDataObjectType & GetMetaDataObjectValue () const
 
const char * GetNameOfClass () const override
 
void Print (std::ostream &os) const override
 
void SetMetaDataObjectValue (const MetaDataObjectType &newValue)
 
- Public Member Functions inherited from itk::MetaDataObjectBase
const char * GetNameOfClass () const override
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual Pointer CreateAnother () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 
virtual void Register () const
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const noexcept
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

 MetaDataObject ()=default
 
 ~MetaDataObject () override=default
 
- Protected Member Functions inherited from itk::MetaDataObjectBase
 MetaDataObjectBase ()
 
 ~MetaDataObjectBase () override
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintSelf (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Member Functions

bool Equal (const MetaDataObjectBase &metaDataObjectBase) const override
 

Static Private Member Functions

template<typename TValue >
static auto Assign (TValue &target, const TValue &source) -> decltype(target=source)
 
template<typename TValue >
static auto EqualValues (const TValue &lhs, const TValue &rhs) -> decltype(lhs==rhs)
 
template<typename TValue , vcl_size_t VNumberOfElements>
static void Assign (TValue(&target)[VNumberOfElements], const TValue(&source)[VNumberOfElements])
 
template<typename TValue , vcl_size_t VNumberOfElements>
static bool EqualValues (const TValue(&lhs)[VNumberOfElements], const TValue(&rhs)[VNumberOfElements])
 

Private Attributes

MetaDataObjectType m_MetaDataObjectValue {}
 

Friends

bool operator!= (const Self &lhs, const Self &rhs)
 
bool operator== (const Self &lhs, const Self &rhs)
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}
 

Member Typedef Documentation

◆ ConstPointer

template<typename MetaDataObjectType>
using itk::MetaDataObject< MetaDataObjectType >::ConstPointer = SmartPointer<const Self>

Definition at line 77 of file itkMetaDataObject.h.

◆ Pointer

template<typename MetaDataObjectType>
using itk::MetaDataObject< MetaDataObjectType >::Pointer = SmartPointer<Self>

Definition at line 76 of file itkMetaDataObject.h.

◆ Self

template<typename MetaDataObjectType>
using itk::MetaDataObject< MetaDataObjectType >::Self = MetaDataObject

Smart pointer type alias support

Definition at line 74 of file itkMetaDataObject.h.

◆ Superclass

template<typename MetaDataObjectType>
using itk::MetaDataObject< MetaDataObjectType >::Superclass = MetaDataObjectBase

Definition at line 75 of file itkMetaDataObject.h.

Constructor & Destructor Documentation

◆ MetaDataObject()

template<typename MetaDataObjectType>
itk::MetaDataObject< MetaDataObjectType >::MetaDataObject ( )
protecteddefault

◆ ~MetaDataObject()

template<typename MetaDataObjectType>
itk::MetaDataObject< MetaDataObjectType >::~MetaDataObject ( )
overrideprotecteddefault

Member Function Documentation

◆ Assign() [1/2]

template<typename MetaDataObjectType>
template<typename TValue >
static auto itk::MetaDataObject< MetaDataObjectType >::Assign ( TValue &  target,
const TValue &  source 
) -> decltype(target = source)
inlinestaticprivate

Assigns the value of source to target.

Note
The trailing return type is there, just to enable SFINAE.

Definition at line 149 of file itkMetaDataObject.h.

◆ Assign() [2/2]

template<typename MetaDataObjectType>
template<typename TValue , vcl_size_t VNumberOfElements>
static void itk::MetaDataObject< MetaDataObjectType >::Assign ( TValue(&)  target[VNumberOfElements],
const TValue(&)  source[VNumberOfElements] 
)
inlinestaticprivate

Assign overload for C-style arrays (as well as arrays of arrays).

Definition at line 157 of file itkMetaDataObject.h.

◆ Equal()

template<typename MetaDataObjectType>
bool itk::MetaDataObject< MetaDataObjectType >::Equal ( const MetaDataObjectBase metaDataObjectBase) const
inlineoverrideprivatevirtual

Internal helper function used to implement operator== for MetaDataObjectBase.

Implements itk::MetaDataObjectBase.

Definition at line 195 of file itkMetaDataObject.h.

◆ EqualValues() [1/2]

template<typename MetaDataObjectType>
template<typename TValue >
static auto itk::MetaDataObject< MetaDataObjectType >::EqualValues ( const TValue &  lhs,
const TValue &  rhs 
) -> decltype(lhs == rhs)
inlinestaticprivate

Tells whether the specified arguments compare equal.

Note
The trailing return type is there, just to enable SFINAE.

Definition at line 171 of file itkMetaDataObject.h.

◆ EqualValues() [2/2]

template<typename MetaDataObjectType>
template<typename TValue , vcl_size_t VNumberOfElements>
static bool itk::MetaDataObject< MetaDataObjectType >::EqualValues ( const TValue(&)  lhs[VNumberOfElements],
const TValue(&)  rhs[VNumberOfElements] 
)
inlinestaticprivate

EqualValues overload for C-style arrays (as well as arrays of arrays).

Definition at line 179 of file itkMetaDataObject.h.

◆ GetMetaDataObjectTypeInfo()

template<typename MetaDataObjectType>
const std::type_info& itk::MetaDataObject< MetaDataObjectType >::GetMetaDataObjectTypeInfo ( ) const
overridevirtual

The definition of this function is necessary to fulfill the interface of the MetaDataObjectBase

Author
Hans J. Johnson
Returns
A constant reference to a std::type_info object

Reimplemented from itk::MetaDataObjectBase.

◆ GetMetaDataObjectTypeName()

template<typename MetaDataObjectType>
const char* itk::MetaDataObject< MetaDataObjectType >::GetMetaDataObjectTypeName ( ) const
overridevirtual

The definition of this function is necessary to fulfill the interface of the MetaDataObjectBase

Author
Hans J. Johnson
Returns
A pointer to a const char array containing the unique type name.

Reimplemented from itk::MetaDataObjectBase.

◆ GetMetaDataObjectValue()

template<typename MetaDataObjectType>
const MetaDataObjectType& itk::MetaDataObject< MetaDataObjectType >::GetMetaDataObjectValue ( ) const

Function to return the stored value of type MetaDataObjectType.

Author
Hans J. Johnson
Returns
a constant reference to a MetaDataObjectType

Referenced by itk::ExposeMetaData().

◆ GetNameOfClass()

template<typename MetaDataObjectType>
const char* itk::MetaDataObject< MetaDataObjectType >::GetNameOfClass ( ) const
overridevirtual
See also
LightObject::GetNameOfClass()

Reimplemented from itk::LightObject.

◆ New()

template<typename MetaDataObjectType>
static Pointer itk::MetaDataObject< MetaDataObjectType >::New ( )
static

Method for creation through the object factory.

Referenced by itk::EncapsulateMetaData().

◆ Print()

template<typename MetaDataObjectType>
void itk::MetaDataObject< MetaDataObjectType >::Print ( std::ostream &  os) const
overridevirtual

Defines the default behavior for printing out this element

Parameters
osAn output stream

Reimplemented from itk::MetaDataObjectBase.

◆ SetMetaDataObjectValue()

template<typename MetaDataObjectType>
void itk::MetaDataObject< MetaDataObjectType >::SetMetaDataObjectValue ( const MetaDataObjectType &  newValue)

Function to set the stored value of type MetaDataObjectType.

Author
Hans J. Johnson
Parameters
newValueA constant reference to at MetaDataObjectType.

Friends And Related Function Documentation

◆ operator!=

template<typename MetaDataObjectType>
bool operator!= ( const Self lhs,
const Self rhs 
)
friend

Returns (metaDataObject1 != metaDataObject2).

Definition at line 135 of file itkMetaDataObject.h.

◆ operator==

template<typename MetaDataObjectType>
bool operator== ( const Self lhs,
const Self rhs 
)
friend

Returns (metaDataObject1 == metaDataObject2).

Definition at line 128 of file itkMetaDataObject.h.

Member Data Documentation

◆ m_MetaDataObjectValue

template<typename MetaDataObjectType>
MetaDataObjectType itk::MetaDataObject< MetaDataObjectType >::m_MetaDataObjectValue {}
private

A variable to store this derived type.

Author
Hans J. Johnson

Definition at line 206 of file itkMetaDataObject.h.


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