gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gtool_history_internal::copy_attrs Interface Reference

Public Member Functions

subroutine copy_attrs (from, to, err)
 

Detailed Description

Definition at line 76 of file gtool_history_internal.f90.

Constructor & Destructor Documentation

◆ copy_attrs()

subroutine gtool_history_internal::copy_attrs::copy_attrs ( type(gt_history_attr), dimension(:), intent(in)  from,
type(gt_history_attr), dimension(:), intent(out)  to,
logical, intent(out), optional  err 
)

Definition at line 178 of file gtool_history_internal.f90.

179 !
180 ! GT_HISTORY_ATTR 変数をコピーするためのサブルーチン
181 ! このモジュール内部で利用されることを想定している.
182 ! from と to の配列サイズは同じであることが想定されている.
183 ! err を与えると, コピーの際何らかの不具合が生じると
184 ! 終了せずに err が真になって返る.
185 !
186 use dc_string,only: lchar, strhead
188 use dc_error, only: storeerror, &
190 use dc_types, only: string
192 implicit none
193 type(GT_HISTORY_ATTR), intent(in) :: from(:)
194 type(GT_HISTORY_ATTR), intent(out) :: to(:)
195 logical, intent(out), optional :: err
196 integer :: i, stat
197 character(STRING) :: cause_c
198 character(STRING), parameter:: subname = "copy_attrs"
199 continue
200 call beginsub(subname)
201 stat = dc_noerr
202 cause_c = ''
203 call dbgmessage('size(from)=<%d>, size(to)=<%d>, So copy <%d> times.', &
204 & i=(/ size(from), size(to), min(size(from),size(to)) /) )
205 if ( size(to) < size(from) ) then
207 cause_c = 'from is larger than to'
208 goto 999
209 end if
210 ! from と to の小さい方に合わせてループ
211 do i = 1, min( size(from), size(to) )
212 ! attrname と attrtype と array はまずコピー
213 to(i)%attrname = from(i)%attrname
214 to(i)%attrtype = from(i)%attrtype
215 to(i)%array = from(i)%array
216 ! from(i)%attrtype の種別でコピーする変数を変える.
217 if ( strhead( 'char', trim(lchar(from(i)%attrtype))) ) then
218 to(i)%Charvalue = from(i)%Charvalue
219 elseif ( strhead( &
220 & lchar('Int'), trim(lchar(from(i)%attrtype)))) then
221 if ( from(i)%array ) then
222 allocate( to(i)%Intarray( size(from(i)%Intarray) ) )
223 to(i)%Intarray = from(i)%Intarray
224 else
225 to(i)%Intvalue = from(i)%Intvalue
226 endif
227 elseif ( strhead( &
228 & lchar('Real'), trim(lchar(from(i)%attrtype)))) then
229 if ( from(i)%array ) then
230 allocate( to(i)%Realarray( size(from(i)%Realarray) ) )
231 to(i)%Realarray = from(i)%Realarray
232 else
233 to(i)%Realvalue = from(i)%Realvalue
234 endif
235 elseif ( strhead( &
236 & lchar('Double'), trim(lchar(from(i)%attrtype)))) then
237 if ( from(i)%array ) then
238 allocate( to(i)%Doublearray( size(from(i)%Doublearray) ) )
239 to(i)%Doublearray = from(i)%Doublearray
240 else
241 to(i)%Doublevalue = from(i)%Doublevalue
242 endif
243 elseif ( strhead( 'logical', trim(lchar(from(i)%attrtype))) ) then
244 to(i)%Logicalvalue = from(i)%Logicalvalue
245 else
246 stat = gt_ebadattrname
247 cause_c = from(i)%attrtype
248 goto 999
249 endif
250 enddo
251999 continue
252 call storeerror(stat, subname, err, cause_c=cause_c)
253 call endsub(subname)
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
integer, parameter, public gt_eargsizemismatch
Definition dc_error.f90:515
integer, parameter, public gt_ebadattrname
Definition dc_error.f90:521
文字型変数の操作
Definition dc_string.f90:83
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_noerr, dc_trace::endsub(), dc_error::gt_eargsizemismatch, dc_error::gt_ebadattrname, dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: