Encapsulate Variable

Description:  Encapsulate variable creates getter and setter methods for the selected variable in the module where it is defined and changes variable's visibility to private. It also replaces all uses of that variable in all files to use getter and setter method calls.

State: Implemeted         Author: Tim Yuvashev,Jeff Overbey     Version:   Photran 5.0

Code Example:

module module1

    integer,public :: temp
    integer :: i
    real ::j

end module module1
 module module1
    integer :: temp
    private :: temp
    integer :: i
    real ::j
contains
    subroutine setTemp(value)
        implicit none
        integer, intent(in) :: value
        temp = value
    end subroutine

    integer function getTemp()
        implicit none
        getTemp = temp
    end function


end module module1

ScreenShots

            

HTML Comment Box is loading comments...