#ifndef __FPA__BASE__EVENTS__H__ #define __FPA__BASE__EVENTS__H__ #include #include // ------------------------------------------------------------------------- #define fpa_Base_NewEvent( name ) \ class name \ : public BaseEvent \ { \ public: \ name( ) : BaseEvent( ) { } \ virtual ~name( ) { } \ const char* GetEventName( ) const \ { return( "fpa::Base::##name" ); } \ bool CheckEvent( const itk::EventObject* e ) const \ { return( dynamic_cast< const name* >( e ) != NULL ); } \ itk::EventObject* MakeObject( ) const \ { return( new name( ) ); } \ }; // ------------------------------------------------------------------------- #define fpa_Base_NewEventWithVertex( name, type ) \ class name \ : public BaseEventWithVertex< type > \ { \ public: \ name( ) : BaseEventWithVertex< type >( ) { } \ name( const type& v, long fid ) \ : BaseEventWithVertex< type >( v, fid ) { } \ virtual ~name( ) { } \ const char* GetEventName( ) const \ { return( "fpa::Base::##name" ); } \ bool CheckEvent( const itk::EventObject* e ) const \ { return( dynamic_cast< const name* >( e ) != NULL ); } \ itk::EventObject* MakeObject( ) const \ { return( new name( ) ); } \ }; namespace fpa { namespace Base { /** */ class BaseEvent : public itk::AnyEvent { public: BaseEvent( ) : itk::AnyEvent( ) { } virtual ~BaseEvent( ) { } const char* GetEventName( ) const { return( "fpa::Base::BaseEvent" ); } bool CheckEvent( const itk::EventObject* e ) const { return( dynamic_cast< const BaseEvent* >( e ) != NULL ); } itk::EventObject* MakeObject( ) const { return( new BaseEvent( ) ); } }; /** */ template< class V > class BaseEventWithVertex : public BaseEvent { public: BaseEventWithVertex( ) : BaseEvent( ) { } BaseEventWithVertex( const V& v, long fid ) : BaseEvent( ), Vertex( v ), FrontId( fid ) { } virtual ~BaseEventWithVertex( ) { } const char* GetEventName( ) const { return( "fpa::Base::BaseEventWithVertex" ); } bool CheckEvent( const itk::EventObject* e ) const { return( dynamic_cast< const BaseEventWithVertex< V >* >( e ) != NULL ); } itk::EventObject* MakeObject( ) const { return( new BaseEventWithVertex< V >( ) ); } public: V Vertex; long FrontId; }; } // ecapseman } // ecapseman #endif // __FPA__BASE__EVENTS__H__ // eof - $RCSfile$