Orfeo Toolbox  3.16
itkEquivalencyTable.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkEquivalencyTable.h,v $
5  Language: C++
6  Date: $Date: 2007-12-23 17:59:28 $
7  Version: $Revision: 1.16 $
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 #ifndef __itkEquivalencyTable_h
18 #define __itkEquivalencyTable_h
19 
20 #if defined(_MSC_VER)
21 #pragma warning ( disable : 4786 )
22 #endif
23 
24 #include "itkObjectFactory.h"
25 #include "itkDataObject.h"
26 #include "itkProcessObject.h"
27 #include "itk_hash_map.h"
28 
29 namespace itk
30 {
48 {
49 public:
55  itkNewMacro(Self);
56  itkTypeMacro(EquivalencyTable, DataObject);
57 
59  typedef itk::hash_map<unsigned long, unsigned long,
61  typedef HashTableType::iterator Iterator;
62  typedef HashTableType::const_iterator ConstIterator;
64 
68  void Flatten();
69 
76  bool Add(unsigned long a, unsigned long b);
77 
85  bool AddAndFlatten(unsigned long a, unsigned long b);
86 
90  unsigned long Lookup(const unsigned long a) const
91  {
92  ConstIterator result = m_HashMap.find(a);
93  if ( result == m_HashMap.end() ) return a;
94  else return (*result).second;
95  }
96 
101  unsigned long RecursiveLookup(const unsigned long a) const;
102 
105  bool IsEntry(const unsigned long a) const
106  {
107  if ( m_HashMap.find(a) == m_HashMap.end() ) return false;
108  else return true;
109  }
110 
112  void Erase(const unsigned long a)
113  { m_HashMap.erase(a); }
114 
116  void Clear()
117  { m_HashMap.clear(); }
118 
120  bool Empty() const
121  { return m_HashMap.empty(); }
122 
124  HashTableType::size_type Size() const
125  { return m_HashMap.size(); }
126 
129  Iterator Begin() { return m_HashMap.begin(); }
130 
133  Iterator End() { return m_HashMap.end(); }
134 
136  // void PrintHashTable();
137 protected:
139  virtual ~EquivalencyTable() {}
140  EquivalencyTable(const Self&); // purposely not implemented
141  void operator=(const Self&); // purposely not implemented
142  void PrintSelf(std::ostream& os, Indent indent) const;
143 
145 };
146 
147 }// end namespace itk
148 
149 #endif

Generated at Sat Feb 2 2013 23:35:56 for Orfeo Toolbox with doxygen 1.8.1.1