set_libraries Subroutine

private pure elemental subroutine set_libraries(this, id, version)

Type Bound

options

Arguments

Type IntentOptional Attributes Name
class(options), intent(inout) :: this
character(len=*), intent(in) :: id
character(len=*), intent(in) :: version

Contents

Source Code


Source Code

   elemental pure subroutine set_libraries(this, id, version)
      class(options), intent(inout) :: this
      character(len=*), intent(in)  :: id
      character(len=*), intent(in)  :: version
      type(libraries), allocatable      :: tmp(:)

      if (.not. allocated(this%libraries)) then
         allocate(this%libraries(1))
         this%libraries(1)%id_version(1) = trim(id)
         this%libraries(1)%id_version(2) = trim(version)
      else
         call move_alloc(this%libraries, tmp)
         allocate(this%libraries(size(tmp)+1))
         this%libraries(1:size(tmp)) = tmp
         this%libraries(size(tmp)+1)%id_version(1) = trim(id)
         this%libraries(size(tmp)+1)%id_version(2) = trim(version)
      end if
   end subroutine set_libraries