00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef MITK_NON_BLOCKING_ALGORHITHMS_ENVETS_H_INCLDUED 00019 #define MITK_NON_BLOCKING_ALGORHITHMS_ENVETS_H_INCLDUED 00020 00021 #include <itkEventObject.h> 00022 #include "MitkExtExports.h" 00023 00024 namespace mitk { 00025 00026 class NonBlockingAlgorithm; 00027 00028 class MitkExt_EXPORT NonBlockingAlgorithmEvent : public itk::AnyEvent 00029 { 00030 public: 00031 typedef NonBlockingAlgorithmEvent Self; 00032 typedef itk::AnyEvent Superclass; 00033 00034 NonBlockingAlgorithmEvent( const NonBlockingAlgorithm* algorithm = NULL ) 00035 : m_Algorithm(algorithm) {} 00036 00037 virtual ~NonBlockingAlgorithmEvent() {} 00038 00039 virtual const char * GetEventName() const 00040 { 00041 return "NonBlockingAlgorithmEvent"; 00042 } 00043 00044 virtual bool CheckEvent(const ::itk::EventObject* e) const 00045 { 00046 return dynamic_cast<const Self*>(e); 00047 } 00048 00049 virtual ::itk::EventObject* MakeObject() const 00050 { 00051 return new Self( m_Algorithm ); 00052 } 00053 00054 const mitk::NonBlockingAlgorithm* GetAlgorithm() const 00055 { 00056 return m_Algorithm.GetPointer(); 00057 } 00058 00059 NonBlockingAlgorithmEvent(const Self& s) : itk::AnyEvent(s), m_Algorithm(s.m_Algorithm) {}; 00060 00061 protected: 00062 mitk::NonBlockingAlgorithm::ConstPointer m_Algorithm; 00063 00064 private: 00065 void operator=(const Self&); 00066 00067 }; 00068 00069 00070 class MitkExt_EXPORT ResultAvailable : public NonBlockingAlgorithmEvent 00071 { 00072 public: 00073 00074 ResultAvailable( const NonBlockingAlgorithm* algorithm = NULL ) 00075 : NonBlockingAlgorithmEvent(algorithm) 00076 { 00077 } 00078 00079 virtual ~ResultAvailable() 00080 { 00081 } 00082 }; 00083 00084 class MitkExt_EXPORT ProcessingError : public NonBlockingAlgorithmEvent 00085 { 00086 public: 00087 00088 ProcessingError( const NonBlockingAlgorithm* algorithm = NULL ) 00089 : NonBlockingAlgorithmEvent(algorithm) 00090 { 00091 } 00092 00093 virtual ~ProcessingError() 00094 { 00095 } 00096 }; 00097 00098 00099 00100 } 00101 00102 #endif 00103 00104