Nikhil Raj | 1dc83fe | 2024-05-16 09:47:51 +0100 | [diff] [blame^] | 1 | <!-- HTML header for doxygen 1.8.17--> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 6 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 7 | <meta name="generator" content="Doxygen 1.8.17"/> |
| 8 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 9 | <title>Arm NN: armnnUtils::Filesystem Namespace Reference</title> |
| 10 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 11 | <script type="text/javascript" src="jquery.js"></script> |
| 12 | <script type="text/javascript" src="dynsections.js"></script> |
| 13 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 14 | <script type="text/javascript" src="resize.js"></script> |
| 15 | <script type="text/javascript" src="navtreedata.js"></script> |
| 16 | <script type="text/javascript" src="navtree.js"></script> |
| 17 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 18 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 19 | <script type="text/javascript" src="search/search.js"></script> |
| 20 | <script type="text/x-mathjax-config"> |
| 21 | MathJax.Hub.Config({ |
| 22 | extensions: ["tex2jax.js"], |
| 23 | jax: ["input/TeX","output/HTML-CSS"], |
| 24 | }); |
| 25 | </script> |
| 26 | <script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> |
| 27 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 28 | <link href="customdoxygen.css" rel="stylesheet" type="text/css"/> |
| 29 | </head> |
| 30 | <body> |
| 31 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 32 | <div id="titlearea"> |
| 33 | <table cellspacing="0" cellpadding="0"> |
| 34 | <tbody> |
| 35 | <tr style="height: 56px;"> |
| 36 | <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 15rem; margin-top: .5rem; margin-left 13px"/> |
| 37 | <td id="projectalign" style="padding-left: 0.9em;"> |
| 38 | <div id="projectname"> |
| 39 |  <span id="projectnumber">24.05</span> |
| 40 | </div> |
| 41 | </td> |
| 42 | </tr> |
| 43 | </tbody> |
| 44 | </table> |
| 45 | </div> |
| 46 | <!-- end header part --> |
| 47 | <!-- Generated by Doxygen 1.8.17 --> |
| 48 | <script type="text/javascript"> |
| 49 | /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| 50 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 51 | /* @license-end */ |
| 52 | </script> |
| 53 | <script type="text/javascript" src="menudata.js"></script> |
| 54 | <script type="text/javascript" src="menu.js"></script> |
| 55 | <script type="text/javascript"> |
| 56 | /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| 57 | $(function() { |
| 58 | initMenu('',true,false,'search.php','Search'); |
| 59 | $(document).ready(function() { init_search(); }); |
| 60 | }); |
| 61 | /* @license-end */</script> |
| 62 | <div id="main-nav"></div> |
| 63 | </div><!-- top --> |
| 64 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 65 | <div id="nav-tree"> |
| 66 | <div id="nav-tree-contents"> |
| 67 | <div id="nav-sync" class="sync"></div> |
| 68 | </div> |
| 69 | </div> |
| 70 | <div id="splitbar" style="-moz-user-select:none;" |
| 71 | class="ui-resizable-handle"> |
| 72 | </div> |
| 73 | </div> |
| 74 | <script type="text/javascript"> |
| 75 | /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| 76 | $(document).ready(function(){initNavTree('namespacearmnn_utils_1_1_filesystem.html',''); initResizable(); }); |
| 77 | /* @license-end */ |
| 78 | </script> |
| 79 | <div id="doc-content"> |
| 80 | <!-- window showing the filter options --> |
| 81 | <div id="MSearchSelectWindow" |
| 82 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 83 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 84 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 85 | </div> |
| 86 | |
| 87 | <!-- iframe showing the search results (closed by default) --> |
| 88 | <div id="MSearchResultsWindow"> |
| 89 | <iframe src="javascript:void(0)" frameborder="0" |
| 90 | name="MSearchResults" id="MSearchResults"> |
| 91 | </iframe> |
| 92 | </div> |
| 93 | |
| 94 | <div class="header"> |
| 95 | <div class="summary"> |
| 96 | <a href="#typedef-members">Typedefs</a> | |
| 97 | <a href="#func-members">Functions</a> </div> |
| 98 | <div class="headertitle"> |
| 99 | <div class="title">armnnUtils::Filesystem Namespace Reference</div> </div> |
| 100 | </div><!--header--> |
| 101 | <div class="contents"> |
| 102 | <table class="memberdecls"> |
| 103 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> |
| 104 | Typedefs</h2></td></tr> |
| 105 | <tr class="memitem:ac43ab637ed192811c3b20c71990fd871"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#ac43ab637ed192811c3b20c71990fd871">FileContents</a> = std::string</td></tr> |
| 106 | <tr class="separator:ac43ab637ed192811c3b20c71990fd871"><td class="memSeparator" colspan="2"> </td></tr> |
| 107 | </table><table class="memberdecls"> |
| 108 | <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> |
| 109 | Functions</h2></td></tr> |
| 110 | <tr class="memitem:a606d65835d72a332109c3c9f96a01b8a"><td class="memItemLeft" align="right" valign="top">fs::path </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#a606d65835d72a332109c3c9f96a01b8a">NamedTempFile</a> (const char *fileName)</td></tr> |
| 111 | <tr class="memdesc:a606d65835d72a332109c3c9f96a01b8a"><td class="mdescLeft"> </td><td class="mdescRight">Returns a path to a file in the system temporary folder. If the file existed it will be deleted. <a href="namespacearmnn_utils_1_1_filesystem.html#a606d65835d72a332109c3c9f96a01b8a">More...</a><br /></td></tr> |
| 112 | <tr class="separator:a606d65835d72a332109c3c9f96a01b8a"><td class="memSeparator" colspan="2"> </td></tr> |
| 113 | <tr class="memitem:a0477efb2c6f5b41fbfe937fef6db312d"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#a0477efb2c6f5b41fbfe937fef6db312d">CreateDirectory</a> (std::string sPath)</td></tr> |
| 114 | <tr class="memdesc:a0477efb2c6f5b41fbfe937fef6db312d"><td class="mdescLeft"> </td><td class="mdescRight">Returns full path to temporary folder. <a href="namespacearmnn_utils_1_1_filesystem.html#a0477efb2c6f5b41fbfe937fef6db312d">More...</a><br /></td></tr> |
| 115 | <tr class="separator:a0477efb2c6f5b41fbfe937fef6db312d"><td class="memSeparator" colspan="2"> </td></tr> |
| 116 | <tr class="memitem:a32ff1b057109ad1128fd1ac82ed7e9a7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#ac43ab637ed192811c3b20c71990fd871">FileContents</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#a32ff1b057109ad1128fd1ac82ed7e9a7">ReadFileContentsIntoString</a> (const std::string &path)</td></tr> |
| 117 | <tr class="separator:a32ff1b057109ad1128fd1ac82ed7e9a7"><td class="memSeparator" colspan="2"> </td></tr> |
| 118 | <tr class="memitem:aa994467360962e6efc1c4e0d8f293e8c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#aa994467360962e6efc1c4e0d8f293e8c">RemoveDirectoryAndContents</a> (const std::string &path)</td></tr> |
| 119 | <tr class="memdesc:aa994467360962e6efc1c4e0d8f293e8c"><td class="mdescLeft"> </td><td class="mdescRight">Remove a directory and its contents. <a href="namespacearmnn_utils_1_1_filesystem.html#aa994467360962e6efc1c4e0d8f293e8c">More...</a><br /></td></tr> |
| 120 | <tr class="separator:aa994467360962e6efc1c4e0d8f293e8c"><td class="memSeparator" colspan="2"> </td></tr> |
| 121 | </table> |
| 122 | <h2 class="groupheader">Typedef Documentation</h2> |
| 123 | <a id="ac43ab637ed192811c3b20c71990fd871"></a> |
| 124 | <h2 class="memtitle"><span class="permalink"><a href="#ac43ab637ed192811c3b20c71990fd871">◆ </a></span>FileContents</h2> |
| 125 | |
| 126 | <div class="memitem"> |
| 127 | <div class="memproto"> |
| 128 | <table class="memname"> |
| 129 | <tr> |
| 130 | <td class="memname">using <a class="el" href="namespacearmnn_utils_1_1_filesystem.html#ac43ab637ed192811c3b20c71990fd871">FileContents</a> = std::string</td> |
| 131 | </tr> |
| 132 | </table> |
| 133 | </div><div class="memdoc"> |
| 134 | |
| 135 | <p class="definition">Definition at line <a class="el" href="_filesystem_8hpp_source.html#l00024">24</a> of file <a class="el" href="_filesystem_8hpp_source.html">Filesystem.hpp</a>.</p> |
| 136 | |
| 137 | </div> |
| 138 | </div> |
| 139 | <h2 class="groupheader">Function Documentation</h2> |
| 140 | <a id="a0477efb2c6f5b41fbfe937fef6db312d"></a> |
| 141 | <h2 class="memtitle"><span class="permalink"><a href="#a0477efb2c6f5b41fbfe937fef6db312d">◆ </a></span>CreateDirectory()</h2> |
| 142 | |
| 143 | <div class="memitem"> |
| 144 | <div class="memproto"> |
| 145 | <table class="memname"> |
| 146 | <tr> |
| 147 | <td class="memname">std::string CreateDirectory </td> |
| 148 | <td>(</td> |
| 149 | <td class="paramtype">std::string </td> |
| 150 | <td class="paramname"><em>path</em></td><td>)</td> |
| 151 | <td></td> |
| 152 | </tr> |
| 153 | </table> |
| 154 | </div><div class="memdoc"> |
| 155 | |
| 156 | <p>Returns full path to temporary folder. </p> |
| 157 | <p>Construct a temporary directory.</p> |
| 158 | <p>Given a specified directory name construct a path in the system temporary directory. If the directory already exists, it is deleted, otherwise create it. This could throw filesystem_error exceptions.</p> |
| 159 | <dl class="params"><dt>Parameters</dt><dd> |
| 160 | <table class="params"> |
| 161 | <tr><td class="paramname">path</td><td>is the path required in the temporary directory. </td></tr> |
| 162 | </table> |
| 163 | </dd> |
| 164 | </dl> |
| 165 | <dl class="section return"><dt>Returns</dt><dd>path consisting of system temporary directory. </dd></dl> |
| 166 | <dl class="exception"><dt>Exceptions</dt><dd> |
| 167 | <table class="exception"> |
| 168 | <tr><td class="paramname">RuntimeException</td><td>if the directory cannot be created or exists but cannot be removed. </td></tr> |
| 169 | </table> |
| 170 | </dd> |
| 171 | </dl> |
| 172 | |
| 173 | <p class="definition">Definition at line <a class="el" href="_filesystem_8cpp_source.html#l00047">47</a> of file <a class="el" href="_filesystem_8cpp_source.html">Filesystem.cpp</a>.</p> |
| 174 | <div class="fragment"><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> {</div> |
| 175 | <div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="comment">// This line is very unlikely to throw an exception.</span></div> |
| 176 | <div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  fs::path tmpDir = fs::temp_directory_path();</div> |
| 177 | <div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  std::string full_path = tmpDir.generic_string() + path;</div> |
| 178 | <div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="comment">// This could throw a file permission exception.</span></div> |
| 179 | <div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <a class="code" href="namespacearmnn_utils_1_1_filesystem.html#aa994467360962e6efc1c4e0d8f293e8c">RemoveDirectoryAndContents</a>(full_path);</div> |
| 180 | <div class="line"><a name="l00054"></a><span class="lineno"> 54</span> <span class="preprocessor">#if defined(_WIN32)</span></div> |
| 181 | <div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  result = _mkdir(full_path.c_str()); <span class="comment">// can be used on Windows</span></div> |
| 182 | <div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  armnn::ConditionalThrow<armnn::RuntimeException>((result == 0), <span class="stringliteral">"Was unable to create temporary directory"</span>);</div> |
| 183 | <div class="line"><a name="l00057"></a><span class="lineno"> 57</span> <span class="preprocessor">#else</span></div> |
| 184 | <div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordflow">try</span></div> |
| 185 | <div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  {</div> |
| 186 | <div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">if</span>(!fs::create_directory(full_path))</div> |
| 187 | <div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  {</div> |
| 188 | <div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(<span class="stringliteral">"Unable to create directory: "</span> + full_path);</div> |
| 189 | <div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  }</div> |
| 190 | <div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  }</div> |
| 191 | <div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> std::system_error& e)</div> |
| 192 | <div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  {</div> |
| 193 | <div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  std::string <a class="code" href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">error</a> = <span class="stringliteral">"Unable to create directory. Reason: "</span>;</div> |
| 194 | <div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">error</a>.append(e.what());</div> |
| 195 | <div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(error);</div> |
| 196 | <div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  }</div> |
| 197 | <div class="line"><a name="l00071"></a><span class="lineno"> 71</span> <span class="preprocessor">#endif</span></div> |
| 198 | <div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  </div> |
| 199 | <div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">return</span> full_path + <span class="stringliteral">"/"</span>;</div> |
| 200 | <div class="line"><a name="l00074"></a><span class="lineno"> 74</span> }</div> |
| 201 | </div><!-- fragment --> |
| 202 | <p class="reference">References <a class="el" href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">armnn::error</a>, and <a class="el" href="_filesystem_8cpp_source.html#l00084">RemoveDirectoryAndContents()</a>.</p> |
| 203 | |
| 204 | <p class="reference">Referenced by <a class="el" href="_network_8cpp_source.html#l01906">armnn::Optimize()</a>.</p> |
| 205 | |
| 206 | </div> |
| 207 | </div> |
| 208 | <a id="a606d65835d72a332109c3c9f96a01b8a"></a> |
| 209 | <h2 class="memtitle"><span class="permalink"><a href="#a606d65835d72a332109c3c9f96a01b8a">◆ </a></span>NamedTempFile()</h2> |
| 210 | |
| 211 | <div class="memitem"> |
| 212 | <div class="memproto"> |
| 213 | <table class="memname"> |
| 214 | <tr> |
| 215 | <td class="memname">fs::path NamedTempFile </td> |
| 216 | <td>(</td> |
| 217 | <td class="paramtype">const char * </td> |
| 218 | <td class="paramname"><em>fileName</em></td><td>)</td> |
| 219 | <td></td> |
| 220 | </tr> |
| 221 | </table> |
| 222 | </div><div class="memdoc"> |
| 223 | |
| 224 | <p>Returns a path to a file in the system temporary folder. If the file existed it will be deleted. </p> |
| 225 | <p>Construct a temporary file name.</p> |
| 226 | <p>Given a specified file name construct a path to that file in the system temporary directory. If the file already exists it is deleted. This could throw filesystem_error exceptions.</p> |
| 227 | <dl class="params"><dt>Parameters</dt><dd> |
| 228 | <table class="params"> |
| 229 | <tr><td class="paramname">fileName</td><td>the file name required in the temporary directory. </td></tr> |
| 230 | </table> |
| 231 | </dd> |
| 232 | </dl> |
| 233 | <dl class="section return"><dt>Returns</dt><dd>path consisting of system temporary directory and file name. </dd></dl> |
| 234 | |
| 235 | <p class="definition">Definition at line <a class="el" href="_filesystem_8cpp_source.html#l00025">25</a> of file <a class="el" href="_filesystem_8cpp_source.html">Filesystem.cpp</a>.</p> |
| 236 | <div class="fragment"><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> {</div> |
| 237 | <div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  fs::path tmpDir = fs::temp_directory_path();</div> |
| 238 | <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  fs::path namedTempFile{tmpDir / fileName};</div> |
| 239 | <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="keywordflow">if</span> (fs::exists(namedTempFile))</div> |
| 240 | <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  {</div> |
| 241 | <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  fs::remove(namedTempFile);</div> |
| 242 | <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  }</div> |
| 243 | <div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">return</span> namedTempFile;</div> |
| 244 | <div class="line"><a name="l00034"></a><span class="lineno"> 34</span> }</div> |
| 245 | </div><!-- fragment --> |
| 246 | <p class="reference">Referenced by <a class="el" href="_j_s_o_n_timeline_decoder_tests_8cpp_source.html#l00015">TEST_SUITE()</a>.</p> |
| 247 | |
| 248 | </div> |
| 249 | </div> |
| 250 | <a id="a32ff1b057109ad1128fd1ac82ed7e9a7"></a> |
| 251 | <h2 class="memtitle"><span class="permalink"><a href="#a32ff1b057109ad1128fd1ac82ed7e9a7">◆ </a></span>ReadFileContentsIntoString()</h2> |
| 252 | |
| 253 | <div class="memitem"> |
| 254 | <div class="memproto"> |
| 255 | <table class="memname"> |
| 256 | <tr> |
| 257 | <td class="memname"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html#ac43ab637ed192811c3b20c71990fd871">FileContents</a> ReadFileContentsIntoString </td> |
| 258 | <td>(</td> |
| 259 | <td class="paramtype">const std::string & </td> |
| 260 | <td class="paramname"><em>path</em></td><td>)</td> |
| 261 | <td></td> |
| 262 | </tr> |
| 263 | </table> |
| 264 | </div><div class="memdoc"> |
| 265 | |
| 266 | <p class="definition">Definition at line <a class="el" href="_filesystem_8cpp_source.html#l00102">102</a> of file <a class="el" href="_filesystem_8cpp_source.html">Filesystem.cpp</a>.</p> |
| 267 | <div class="fragment"><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  {</div> |
| 268 | <div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">if</span> (!fs::exists(path))</div> |
| 269 | <div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  {</div> |
| 270 | <div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(<span class="stringliteral">"Path does not exist: "</span> + path);</div> |
| 271 | <div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  }</div> |
| 272 | <div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  std::ifstream input_file(path);</div> |
| 273 | <div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  armnn::ConditionalThrow<armnn::RuntimeException>((input_file.is_open()), <span class="stringliteral">"Could not read file contents"</span>);</div> |
| 274 | <div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">return</span> <a class="code" href="namespacearmnn_utils_1_1_filesystem.html#ac43ab637ed192811c3b20c71990fd871">FileContents</a>((std::istreambuf_iterator<char>(input_file)), std::istreambuf_iterator<char>());</div> |
| 275 | <div class="line"><a name="l00110"></a><span class="lineno"> 110</span> }</div> |
| 276 | </div><!-- fragment --> |
| 277 | </div> |
| 278 | </div> |
| 279 | <a id="aa994467360962e6efc1c4e0d8f293e8c"></a> |
| 280 | <h2 class="memtitle"><span class="permalink"><a href="#aa994467360962e6efc1c4e0d8f293e8c">◆ </a></span>RemoveDirectoryAndContents()</h2> |
| 281 | |
| 282 | <div class="memitem"> |
| 283 | <div class="memproto"> |
| 284 | <table class="memname"> |
| 285 | <tr> |
| 286 | <td class="memname">void RemoveDirectoryAndContents </td> |
| 287 | <td>(</td> |
| 288 | <td class="paramtype">const std::string & </td> |
| 289 | <td class="paramname"><em>path</em></td><td>)</td> |
| 290 | <td></td> |
| 291 | </tr> |
| 292 | </table> |
| 293 | </div><div class="memdoc"> |
| 294 | |
| 295 | <p>Remove a directory and its contents. </p> |
| 296 | <p>Given a directory path delete it's contents and the directory. If the specified directory doesn't exist this does nothing. If any item cannot be removed this will throw a RuntimeException.</p> |
| 297 | <dl class="params"><dt>Parameters</dt><dd> |
| 298 | <table class="params"> |
| 299 | <tr><td class="paramname">full_path</td><td></td></tr> |
| 300 | </table> |
| 301 | </dd> |
| 302 | </dl> |
| 303 | |
| 304 | <p class="definition">Definition at line <a class="el" href="_filesystem_8cpp_source.html#l00084">84</a> of file <a class="el" href="_filesystem_8cpp_source.html">Filesystem.cpp</a>.</p> |
| 305 | <div class="fragment"><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> {</div> |
| 306 | <div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keywordflow">if</span> (fs::exists(path))</div> |
| 307 | <div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  {</div> |
| 308 | <div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">try</span></div> |
| 309 | <div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  {</div> |
| 310 | <div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="comment">// This could throw an exception on a multi-user system.</span></div> |
| 311 | <div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  fs::remove_all(path);</div> |
| 312 | <div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  }</div> |
| 313 | <div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">catch</span> (<span class="keyword">const</span> std::system_error& e)</div> |
| 314 | <div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  {</div> |
| 315 | <div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  std::string <a class="code" href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">error</a> = <span class="stringliteral">"Directory exists and cannot be removed. Reason: "</span>;</div> |
| 316 | <div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <a class="code" href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">error</a>.append(e.what());</div> |
| 317 | <div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a>(error);</div> |
| 318 | <div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  }</div> |
| 319 | <div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  }</div> |
| 320 | <div class="line"><a name="l00100"></a><span class="lineno"> 100</span> }</div> |
| 321 | </div><!-- fragment --> |
| 322 | <p class="reference">References <a class="el" href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">armnn::error</a>.</p> |
| 323 | |
| 324 | <p class="reference">Referenced by <a class="el" href="_filesystem_8cpp_source.html#l00047">CreateDirectory()</a>.</p> |
| 325 | |
| 326 | </div> |
| 327 | </div> |
| 328 | </div><!-- contents --> |
| 329 | </div><!-- doc-content --> |
| 330 | <div class="ttc" id="anamespacearmnn_html_a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282"><div class="ttname"><a href="namespacearmnn.html#a4dc0adc6737b5944e7671bee71788407acb5e100e5a9a3e7f6d1fd97512215282">armnn::BoostLogSeverityMapping::error</a></div><div class="ttdeci">@ error</div></div> |
| 331 | <div class="ttc" id="anamespacearmnn_utils_1_1_filesystem_html_ac43ab637ed192811c3b20c71990fd871"><div class="ttname"><a href="namespacearmnn_utils_1_1_filesystem.html#ac43ab637ed192811c3b20c71990fd871">armnnUtils::Filesystem::FileContents</a></div><div class="ttdeci">std::string FileContents</div><div class="ttdef"><b>Definition:</b> <a href="_filesystem_8hpp_source.html#l00024">Filesystem.hpp:24</a></div></div> |
| 332 | <div class="ttc" id="aclassarmnn_1_1_runtime_exception_html"><div class="ttname"><a href="classarmnn_1_1_runtime_exception.html">armnn::RuntimeException</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00120">Exceptions.hpp:120</a></div></div> |
| 333 | <div class="ttc" id="anamespacearmnn_utils_1_1_filesystem_html_aa994467360962e6efc1c4e0d8f293e8c"><div class="ttname"><a href="namespacearmnn_utils_1_1_filesystem.html#aa994467360962e6efc1c4e0d8f293e8c">armnnUtils::Filesystem::RemoveDirectoryAndContents</a></div><div class="ttdeci">void RemoveDirectoryAndContents(const std::string &path)</div><div class="ttdoc">Remove a directory and its contents.</div><div class="ttdef"><b>Definition:</b> <a href="_filesystem_8cpp_source.html#l00084">Filesystem.cpp:84</a></div></div> |
| 334 | <!-- start footer part --> |
| 335 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 336 | <ul> |
| 337 | <li class="navelem"><a class="el" href="namespacearmnn_utils.html">armnnUtils</a></li><li class="navelem"><a class="el" href="namespacearmnn_utils_1_1_filesystem.html">Filesystem</a></li> |
| 338 | <li class="footer">Generated on Thu May 16 2024 09:32:00 for Arm NN by |
| 339 | <a href="http://www.doxygen.org/index.html"> |
| 340 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li> |
| 341 | </ul> |
| 342 | </div> |
| 343 | </body> |
| 344 | </html> |