freCollectionBase.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: freCollectionBase.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 
00023 #ifndef __freCollectionBase_h
00024 #define __freCollectionBase_h
00025 
00026 #include "freElementals.h"
00027 #include "freExceptions.h"
00028 
00029 namespace FREE
00030 {
00031 
00040 template <class TElement, class TStorageType = TElement*>
00041 class CollectionBase
00042 {
00043 public:
00044   typedef TElement ElementType;
00045   typedef TStorageType StorageType;
00046   typedef std::vector<StorageType> ElementVectorType;
00047   typedef typename ElementVectorType::size_type ElementsCountType;
00048 
00049   static const ElementsCountType NULL_Index = -1;  
00050 
00051   virtual const char *GetNameOfClass() const
00052         {return "CollectionBase";};
00053 
00055   CollectionBase()
00056   {};
00057 
00059   CollectionBase( const CollectionBase<ElementType>& rCollection )
00060   {
00061     *this = rCollection;
00062   };
00063 
00064   virtual ~CollectionBase()
00065   {
00066     Reset();
00067   };
00068 
00070   virtual void Reset();
00071 
00074   virtual CollectionBase& operator = (const CollectionBase& rCollection);
00075 
00077   virtual CollectionBase& operator + (const CollectionBase& collection);
00078 
00083   virtual ElementType* GetElement(const ElementsCountType& index) const;
00084 
00086   ElementsCountType Size() const
00087   {
00088     return m_Elements.size();
00089   };
00090   
00094   virtual void DeleteElement(const ElementsCountType& index);
00095 
00101   virtual ElementsCountType AddElement(ElementType* pElement);
00102 
00106   virtual ElementsCountType AddElement(const ElementType& element) = 0;
00107 
00111   void AddElements(const CollectionBase& collection);
00112 
00113 protected:
00114 
00116   ElementVectorType m_Elements;
00117 };
00118 
00119 }//end of namespace FREE
00120 
00121 
00122 #ifndef ITK_MANUAL_INSTANTIATION
00123 #include "freCollectionBase.txx"
00124 #endif
00125 
00126 #endif

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