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.

COperationConditionEnumVariables.f90 2.3 KiB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. module COperationConditionEnumVariables
  2. use CIntegerEventHandlerCollection
  3. use CVoidEventHandlerCollection
  4. implicit none
  5. integer :: OperationCondition = 0
  6. public
  7. type(VoidEventHandlerCollection) :: OnOperationConditionChange
  8. type(IntegerEventHandlerCollection) :: OnOperationConditionChangeInt
  9. enum, bind(c)
  10. enumerator OPERATION_DRILL
  11. enumerator OPERATION_TRIP
  12. end enum
  13. private :: OperationCondition
  14. contains
  15. subroutine Set_OperationCondition(v)
  16. use CKellyEnumVariables
  17. implicit none
  18. integer , intent(in) :: v
  19. #ifdef ExcludeExtraChanges
  20. if(OperationCondition == v) return
  21. #endif
  22. OperationCondition = v
  23. #ifdef deb
  24. print*, 'OperationCondition=', OperationCondition
  25. #endif
  26. call OnOperationConditionChange%RunAll()
  27. call OnOperationConditionChangeInt%RunAll(OperationCondition)
  28. end subroutine
  29. integer function Get_OperationCondition()
  30. implicit none
  31. Get_OperationCondition = OperationCondition
  32. end function
  33. subroutine Set_OperationCondition_WN(v)
  34. !DEC$ ATTRIBUTES DLLEXPORT :: Set_OperationCondition_WN
  35. !DEC$ ATTRIBUTES ALIAS: 'Set_OperationCondition_WN' :: Set_OperationCondition_WN
  36. implicit none
  37. integer , intent(in) :: v
  38. call Set_OperationCondition(v)
  39. end subroutine
  40. integer function Get_OperationCondition_WN()
  41. !DEC$ ATTRIBUTES DLLEXPORT :: Get_OperationCondition_WN
  42. !DEC$ ATTRIBUTES ALIAS: 'Get_OperationCondition_WN' :: Get_OperationCondition_WN
  43. implicit none
  44. Get_OperationCondition_WN = OperationCondition
  45. end function
  46. logical function Get_DrillCondition()
  47. !DEC$ ATTRIBUTES DLLEXPORT :: Get_DrillCondition
  48. !DEC$ ATTRIBUTES ALIAS: 'Get_DrillCondition' :: Get_DrillCondition
  49. implicit none
  50. Get_DrillCondition = OperationCondition == OPERATION_DRILL
  51. end function
  52. logical function Get_TripCondition()
  53. !DEC$ ATTRIBUTES DLLEXPORT :: Get_TripCondition
  54. !DEC$ ATTRIBUTES ALIAS: 'Get_TripCondition' :: Get_TripCondition
  55. implicit none
  56. Get_TripCondition = OperationCondition == OPERATION_TRIP
  57. end function
  58. end module COperationConditionEnumVariables