freKeyedCollectionBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freKeyedCollection.h,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 #ifndef __freKeyedCollectionBase_h
00023 #define __freKeyedCollectionBase_h
00024 
00025 #include "freSmartCollectionBase.h"
00026 
00027 namespace FREE
00028 {
00029 
00036 template <class TKey, class TElement>
00037 class CollectionIdentifierBase
00038 {
00039 public:
00040   static bool KeyMatches (const TKey& rKey, const TElement& rElement) {return false;}; 
00041 };
00042 
00048 template <class TKey, class TElement, class TIdentifierClass>
00049 class KeyedCollectionBase : public SmartCollectionBase<TElement>
00050 {
00051 public:
00052   typedef TKey KeyType;
00053   typedef TIdentifierClass IdentifierType;
00054   typedef SmartCollectionBase<TElement> Superclass;
00055   
00056   typedef typename Superclass::ElementType ElementType;
00057   typedef typename Superclass::ElementVectorType ElementVectorType;
00058   typedef typename Superclass::ElementsCountType ElementsCountType;
00059 
00060   itkTypeMacro(KeyedCollectionBase,CollectionBase);
00061 
00063   KeyedCollectionBase():SmartCollectionBase<TElement>()
00064   {};
00065 
00067   KeyedCollectionBase( const KeyedCollectionBase<TKey,TElement,TIdentifierClass>& rCollection )
00068   {
00069     *this = rCollection;
00070   };
00071 
00074   KeyedCollectionBase& operator = (const KeyedCollectionBase& rCollection);
00075 
00080   ElementsCountType GetElementIndex(const KeyType& rKey) const;
00081 
00086         ElementType* GetElement(const KeyType& rKey) const;
00087   using SmartCollectionBase<TElement>::GetElement;
00088 };
00089 
00090 }//end of namespace FREE
00091 
00092 
00093 #ifndef ITK_MANUAL_INSTANTIATION
00094 #include "freKeyedCollectionBase.txx"
00095 #endif
00096 
00097 #endif

Generated at Sat Oct 13 16:25:06 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000