ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkMetaDataDictionary_h 00019 #define __itkMetaDataDictionary_h 00020 00021 #include "itkMetaDataObjectBase.h" 00022 #include <vector> 00023 #include <map> 00024 #include <string> 00025 00026 namespace itk 00027 { 00040 class ITKCommon_EXPORT MetaDataDictionary 00041 { 00042 public: 00043 typedef MetaDataDictionary Self; 00048 virtual void Print(std::ostream & os) const; 00049 00050 // Declare the datastructure that will be used to hold the 00051 // dictionary. 00052 class MetaDataDictionaryMapType: 00053 public std::map< std::string, MetaDataObjectBase::Pointer > 00054 {}; 00055 00056 typedef MetaDataDictionaryMapType::iterator Iterator; 00057 typedef MetaDataDictionaryMapType::const_iterator ConstIterator; 00058 00059 // Constructor 00060 MetaDataDictionary(); 00061 // Copy Constructor 00062 MetaDataDictionary(const MetaDataDictionary &); 00063 // operator = 00064 void operator=(const MetaDataDictionary &); 00065 00066 // Destructor 00067 virtual ~MetaDataDictionary(); 00068 00072 std::vector< std::string > GetKeys() const; 00073 00074 // Implement map's api. On some Micorsoft compilers, stl containers 00075 // cannot be exported. This causes problems when building DLL's. 00076 // Here we inherit privately from std::map and provide a simple 00077 // API. The implementation will be in the DLL. 00078 MetaDataObjectBase::Pointer & operator[](const std::string &); 00079 00080 const MetaDataObjectBase * operator[](const std::string &) const; 00081 00082 const MetaDataObjectBase * Get(const std::string &) const; 00083 void Set(const std::string &, MetaDataObjectBase * ); 00084 bool HasKey(const std::string &) const; 00085 00091 #if !defined( CABLE_CONFIGURATION ) 00092 Iterator Begin(); 00093 00094 ConstIterator Begin() const; 00095 00096 #endif 00097 00099 #if !defined( CABLE_CONFIGURATION ) 00100 Iterator End(); 00101 00102 ConstIterator End() const; 00103 00104 #endif 00105 00107 #if !defined( CABLE_CONFIGURATION ) 00108 Iterator Find(const std::string & key); 00109 00110 ConstIterator Find(const std::string & key) const; 00111 00112 #endif 00113 private: 00114 MetaDataDictionaryMapType *m_Dictionary; 00115 }; 00116 } 00117 #endif // __itkMetaDataDictionary_h 00118