| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkMetaDataDictionary.cxx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:42 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
DEF |
=========================================================================*/ |
| 17 |
|
#include "itkMetaDataDictionary.h" |
| 18 |
|
|
| 19 |
|
namespace itk |
| 20 |
|
{ |
| 21 |
|
|
| 22 |
|
MetaDataDictionary |
| 23 |
|
::MetaDataDictionary() |
| 24 |
|
{ |
| 25 |
|
m_Dictionary = new MetaDataDictionaryMapType; |
| 26 |
|
} |
| 27 |
|
|
| 28 |
|
MetaDataDictionary |
| 29 |
|
::~MetaDataDictionary() |
| 30 |
|
{ |
| 31 |
|
if (m_Dictionary) |
| 32 |
|
{ |
| 33 |
|
delete m_Dictionary; |
| 34 |
|
m_Dictionary = 0; |
| 35 |
|
} |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
MetaDataDictionary |
| 39 |
|
::MetaDataDictionary(const MetaDataDictionary &old) |
| 40 |
|
{ |
| 41 |
|
m_Dictionary = new MetaDataDictionaryMapType; |
| 42 |
|
*m_Dictionary = *(old.m_Dictionary); |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
void MetaDataDictionary |
| 46 |
|
::operator=(const MetaDataDictionary &old) |
| 47 |
|
{ |
| 48 |
|
*m_Dictionary = *(old.m_Dictionary); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
void |
| 52 |
|
MetaDataDictionary |
| 53 |
|
::Print(std::ostream& os) const |
| 54 |
|
{ |
| 55 |
|
for(MetaDataDictionaryMapType::const_iterator it=m_Dictionary->begin(); |
| 56 |
IND |
******it != m_Dictionary->end(); |
| 57 |
IND |
******it++) |
| 58 |
|
{ |
| 59 |
SEM |
os << it->first << " " ; |
| 60 |
|
it->second->Print(os); |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
MetaDataObjectBase::Pointer & |
| 65 |
|
MetaDataDictionary |
| 66 |
|
::operator [](const std::string &key) |
| 67 |
|
{ |
| 68 |
|
return (*m_Dictionary)[key]; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
const MetaDataObjectBase * |
| 72 |
|
MetaDataDictionary |
| 73 |
|
::operator [](const std::string &key) const |
| 74 |
|
{ |
| 75 |
|
MetaDataObjectBase::Pointer entry = (*m_Dictionary)[key]; |
| 76 |
|
const MetaDataObjectBase * constentry = entry.GetPointer(); |
| 77 |
|
return constentry; |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
bool |
| 82 |
|
MetaDataDictionary |
| 83 |
|
::HasKey(const std::string &key) |
| 84 |
|
{ |
| 85 |
|
return m_Dictionary->find(key) != m_Dictionary->end(); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
std::vector<std::string> |
| 89 |
|
MetaDataDictionary |
| 90 |
|
::GetKeys() const |
| 91 |
|
{ |
| 92 |
|
typedef std::vector<std::string> VectorType; |
| 93 |
|
VectorType ans; |
| 94 |
|
|
| 95 |
|
for (MetaDataDictionaryMapType::const_iterator it = m_Dictionary->begin(); |
| 96 |
IND |
*******it != m_Dictionary->end(); ++it) |
| 97 |
|
{ |
| 98 |
|
ans.push_back( (*it).first ); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
return ans; |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
MetaDataDictionary::Iterator |
| 105 |
|
MetaDataDictionary |
| 106 |
|
::Begin() |
| 107 |
|
{ |
| 108 |
|
return m_Dictionary->begin(); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
|
| 112 |
|
MetaDataDictionary::ConstIterator |
| 113 |
|
MetaDataDictionary |
| 114 |
|
::Begin() const |
| 115 |
|
{ |
| 116 |
|
return m_Dictionary->begin(); |
| 117 |
|
} |
| 118 |
|
|
| 119 |
|
|
| 120 |
|
MetaDataDictionary::Iterator |
| 121 |
|
MetaDataDictionary |
| 122 |
|
::End() |
| 123 |
|
{ |
| 124 |
|
return m_Dictionary->end(); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
|
| 128 |
|
MetaDataDictionary::ConstIterator |
| 129 |
|
MetaDataDictionary |
| 130 |
|
::End() const |
| 131 |
|
{ |
| 132 |
|
return m_Dictionary->end(); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
|
| 136 |
EML |
|
| 137 |
|
MetaDataDictionary::Iterator |
| 138 |
|
MetaDataDictionary |
| 139 |
|
::Find( const std::string & key) |
| 140 |
|
{ |
| 141 |
|
return m_Dictionary->find(key); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
|
| 145 |
|
MetaDataDictionary::ConstIterator |
| 146 |
|
MetaDataDictionary |
| 147 |
|
::Find(const std::string & key) const |
| 148 |
|
{ |
| 149 |
|
return m_Dictionary->find(key); |
| 150 |
|
} |
| 151 |
|
|
| 152 |
|
|
| 153 |
EML |
|
| 154 |
EML |
|
| 155 |
EML |
|
| 156 |
|
}; // namespace |
| 157 |
|
|
| 158 |
EOF |
|