Simulation Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CVoidEventHandler.f90 1.2 KiB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. module CVoidEventHandler
  2. use CIActionReference
  3. implicit none
  4. public
  5. type :: VoidEventHandler
  6. procedure(ActionVoid), pointer, nopass :: Delegate => null()
  7. contains
  8. procedure :: AssignTo => AssignTo
  9. procedure :: MakeNull => MakeNull
  10. procedure :: IsNull => IsNull
  11. procedure :: Run => Run
  12. end type VoidEventHandler
  13. contains
  14. subroutine AssignTo(this, proc)
  15. implicit none
  16. class(VoidEventHandler), intent(inout) :: this
  17. procedure (ActionVoid), pointer, intent(in) :: proc
  18. this%Delegate => proc
  19. end subroutine
  20. subroutine MakeNull(this)
  21. implicit none
  22. class(VoidEventHandler), intent(inout) :: this
  23. this%Delegate => null()
  24. end subroutine
  25. logical function IsNull(this)
  26. implicit none
  27. class(VoidEventHandler), intent(in) :: this
  28. IsNull = .not.associated(this%Delegate)
  29. end function
  30. subroutine Run(this)
  31. implicit none
  32. class(VoidEventHandler), intent(inout) :: this
  33. !if(.not.this%IsNull()) then
  34. call this%Delegate()
  35. !endif
  36. end subroutine
  37. end module CVoidEventHandler