Orfeo Toolbox  3.16
itkMetaDataDictionary.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkMetaDataDictionary.cxx,v $
5  Language: C++
6  Date: $Date: 2009-02-05 22:04:14 $
7  Version: $Revision: 1.18 $
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 =========================================================================*/
17 #include "itkMetaDataDictionary.h"
18 
19 namespace itk
20 {
21 
24 {
25  m_Dictionary = new MetaDataDictionaryMapType;
26 }
27 
30 {
31  if (m_Dictionary)
32  {
33  delete m_Dictionary;
34  m_Dictionary = 0;
35  }
36 }
37 
40 {
41  m_Dictionary = new MetaDataDictionaryMapType;
42  *m_Dictionary = *(old.m_Dictionary);
43 }
44 
47 {
48  *m_Dictionary = *(old.m_Dictionary);
49 }
50 
51 void
53 ::Print(std::ostream& os) const
54 {
55  for(MetaDataDictionaryMapType::const_iterator it=m_Dictionary->begin();
56  it != m_Dictionary->end();
57  it++)
58  {
59  os << (*it).first << " ";
60  (*it).second->Print(os);
61  }
62 }
63 
66 ::operator [](const std::string &key)
67 {
68  return (*m_Dictionary)[key];
69 }
70 
71 const MetaDataObjectBase *
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
83 ::HasKey(const std::string &key) const
84 {
85  return m_Dictionary->find(key) != m_Dictionary->end();
86 }
87 
88 std::vector<std::string>
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  it != m_Dictionary->end(); ++it)
97  {
98  ans.push_back( (*it).first );
99  }
100 
101  return ans;
102 }
103 
107 {
108  return m_Dictionary->begin();
109 }
110 
111 
114 ::Begin() const
115 {
116  return m_Dictionary->begin();
117 }
118 
119 
123 {
124  return m_Dictionary->end();
125 }
126 
127 
130 ::End() const
131 {
132  return m_Dictionary->end();
133 }
134 
137 ::Find( const std::string & key)
138 {
139  return m_Dictionary->find(key);
140 }
141 
142 
145 ::Find(const std::string & key) const
146 {
147  return m_Dictionary->find(key);
148 }
149 } // namespace

Generated at Sat May 18 2013 23:53:38 for Orfeo Toolbox with doxygen 1.8.3.1