netcdf-cxx4/ncFile_8cpp_source.html

143 lines
34 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>NetCDF-C++: ncFile.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="netcdf-50x50.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">NetCDF-C++
&#160;<span id="projectnumber">4.3.1-developer</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>NetCDF&#160;Documentation</span></a></li>
<li><a href="pages.html"><span>Navigation</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>Source&#160;Files</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('ncFile_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ncFile.cpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#include &quot;ncFile.h&quot;</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor">#include &quot;ncCheck.h&quot;</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="preprocessor">#include &quot;ncException.h&quot;</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="preprocessor">#include &quot;ncByte.h&quot;</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#include&lt;iostream&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="preprocessor">#include&lt;string&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="preprocessor">#include&lt;sstream&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespacestd.html">std</a>;</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespacenetCDF.html">netCDF</a>;</div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="keyword">using namespace </span><a class="code" href="namespacenetCDF_1_1exceptions.html">netCDF::exceptions</a>;</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="keywordtype">int</span> g_ncid = -1;</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">// destructor</span></div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="classnetCDF_1_1NcFile.html#aee1aab4ed004acc9cd682cf430079379"> 15</a></span>&#160;NcFile::~NcFile()</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;{</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160; <span class="comment">// destructor may be called due to an exception being thrown</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; <span class="comment">// hence throwing an exception from within a destructor</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <span class="comment">// causes undefined behaviour! so just printing a warning message</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keywordflow">try</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; {</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; close();</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; }</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; <span class="keywordflow">catch</span> (<a class="code" href="classnetCDF_1_1exceptions_1_1NcException.html">NcException</a> &amp;e)</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; {</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; cerr &lt;&lt; e.what() &lt;&lt; endl;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; }</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;}</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classnetCDF_1_1NcFile.html#ad5fe1f98a48fb6c310eb294913cd141a"> 30</a></span>&#160;<span class="k
<div class="ttc" id="classnetCDF_1_1NcFile_html_a9070903a9e41e718c1696866b306ed9dad22bc0629e4cd3f33e498bd3d0428fdb"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a9070903a9e41e718c1696866b306ed9dad22bc0629e4cd3f33e498bd3d0428fdb">netCDF::NcFile::write</a></div><div class="ttdoc">File exists, open for writing. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00025">ncFile.h:25</a></div></div>
<div class="ttc" id="namespacenetCDF_html"><div class="ttname"><a href="namespacenetCDF.html">netCDF</a></div><div class="ttdoc">C++ API for netCDF4. </div><div class="ttdef"><b>Definition:</b> <a href="ncAtt_8h_source.html#l00009">ncAtt.h:9</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcGroup_html_ac71ce30af2dcb4d12c83bfb59e375b96"><div class="ttname"><a href="classnetCDF_1_1NcGroup.html#ac71ce30af2dcb4d12c83bfb59e375b96">netCDF::NcGroup::nullObject</a></div><div class="ttdeci">bool nullObject</div><div class="ttdoc">assignment operator </div><div class="ttdef"><b>Definition:</b> <a href="ncGroup_8h_source.html#l00570">ncGroup.h:570</a></div></div>
<div class="ttc" id="namespacestd_html"><div class="ttname"><a href="namespacestd.html">std</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_af6c618016efd9b5661b44b6a6a5ed655"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#af6c618016efd9b5661b44b6a6a5ed655">netCDF::NcFile::FileFormat</a></div><div class="ttdeci">FileFormat</div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00030">ncFile.h:30</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a32bbfe75bb0a25977cffaa0466b41353"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a32bbfe75bb0a25977cffaa0466b41353">netCDF::NcFile::open</a></div><div class="ttdeci">void open(const std::string &amp;filePath, FileMode fMode)</div><div class="ttdoc">Opens a netCDF file. </div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_af6c618016efd9b5661b44b6a6a5ed655a7122e414d3032877a0f6a920beaa47ed"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#af6c618016efd9b5661b44b6a6a5ed655a7122e414d3032877a0f6a920beaa47ed">netCDF::NcFile::classic64</a></div><div class="ttdoc">64-bit offset format, classic data model </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00033">ncFile.h:33</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a2d5901b9285c8bead9832c3902fd74d2"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a2d5901b9285c8bead9832c3902fd74d2">netCDF::NcFile::enddef</a></div><div class="ttdeci">void enddef()</div><div class="ttdoc">Leave define mode, used for classic model. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8cpp_source.html#l00131">ncFile.cpp:131</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a0531207b6671760323bc69d721924160"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a0531207b6671760323bc69d721924160">netCDF::NcFile::NcFile</a></div><div class="ttdeci">NcFile()</div><div class="ttdoc">Constructor generates a null object. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8cpp_source.html#l00041">ncFile.cpp:41</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcGroup_html"><div class="ttname"><a href="classnetCDF_1_1NcGroup.html">netCDF::NcGroup</a></div><div class="ttdoc">Class represents a netCDF group. </div><div class="ttdef"><b>Definition:</b> <a href="ncGroup_8h_source.html#l00027">ncGroup.h:27</a></div></div>
<div class="ttc" id="namespacenetCDF_1_1exceptions_html"><div class="ttname"><a href="namespacenetCDF_1_1exceptions.html">netCDF::exceptions</a></div><div class="ttdoc">Exception classes. </div><div class="ttdef"><b>Definition:</b> <a href="ncException_8h_source.html#l00015">ncException.h:15</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a9070903a9e41e718c1696866b306ed9da174bea3cdf182bc0505208e57ffb60a2"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a9070903a9e41e718c1696866b306ed9da174bea3cdf182bc0505208e57ffb60a2">netCDF::NcFile::newFile</a></div><div class="ttdoc">Create new file, fail if already exists. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00027">ncFile.h:27</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_af6c618016efd9b5661b44b6a6a5ed655a488a49953594201a3e5278218384a703"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#af6c618016efd9b5661b44b6a6a5ed655a488a49953594201a3e5278218384a703">netCDF::NcFile::classic</a></div><div class="ttdoc">Classic format, classic data model. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00032">ncFile.h:32</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a29af63f667abf11ebf274167b47735d8"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a29af63f667abf11ebf274167b47735d8">netCDF::NcFile::sync</a></div><div class="ttdeci">void sync()</div><div class="ttdoc">Synchronize an open netcdf dataset to disk. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8cpp_source.html#l00126">ncFile.cpp:126</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_ad5fe1f98a48fb6c310eb294913cd141a"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#ad5fe1f98a48fb6c310eb294913cd141a">netCDF::NcFile::close</a></div><div class="ttdeci">void close()</div><div class="ttdoc">Close a file before destructor call. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8cpp_source.html#l00030">ncFile.cpp:30</a></div></div>
<div class="ttc" id="classnetCDF_1_1exceptions_1_1NcException_html"><div class="ttname"><a href="classnetCDF_1_1exceptions_1_1NcException.html">netCDF::exceptions::NcException</a></div><div class="ttdoc">Base object is thrown if a netCDF exception is encountered. </div><div class="ttdef"><b>Definition:</b> <a href="ncException_8h_source.html#l00024">ncException.h:24</a></div></div>
<div class="ttc" id="namespacenetCDF_html_ac90290d966f6e01dbf22fca241162e18"><div class="ttname"><a href="namespacenetCDF.html#ac90290d966f6e01dbf22fca241162e18">netCDF::ncCheck</a></div><div class="ttdeci">void ncCheck(int retCode, const char *file, int line)</div><div class="ttdoc">Function checks error code and if necessary throws an exception. </div><div class="ttdef"><b>Definition:</b> <a href="ncCheck_8cpp_source.html#l00011">ncCheck.cpp:11</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_af6c618016efd9b5661b44b6a6a5ed655aa736669e9201624e54ec7bc793bd1e2a"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#af6c618016efd9b5661b44b6a6a5ed655aa736669e9201624e54ec7bc793bd1e2a">netCDF::NcFile::nc4</a></div><div class="ttdoc">(default) netCDF-4/HDF5 format, enhanced data model </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00034">ncFile.h:34</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a9070903a9e41e718c1696866b306ed9da692b236728da0c4f4da4450062a2489a"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a9070903a9e41e718c1696866b306ed9da692b236728da0c4f4da4450062a2489a">netCDF::NcFile::read</a></div><div class="ttdoc">File exists, open read-only. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00024">ncFile.h:24</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a9070903a9e41e718c1696866b306ed9daeccfc7a6190ca5a66ba1f9616d959965"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a9070903a9e41e718c1696866b306ed9daeccfc7a6190ca5a66ba1f9616d959965">netCDF::NcFile::replace</a></div><div class="ttdoc">Create new file, even if already exists. </div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00026">ncFile.h:26</a></div></div>
<div class="ttc" id="classnetCDF_1_1NcFile_html_a9070903a9e41e718c1696866b306ed9d"><div class="ttname"><a href="classnetCDF_1_1NcFile.html#a9070903a9e41e718c1696866b306ed9d">netCDF::NcFile::FileMode</a></div><div class="ttdeci">FileMode</div><div class="ttdef"><b>Definition:</b> <a href="ncFile_8h_source.html#l00022">ncFile.h:22</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<hr size="2"/>
<address style="text-align: center;">
<a href="http://www.unidata.ucar.edu/software/netcdf/">Return to the Main Unidata NetCDF page.</a><br>
<img src="http://www.unidata.ucar.edu/images/logos/uniLogo.png">
<address style="text-align: right;"><small>
Generated on Fri Nov 11 2016 15:28:29 for NetCDF-C++. NetCDF is
a <a href="http://www.unidata.ucar.edu/">Unidata</a> library.</small></address>
</body>
</html>