28 #ifndef itkMetaDataObject_h
29 #define itkMetaDataObject_h
67 template <
typename MetaDataObjectType>
80 itkFactorylessNewMacro(
Self);
92 GetMetaDataObjectTypeName()
const override;
100 const std::type_info &
101 GetMetaDataObjectTypeInfo()
const override;
108 const MetaDataObjectType &
109 GetMetaDataObjectValue()
const;
117 SetMetaDataObjectValue(
const MetaDataObjectType & newValue);
124 Print(std::ostream & os)
const override;
130 return Self::EqualValues(lhs.m_MetaDataObjectValue, rhs.m_MetaDataObjectValue);
137 return !(lhs == rhs);
147 template <
typename TValue>
149 Assign(TValue & target,
const TValue & source) -> decltype(target = source)
151 return target = source;
155 template <
typename TValue,
size_t VNumberOfElements>
157 Assign(TValue (&target)[VNumberOfElements],
const TValue (&source)[VNumberOfElements])
159 for (
size_t i = 0; i < VNumberOfElements; ++i)
161 Self::Assign(target[i], source[i]);
169 template <
typename TValue>
171 EqualValues(
const TValue & lhs,
const TValue & rhs) -> decltype(lhs == rhs)
177 template <
typename TValue,
size_t VNumberOfElements>
179 EqualValues(
const TValue (&lhs)[VNumberOfElements],
const TValue (&rhs)[VNumberOfElements])
181 for (
size_t i = 0; i < VNumberOfElements; ++i)
183 if (!Self::EqualValues(lhs[i], rhs[i]))
197 const auto metaDataObject = dynamic_cast<const Self *>(&metaDataObjectBase);
198 return (metaDataObject !=
nullptr) && (*
this == *metaDataObject);
206 MetaDataObjectType m_MetaDataObjectValue{};
216 template <
typename T>
221 temp->SetMetaDataObjectValue(invalue);
222 Dictionary[key] = temp;
226 template <
typename T>
242 template <
typename T>
246 auto keyIter = Dictionary.
Find(key);
247 if (keyIter == Dictionary.
End())
253 const auto *
const TempMetaDataObject =
dynamic_cast<const MetaDataObject<T> *
>(keyIter->second.GetPointer());
254 if (TempMetaDataObject ==
nullptr)
265 #ifndef ITK_MANUAL_INSTANTIATION
266 # include "itkMetaDataObject.hxx"
269 #endif // itkMetaDataObject_h
272 #ifndef ITK_TEMPLATE_EXPLICIT_MetaDataObject
281 #if defined(ITKCommon_EXPORTS)
283 # define ITKCommon_EXPORT_EXPLICIT ITK_TEMPLATE_EXPORT
286 # define ITKCommon_EXPORT_EXPLICIT ITKCommon_EXPORT
291 ITK_GCC_PRAGMA_DIAG_PUSH()
292 ITK_GCC_PRAGMA_DIAG(ignored
"-Wattributes")
320 ITK_GCC_PRAGMA_DIAG_POP()
323 #undef ITKCommon_EXPORT_EXPLICIT