freRegistrationEvents.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: freRegistrationEvents.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 __freRegistrationEvents_h
00023 #define __freRegistrationEvents_h
00024 
00025 #include "freEvents.h"
00026 #include "freStatistics.h"
00027 
00028 namespace FREE
00029 {
00038 class IterationEventBase: public NotificationEventBase
00039 {
00040 public:
00041   typedef void (*NextIterationEvent)(const long& IterationStep, Statistics* pStatistic, void* pSender, long threadID);
00042 
00043          typedef itk::SmartPointer<IterationEventBase> Pointer;
00044 
00045          freNewEventBaseMacro(IterationEventBase,NextIterationEvent);
00046          itkTypeMacro(IterationEventBase,NotificationEventBase);
00047 
00048 private:
00049    NextIterationEvent m_IterationEvent;
00050 
00051 protected:
00052   IterationEventBase();
00053   IterationEventBase(NextIterationEvent pNIE);
00054 
00055 public:
00064   virtual void Execute(const long IterationStep, Statistics* pStatistic, void* pSender, long threadID = 0);
00065 };
00066 
00076 class LevelEventBase: public NotificationEventBase
00077 {
00078 public:
00079   typedef void (*NextLevelEvent)(const unsigned int iID, void* pSender, long threadID);
00080 
00081   typedef itk::SmartPointer<LevelEventBase> Pointer;
00082 
00083         freNewEventBaseMacro(LevelEventBase,NextLevelEvent);
00084         itkTypeMacro(LevelEventBase,NotificationEventBase);
00085 
00086 private:
00087    NextLevelEvent m_LevelEvent;
00088 
00089 protected:
00090   LevelEventBase(); 
00091   LevelEventBase(NextLevelEvent pNLE);
00092   
00093 public:
00102   virtual void Execute(const unsigned int iID, void* pSender, long threadID = 0);
00103 };
00104 
00119 template <typename T>
00120 class IterationEvent : public IterationEventBase
00121 {
00122 public:
00123   typedef void (T::*NextIterationEvent)(const long lIteration, Statistics* pStatistic, void* pSender, long threadID);
00124 
00125   typedef itk::SmartPointer<IterationEvent<T> > Pointer;
00126 
00127   freNewEventMacro(IterationEvent, T, NextIterationEvent);
00128         itkTypeMacro(IterationEvent,IterationEventBase);
00129 
00130 private:
00131    T* m_Object;
00132    NextIterationEvent m_IterationEvent;
00133 
00134 protected:
00135    IterationEvent(T* pObject, NextIterationEvent pNIE)
00136    {
00137          m_Object = pObject;
00138          m_IterationEvent = pNIE;
00139    };
00140    
00141 public:
00152   virtual void Execute(const long lIteration, Statistics* pStatistic, void* pSender, long threadID = 0)
00153    { (m_Object->*m_IterationEvent)(lIteration, pStatistic, pSender, threadID); };
00154 };
00155 
00170 template <typename T>
00171 class LevelEvent : public LevelEventBase
00172 {
00173 public:
00174   typedef void (T::*NextLevelEvent)(const unsigned int iID, void* pSender, long threadID);
00175 
00176   typedef itk::SmartPointer<LevelEvent<T> > Pointer;
00177 
00178   freNewEventMacro(LevelEvent, T, NextLevelEvent);
00179         itkTypeMacro(LevelEvent,LevelEventBase);
00180 
00181 private:
00182    T* m_Object;
00183    NextLevelEvent m_LevelEvent;
00184 
00185 protected:
00186    LevelEvent(T* pObject, NextLevelEvent pNLE)
00187        : m_Object(pObject), m_LevelEvent(pNLE)
00188    {};
00189 
00190 public:
00191    
00200   virtual void Execute(const unsigned int iID, void* pSender, long threadID = 0)
00201   { (m_Object->*m_LevelEvent)(iID, pSender, threadID); };
00202 };
00203 
00212 class RegistrationProgressEventBase: public NotificationEventBase
00213 {
00214 public:
00215    typedef void (*ProgEvent)(const RegistrationStatusType status,
00216                                                                        const std::string  sComment,
00217                              void* pSender,
00218                              long threadID);
00219 
00220   typedef itk::SmartPointer<RegistrationProgressEventBase> Pointer;
00221 
00222         freNewEventBaseMacro(RegistrationProgressEventBase,ProgEvent);
00223         itkTypeMacro(RegistrationProgressEventBase,NotificationEventBase);
00224 
00225 private:
00226    ProgEvent m_ProgressEvent;
00227 
00228 protected:
00229    RegistrationProgressEventBase();
00230    RegistrationProgressEventBase(ProgEvent pPE);
00231 
00232 public:
00242    virtual void Execute(const RegistrationStatusType status,
00243                                                                                                 const std::string  sComment,
00244                         void* pSender,
00245                         long threadID = 0);
00246 };
00247 
00262 template <typename T>
00263 class RegistrationProgressEvent: public RegistrationProgressEventBase
00264 {
00265 public:
00266    typedef void (T::*ProgEvent)(const RegistrationStatusType status,
00267                                                                                 const std::string  sComment,
00268                                 void* pSender,
00269                                 long threadID);
00270 
00271   typedef itk::SmartPointer<RegistrationProgressEvent<T> > Pointer;
00272 
00273   freNewEventMacro(RegistrationProgressEvent, T, ProgEvent);
00274         itkTypeMacro(RegistrationProgressEvent,RegistrationProgressEventBase);
00275 
00276 private:
00277    T* m_Object;
00278    ProgEvent m_ProgressEvent;
00279 
00280 protected:
00281    RegistrationProgressEvent(T* pObject, ProgEvent pPE)
00282    {
00283           m_Object = pObject;
00284           m_ProgressEvent = pPE;
00285    };
00286    
00287 public:
00297    virtual void Execute(const RegistrationStatusType status,
00298                                                             const std::string  sComment,
00299                         void* pSender,
00300                         long threadID = 0)
00301    { (m_Object->*m_ProgressEvent)(status, sComment, pSender, threadID); };
00302 };
00303 
00304 } //end of namespace free
00305 #endif

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