ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkMetaDataDictionary.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMetaDataDictionary_h
19 #define itkMetaDataDictionary_h
20 
21 #include "itkMetaDataObjectBase.h"
22 #include <vector>
23 #include <map>
24 #include <string>
25 
26 namespace itk
27 {
40 class ITKCommon_EXPORT MetaDataDictionary
41 {
42 public:
48  virtual void Print(std::ostream & os) const;
49 
50  // Declare the datastructure that will be used to hold the
51  // dictionary.
52  typedef std::map< std::string, MetaDataObjectBase::Pointer > MetaDataDictionaryMapType;
53  typedef MetaDataDictionaryMapType::iterator Iterator;
54  typedef MetaDataDictionaryMapType::const_iterator ConstIterator;
55 
56  // Constructor
58  // Copy Constructor
60  // operator =
61  MetaDataDictionary & operator=(const MetaDataDictionary &);
62 
63  // Destructor
64  virtual ~MetaDataDictionary();
65 
69  std::vector< std::string > GetKeys() const;
70 
71  // Implement map's api. On some Micorsoft compilers, stl containers
72  // cannot be exported. This causes problems when building DLL's.
73  // Here we inherit privately from std::map and provide a simple
74  // API. The implementation will be in the DLL.
75  MetaDataObjectBase::Pointer & operator[](const std::string &);
76 
77  const MetaDataObjectBase * operator[](const std::string &) const;
78 
79  const MetaDataObjectBase * Get(const std::string &) const;
80  void Set(const std::string &, MetaDataObjectBase * );
81  bool HasKey(const std::string &) const;
82 
83  bool Erase(const std::string&);
84 
90 #if !defined( CABLE_CONFIGURATION )
91  Iterator Begin();
92 
93  ConstIterator Begin() const;
94 
95 #endif
96 
98 #if !defined( CABLE_CONFIGURATION )
99  Iterator End();
100 
101  ConstIterator End() const;
102 
103 #endif
104 
106 #if !defined( CABLE_CONFIGURATION )
107  Iterator Find(const std::string & key);
108 
109  ConstIterator Find(const std::string & key) const;
110 
111 #endif
112 
113  void Clear();
114 
115 private:
117 };
118 }
119 #endif // itkMetaDataDictionary_h
MetaDataDictionaryMapType::const_iterator ConstIterator
Provides a mechanism for storing a collection of arbitrary data types.
std::map< std::string, MetaDataObjectBase::Pointer > MetaDataDictionaryMapType
MetaDataDictionaryMapType::iterator Iterator
MetaDataDictionaryMapType * m_Dictionary
The common interface for MetaDataObject&#39;s.