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.
 
 
 
 
 
 

44 lines
1.2 KiB

  1. module CIntegerEventHandler
  2. use CIActionReference
  3. implicit none
  4. public
  5. type :: IntegerEventHandler
  6. procedure(ActionInteger), 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 IntegerEventHandler
  13. contains
  14. subroutine AssignTo(this, proc)
  15. implicit none
  16. class(IntegerEventHandler), intent(inout) :: this
  17. procedure (ActionInteger), pointer, intent(in) :: proc
  18. this%Delegate => proc
  19. end subroutine
  20. subroutine MakeNull(this)
  21. implicit none
  22. class(IntegerEventHandler), intent(inout) :: this
  23. this%Delegate => null()
  24. end subroutine
  25. logical function IsNull(this)
  26. implicit none
  27. class(IntegerEventHandler), intent(in) :: this
  28. IsNull = .not.associated(this%Delegate)
  29. end function
  30. subroutine Run(this, arg)
  31. implicit none
  32. class(IntegerEventHandler), intent(inout) :: this
  33. integer, intent(in) :: arg
  34. !if(.not.this%IsNull())
  35. call this%Delegate(arg)
  36. end subroutine
  37. end module CIntegerEventHandler