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.3 KiB

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