|
12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- module CDoubleEventHandler
- use CIActionReference
- implicit none
- public
-
- type :: DoubleEventHandler
- procedure(ActionDouble), pointer, nopass :: Delegate => null()
- contains
- procedure :: AssignTo => AssignTo
- procedure :: MakeNull => MakeNull
- procedure :: IsNull => IsNull
- procedure :: Run => Run
- end type DoubleEventHandler
-
- contains
-
- subroutine AssignTo(this, proc)
- implicit none
- class(DoubleEventHandler), intent(inout) :: this
- procedure (ActionDouble), pointer, intent(in) :: proc
- this%Delegate => proc
- end subroutine
-
- subroutine MakeNull(this)
- implicit none
- class(DoubleEventHandler), intent(inout) :: this
- this%Delegate => null()
- end subroutine
-
- logical function IsNull(this)
- implicit none
- class(DoubleEventHandler), intent(in) :: this
- IsNull = .not.associated(this%Delegate)
- end function
-
- subroutine Run(this, arg)
- implicit none
- class(DoubleEventHandler), intent(inout) :: this
- real(8), intent(in) :: arg
- if(.not.this%IsNull()) call this%Delegate(arg)
- end subroutine
-
- end module CDoubleEventHandler
|