Add a feature instance to the manager, transferring ownership.
The f argument is moved into internal storage using move_alloc.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(feature_manager_t), | intent(inout) | :: | self | |||
| class(watch_feature_t), | intent(inout), | allocatable | :: | f |
subroutine fm_add(self, f) class(feature_manager_t), intent(inout) :: self class(watch_feature_t), allocatable, intent(inout) :: f type(feature_box_t), allocatable :: tmp(:) integer :: n, i if (.not. allocated(self%feat)) then allocate(self%feat(1)) call move_alloc(f, self%feat(1)%p) return end if n = size(self%feat) allocate(tmp(n+1)) do i = 1, n call move_alloc(self%feat(i)%p, tmp(i)%p) end do call move_alloc(f, tmp(n+1)%p) call move_alloc(tmp, self%feat) end subroutine fm_add