ITK  4.4.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.
53  public std::map< std::string, MetaDataObjectBase::Pointer >
54  {};
55 
56  typedef MetaDataDictionaryMapType::iterator Iterator;
57  typedef MetaDataDictionaryMapType::const_iterator ConstIterator;
58 
59  // Constructor
61  // Copy Constructor
63  // operator =
64  MetaDataDictionary & operator=(const MetaDataDictionary &);
65 
66  // Destructor
67  virtual ~MetaDataDictionary();
68 
72  std::vector< std::string > GetKeys() const;
73 
74  // Implement map's api. On some Micorsoft compilers, stl containers
75  // cannot be exported. This causes problems when building DLL's.
76  // Here we inherit privately from std::map and provide a simple
77  // API. The implementation will be in the DLL.
78  MetaDataObjectBase::Pointer & operator[](const std::string &);
79 
80  const MetaDataObjectBase * operator[](const std::string &) const;
81 
82  const MetaDataObjectBase * Get(const std::string &) const;
83  void Set(const std::string &, MetaDataObjectBase * );
84  bool HasKey(const std::string &) const;
85 
91 #if !defined( CABLE_CONFIGURATION )
92  Iterator Begin();
93 
94  ConstIterator Begin() const;
95 
96 #endif
97 
99 #if !defined( CABLE_CONFIGURATION )
100  Iterator End();
101 
102  ConstIterator End() const;
103 
104 #endif
105 
107 #if !defined( CABLE_CONFIGURATION )
108  Iterator Find(const std::string & key);
109 
110  ConstIterator Find(const std::string & key) const;
111 
112 #endif
113 
114  void Clear();
115 
116 private:
118 };
119 }
120 #endif // __itkMetaDataDictionary_h
121