\hypertarget{gtvarcopyattr_8f90}{}\section{gtdata/gtvarcopyattr.f90 File Reference}
\label{gtvarcopyattr_8f90}\index{gtdata/gtvarcopyattr.\+f90@{gtdata/gtvarcopyattr.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{gtvarcopyattr_8f90_a97952364067d4f0af511a36197c517b4}{gtvarcopyattr} (to, attrname, from, err)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{gtvarcopyattr_8f90_a97952364067d4f0af511a36197c517b4}\label{gtvarcopyattr_8f90_a97952364067d4f0af511a36197c517b4}} 
\index{gtvarcopyattr.\+f90@{gtvarcopyattr.\+f90}!gtvarcopyattr@{gtvarcopyattr}}
\index{gtvarcopyattr@{gtvarcopyattr}!gtvarcopyattr.\+f90@{gtvarcopyattr.\+f90}}
\subsubsection{\texorpdfstring{gtvarcopyattr()}{gtvarcopyattr()}}
{\footnotesize\ttfamily subroutine gtvarcopyattr (\begin{DoxyParamCaption}\item[{type(gt\+\_\+variable), intent(inout)}]{to,  }\item[{character(len = $\ast$), intent(in)}]{attrname,  }\item[{type(gt\+\_\+variable), intent(in)}]{from,  }\item[{logical, intent(out), optional}]{err }\end{DoxyParamCaption})}



Definition at line 14 of file gtvarcopyattr.\+f90.



References dc\+\_\+error\+::dc\+\_\+noerr, dc\+\_\+error\+::storeerror(), dc\+\_\+types\+::string, and gtdata\+\_\+internal\+\_\+map\+::var\+\_\+class().


\begin{DoxyCode}
14   \textcolor{comment}{!}
15   \textcolor{comment}{!== 属性のコピー}
16   \textcolor{comment}{!}
17   \textcolor{comment}{! 変数 *from* の属性 *attrname* を 変数 *to* へコピーします。}
18   \textcolor{comment}{!}
19   \textcolor{comment}{! 属性のコピー時にエラーが生じた場合、メッセージを出力}
20   \textcolor{comment}{! してプログラムは強制終了します。*err* を与えてある場合には}
21   \textcolor{comment}{! の引数に .true. が返り、プログラムは終了しません。}
22   \textcolor{comment}{!}
23   \textcolor{comment}{! *Copy\_Attr* は 2 つのサブルーチンの総称名であり、}
24   \textcolor{comment}{! 他にも一括で変数の全ての属性をコピーする方法もあります。}
25   \textcolor{comment}{! 下記のサブルーチンを参照ください。}
26   \textcolor{comment}{!}
27   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__types}{gtdata\_types}\textcolor{keywordtype}{, only}: gt\_variable
28   \textcolor{keywordtype}{use }gtdata\_generic\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__netcdf__generic_1_1get__attr}{get\_attr}, \hyperlink{interfacegtdata__netcdf__generic_1_1put__attr}{put\_attr}
29   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__internal__map}{gtdata\_internal\_map}\textcolor{keywordtype}{, only}: \hyperlink{namespacegtdata__internal__map_a86b920031832bea17e70a6bf4623c3d9}{var\_class}, vtb\_class\_netcdf
30   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__generic}{gtdata\_netcdf\_generic}\textcolor{keywordtype}{, only}: \hyperlink{interfacegtdata__netcdf__generic_1_1copy__attr}{copy\_attr}
31   \textcolor{keywordtype}{use }\hyperlink{namespacegtdata__netcdf__types}{gtdata\_netcdf\_types}\textcolor{keywordtype}{, only}: \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}
32   \textcolor{keywordtype}{use }dc\_trace\textcolor{keywordtype}{, only}: beginsub, endsub
33   \textcolor{keywordtype}{use }\hyperlink{namespacedc__error}{dc\_error}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}, \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
34   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{, only}: \hyperlink{namespacedc__types_adb76910ff05e3b9fe3436567f8f8dac6}{string}
35   \textcolor{keywordtype}{implicit none}
36   \textcolor{keywordtype}{type}(gt\_variable), \textcolor{keywordtype}{intent(inout)}:: to
37   \textcolor{keywordtype}{character(len = *)}, \textcolor{keywordtype}{intent(in)}:: attrname
38   \textcolor{keywordtype}{type}(gt\_variable), \textcolor{keywordtype}{intent(in)}:: from
39   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{optional}:: err
40   \textcolor{keywordtype}{character(STRING)}:: svalue
41   \textcolor{keywordtype}{integer}:: from\_class, from\_cid, to\_class, to\_cid, stat
42 \textcolor{keywordflow}{continue}
43   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(err)) err = .false.
44   \textcolor{keyword}{call }beginsub(\textcolor{stringliteral}{'gtvarcopyattr'}, \textcolor{stringliteral}{'mapid to=%d from=%d name=%c'}, &
45     & i=(/to%mapid, from%mapid/), c1=attrname)
46   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a86b920031832bea17e70a6bf4623c3d9}{var\_class}(from, from\_class, from\_cid)
47   \textcolor{keyword}{call }\hyperlink{namespacegtdata__internal__map_a86b920031832bea17e70a6bf4623c3d9}{var\_class}(to, to\_class, to\_cid)
48   \textcolor{keywordflow}{if} (from\_class == vtb\_class\_netcdf .and. to\_class == vtb\_class\_netcdf) \textcolor{keywordflow}{then}
49     \textcolor{keyword}{call }\hyperlink{interfacegtdata__netcdf__generic_1_1copy__attr}{copy\_attr}(\hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(to\_cid), attrname, &
50       & \hyperlink{structgtdata__netcdf__types_1_1gd__nc__variable}{gd\_nc\_variable}(from\_cid), stat)
51   \textcolor{keywordflow}{else}
52     \textcolor{comment}{! とりあえず文字列で入出力しておく}
53     \textcolor{keyword}{call }\hyperlink{interfacegtdata__netcdf__generic_1_1get__attr}{get\_attr}(from, attrname, svalue, default=\textcolor{stringliteral}{''})
54     \textcolor{keyword}{call }\hyperlink{interfacegtdata__netcdf__generic_1_1put__attr}{put\_attr}(to, attrname, svalue, \textcolor{stringliteral}{''}, err)
55     stat = \hyperlink{namespacedc__error_a64841a3c9e3ef7d5ddb175e5770f7dfe}{dc\_noerr}
56 \textcolor{keywordflow}{  endif}
57   \textcolor{keyword}{call }\hyperlink{namespacedc__error_a0104aee83ee5752b1a9f6152b11864a8}{storeerror}(stat, \textcolor{stringliteral}{"GTVarCopyAttr"}, err)
58   \textcolor{keyword}{call }endsub(\textcolor{stringliteral}{'gtvarcopyattr'}, \textcolor{stringliteral}{'stat = %d'}, i=(/stat/))
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{gtvarcopyattr_8f90_a97952364067d4f0af511a36197c517b4_cgraph}
\end{center}
\end{figure}
