GpgFrontend-Doxygen/docs/html/GpgFunctionObject_8h_source.html

277 lines
41 KiB
HTML
Raw Normal View History

2022-05-08 19:59:26 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
2022-05-08 22:01:23 +00:00
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
2022-05-08 19:59:26 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>GpgFrontend Project: src/core/GpgFunctionObject.h 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>
<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>
<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>
2022-05-08 22:01:23 +00:00
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
2022-05-08 19:59:26 +00:00
<div id="projectname">GpgFrontend Project
</div>
<div id="projectbrief">A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
2022-05-08 22:01:23 +00:00
<!-- Generated by Doxygen 1.8.17 -->
2022-05-08 19:59:26 +00:00
<script type="text/javascript">
2022-05-08 22:01:23 +00:00
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
2022-05-08 19:59:26 +00:00
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
2022-05-08 22:01:23 +00:00
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
2022-05-08 19:59:26 +00:00
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
2022-05-08 22:01:23 +00:00
/* @license-end */</script>
2022-05-08 19:59:26 +00:00
<div id="main-nav"></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">
2022-05-08 22:01:23 +00:00
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
2022-05-08 19:59:26 +00:00
$(document).ready(function(){initNavTree('GpgFunctionObject_8h_source.html',''); initResizable(); });
/* @license-end */
</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">
2022-05-08 22:01:23 +00:00
<div class="headertitle">
<div class="title">GpgFunctionObject.h</div> </div>
2022-05-08 19:59:26 +00:00
</div><!--header-->
<div class="contents">
2022-05-08 22:01:23 +00:00
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#include &lt;shared_mutex&gt;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor">#include &lt;stdexcept&gt;</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor">#include &lt;typeinfo&gt;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#include &lt;utility&gt;</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; </div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="preprocessor">#include &quot;GpgConstants.h&quot;</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;<span class="preprocessor">#include &quot;easylogging++.h&quot;</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; </div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceGpgFrontend.html">GpgFrontend</a> {</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1ChannelObject.html"> 51</a></span>&#160;<span class="keyword">class </span>GPGFRONTEND_CORE_EXPORT <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a> {</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a>() noexcept;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a>(<span class="keywordtype">int</span> channel);</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="keyword">static</span> <span class="keywordtype">int</span> GetDefaultChannel();</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; </div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; [[nodiscard]] <span class="keywordtype">int</span> GetChannel() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordtype">void</span> SetChannel(<span class="keywordtype">int</span> channel);</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1ChannelObject.html#aee5f8a5575adbdf522da4dd195c091ee"> 88</a></span>&#160; <span class="keywordtype">int</span> channel_ = _default_channel; </div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1ChannelObject.html#a66295bb572e98fc2fad3afce763ac311"> 89</a></span>&#160; <span class="keyword">static</span> constexpr <span class="keywordtype">int</span> _default_channel = 0; </div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;};</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonStorage.html"> 92</a></span>&#160;<span class="keyword">class </span>GPGFRONTEND_CORE_EXPORT <a class="code" href="classGpgFrontend_1_1SingletonStorage.html">SingletonStorage</a> {</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="keywordtype">void</span> ReleaseChannel(<span class="keywordtype">int</span> channel);</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a>* FindObjectInChannel(<span class="keywordtype">int</span> channel);</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; std::vector&lt;int&gt; GetAllChannelId();</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; </div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a>* SetObjectInChannel(<span class="keywordtype">int</span> channel,</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; std::unique_ptr&lt;ChannelObject&gt; p_obj);</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; </div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonStorage.html#a15161d0afafec602018a89266dab5641"> 127</a></span>&#160; std::shared_mutex <a class="code" href="classGpgFrontend_1_1SingletonStorage.html#a15161d0afafec602018a89266dab5641">instances_mutex_</a>; </div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; std::map&lt;int, std::unique_ptr&lt;ChannelObject&gt;&gt;</div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonStorage.html#a6181f2b5af39c6b86de89e1ba9eeff1c"> 129</a></span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonStorage.html#a6181f2b5af39c6b86de89e1ba9eeff1c">instances_map_</a>; </div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160;};</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; </div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonStorageCollection.html"> 132</a></span>&#160;<span class="keyword">class </span>GPGFRONTEND_CORE_EXPORT <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html">SingletonStorageCollection</a> {</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keyword">static</span> <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html">SingletonStorageCollection</a>* GetInstance();</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonStorage.html">SingletonStorage</a>* GetSingletonStorage(<span class="keyword">const</span> std::type_info&amp;);</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160; </div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonStorageCollection.html#ab648cb257beb2475eb5fca6453c331f9"> 150</a></span>&#160; std::shared_mutex <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#ab648cb257beb2475eb5fca6453c331f9">storages_mutex_</a>; </div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; std::map&lt;size_t, std::unique_ptr&lt;SingletonStorage&gt;&gt; storages_map_;</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;};</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html"> 159</a></span>&#160;<span class="keyword">class </span><a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject</a> : <span class="keyword">public</span> <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a> {</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a02e76b42ab51d77588b01c7508bed258">SingletonFunctionObject</a>(<span class="keyword">const</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject&lt;T&gt;</a>&amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>&#160; </div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject</a>&amp; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#aabb190a60f7a5d4ded43cae16ab8f59e">operator=</a>(<span class="keyword">const</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject&lt;T&gt;</a>&amp;) =</div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160; <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160; </div>
<div class="line"><a name="l00181"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#a70484d7cfe9f9dcbcd5f8bb749250f36"> 181</a></span>&#160; <span class="keyword">static</span> T&amp; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a70484d7cfe9f9dcbcd5f8bb749250f36">GetInstance</a>(</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160; <span class="keywordtype">int</span> channel = GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL) {</div>
<div class="line"><a name="l00183"></a><span class="lineno"> 183</span>&#160; static_assert(std::is_base_of&lt;<a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject&lt;T&gt;</a>, T&gt;::value,</div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160; <span class="stringliteral">&quot;T not derived from SingletonFunctionObject&lt;T&gt;&quot;</span>);</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <span class="keyword">auto</span> p_storage =</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a16b4729ca79dcdccc794df70aa2a5aaf">SingletonStorageCollection::GetInstance</a>()-&gt;<a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a6f933390c54b7f55d5ffb4624074725f">GetSingletonStorage</a>(</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; <span class="keyword">typeid</span>(T));</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160; </div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keyword">auto</span>* _p_pbj = (T*)(p_storage-&gt;FindObjectInChannel(channel));</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; </div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; LOG(INFO) &lt;&lt; <span class="stringliteral">&quot;object address&quot;</span> &lt;&lt; _p_pbj;</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>&#160; <span class="keywordflow">if</span> (_p_pbj == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160; <span class="keyword">auto</span> new_obj = std::unique_ptr&lt;ChannelObject&gt;(<span class="keyword">new</span> T(channel));</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; LOG(INFO) &lt;&lt; <span class="stringliteral">&quot;create new object&quot;</span>;</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; <span class="keywordflow">return</span> *(T*)(p_storage-&gt;SetObjectInChannel(channel, std::move(new_obj)));</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; } <span class="keywordflow">else</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; <span class="keywordflow">return</span> *_p_pbj;</div>
<div class="line"><a name="l00200"></a><span class="lineno"> 200</span>&#160; }</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; </div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#a083807ff8cec58dc0aa732844edaf518"> 209</a></span>&#160; <span class="keyword">static</span> T&amp; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a083807ff8cec58dc0aa732844edaf518">CreateInstance</a>(</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordtype">int</span> channel,</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; std::function&lt;std::unique_ptr&lt;ChannelObject&gt;(<span class="keywordtype">void</span>)&gt; factory) {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>&#160; static_assert(std::is_base_of&lt;<a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html">SingletonFunctionObject&lt;T&gt;</a>, T&gt;::value,</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; <span class="stringliteral">&quot;T not derived from SingletonFunctionObject&lt;T&gt;&quot;</span>);</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; </div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; <span class="keyword">auto</span> p_storage =</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a16b4729ca79dcdccc794df70aa2a5aaf">SingletonStorageCollection::GetInstance</a>()-&gt;<a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a6f933390c54b7f55d5ffb4624074725f">GetSingletonStorage</a>(</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keyword">typeid</span>(T));</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; </div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <span class="keyword">auto</span> _p_pbj = (T*)(p_storage-&gt;FindObjectInChannel(channel));</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; </div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160; <span class="keywordflow">if</span> (_p_pbj == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="keywordflow">return</span> *(</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160; T*)(p_storage-&gt;SetObjectInChannel(channel, std::move(factory())));</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; } <span class="keywordflow">else</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; <span class="keywordflow">return</span> *_p_pbj;</div>
2022-05-08 22:01:23 +00:00
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; }</div>
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#ab49b1d50252e1934691a9483a6df2106"> 234</a></span>&#160; <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#ab49b1d50252e1934691a9483a6df2106">ReleaseChannel</a>(<span class="keywordtype">int</span> channel) {</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a16b4729ca79dcdccc794df70aa2a5aaf">SingletonStorageCollection::GetInstance</a>()</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; -&gt;<a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a6f933390c54b7f55d5ffb4624074725f">GetSingletonStorage</a>(<span class="keyword">typeid</span>(T))</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; -&gt;<a class="code" href="classGpgFrontend_1_1SingletonStorage.html#adb22cc80a1ab040b6e4bce962625edfd">ReleaseChannel</a>(channel);</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; }</div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160; </div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#a50e2b3794d6553f4231eaec72d9d0a50"> 245</a></span>&#160; <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a50e2b3794d6553f4231eaec72d9d0a50">GetDefaultChannel</a>() { <span class="keywordflow">return</span> <a class="code" href="classGpgFrontend_1_1ChannelObject.html#aece9c525c49900734bc1bebf85b644ef">ChannelObject::GetDefaultChannel</a>(); }</div>
2022-05-08 22:01:23 +00:00
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; </div>
<div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#aa99440b9177f5d0c18840f08a40d64b7"> 252</a></span>&#160; [[nodiscard]] <span class="keywordtype">int</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#aa99440b9177f5d0c18840f08a40d64b7">GetChannel</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classGpgFrontend_1_1ChannelObject.html#a0e13a4bff1cfb679f68a3a2590a3b1b8">ChannelObject::GetChannel</a>(); }</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; </div>
<div class="line"><a name="l00259"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#a5f2f0474871971f86ff91fb6a2408621"> 259</a></span>&#160; <span class="keyword">static</span> std::vector&lt;int&gt; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a5f2f0474871971f86ff91fb6a2408621">GetAllChannelId</a>() {</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordflow">return</span> <a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a16b4729ca79dcdccc794df70aa2a5aaf">SingletonStorageCollection::GetInstance</a>()</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; -&gt;<a class="code" href="classGpgFrontend_1_1SingletonStorageCollection.html#a6f933390c54b7f55d5ffb4624074725f">GetSingletonStorage</a>(<span class="keyword">typeid</span>(T))</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; -&gt;<a class="code" href="classGpgFrontend_1_1SingletonStorage.html#a3f09424ebdc097fbdab77564a7d723ea">GetAllChannelId</a>();</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; }</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; </div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a02e76b42ab51d77588b01c7508bed258">SingletonFunctionObject</a>(T&amp;&amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; </div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a02e76b42ab51d77588b01c7508bed258">SingletonFunctionObject</a>(<span class="keyword">const</span> T&amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; </div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; <span class="keywordtype">void</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#aabb190a60f7a5d4ded43cae16ab8f59e">operator=</a>(<span class="keyword">const</span> T&amp;) = <span class="keyword">delete</span>;</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; </div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160; <span class="keyword">protected</span>:</div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a02e76b42ab51d77588b01c7508bed258">SingletonFunctionObject</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00289"></a><span class="lineno"> 289</span>&#160; </div>
<div class="line"><a name="l00295"></a><span class="lineno"><a class="line" href="classGpgFrontend_1_1SingletonFunctionObject.html#a4aa7f1eb1d3281bb1fccfcbb1b416251"> 295</a></span>&#160; <span class="keyword">explicit</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a4aa7f1eb1d3281bb1fccfcbb1b416251">SingletonFunctionObject</a>(<span class="keywordtype">int</span> channel) : <a class="code" href="classGpgFrontend_1_1ChannelObject.html">ChannelObject</a>(channel) {</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; LOG(INFO) &lt;&lt; <span class="stringliteral">&quot;called&quot;</span></div>
<div class="line"><a name="l00297"></a><span class="lineno"> 297</span>&#160; &lt;&lt; <span class="stringliteral">&quot;channel:&quot;</span> &lt;&lt; channel;</div>
<div class="line"><a name="l00298"></a><span class="lineno"> 298</span>&#160; }</div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>&#160; </div>
<div class="line"><a name="l00304"></a><span class="lineno"> 304</span>&#160; <span class="keyword">virtual</span> <a class="code" href="classGpgFrontend_1_1SingletonFunctionObject.html#a8296be8c449f88175285186831b995bc">~SingletonFunctionObject</a>() = <span class="keywordflow">default</span>;</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>&#160;};</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>&#160;} <span class="comment">// namespace GpgFrontend</span></div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>&#160; </div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>&#160;<span class="preprocessor">#endif // GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H</span></div>
2022-05-08 22:01:23 +00:00
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aclassGpgFrontend_1_1ChannelObject_html_aee5f8a5575adbdf522da4dd195c091ee"><div class="ttname"><a href="classGpgFrontend_1_1ChannelObject.html#aee5f8a5575adbdf522da4dd195c091ee">GpgFrontend::ChannelObject::channel_</a></div><div class="ttdeci">int channel_</div><div class="ttdoc">The channel id.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:88</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html">GpgFrontend::SingletonFunctionObject</a></div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:159</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1ChannelObject_html_a0e13a4bff1cfb679f68a3a2590a3b1b8"><div class="ttname"><a href="classGpgFrontend_1_1ChannelObject.html#a0e13a4bff1cfb679f68a3a2590a3b1b8">GpgFrontend::ChannelObject::GetChannel</a></div><div class="ttdeci">int GetChannel() const</div><div class="ttdoc">Get the Channel object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:43</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorageCollection_html_a6f933390c54b7f55d5ffb4624074725f"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorageCollection.html#a6f933390c54b7f55d5ffb4624074725f">GpgFrontend::SingletonStorageCollection::GetSingletonStorage</a></div><div class="ttdeci">SingletonStorage * GetSingletonStorage(const std::type_info &amp;)</div><div class="ttdoc">Get the Singleton Storage object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:102</div></div>
2022-05-08 19:59:26 +00:00
<div class="ttc" id="anamespaceGpgFrontend_html"><div class="ttname"><a href="namespaceGpgFrontend.html">GpgFrontend</a></div><div class="ttdef"><b>Definition:</b> CoreCommonUtil.cpp:29</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a70484d7cfe9f9dcbcd5f8bb749250f36"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a70484d7cfe9f9dcbcd5f8bb749250f36">GpgFrontend::SingletonFunctionObject::GetInstance</a></div><div class="ttdeci">static T &amp; GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)</div><div class="ttdoc">Get the Instance object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:181</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a4aa7f1eb1d3281bb1fccfcbb1b416251"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a4aa7f1eb1d3281bb1fccfcbb1b416251">GpgFrontend::SingletonFunctionObject::SingletonFunctionObject</a></div><div class="ttdeci">SingletonFunctionObject(int channel)</div><div class="ttdoc">Construct a new Singleton Function Object object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:295</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_aabb190a60f7a5d4ded43cae16ab8f59e"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#aabb190a60f7a5d4ded43cae16ab8f59e">GpgFrontend::SingletonFunctionObject::operator=</a></div><div class="ttdeci">SingletonFunctionObject &amp; operator=(const SingletonFunctionObject&lt; T &gt; &amp;)=delete</div><div class="ttdoc">prohibit copy</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1ChannelObject_html_aa3b19cad6d873b314bba32a3dae85f09"><div class="ttname"><a href="classGpgFrontend_1_1ChannelObject.html#aa3b19cad6d873b314bba32a3dae85f09">GpgFrontend::ChannelObject::SetChannel</a></div><div class="ttdeci">void SetChannel(int channel)</div><div class="ttdoc">Set the Channel object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:39</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_aa99440b9177f5d0c18840f08a40d64b7"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#aa99440b9177f5d0c18840f08a40d64b7">GpgFrontend::SingletonFunctionObject::GetChannel</a></div><div class="ttdeci">int GetChannel() const</div><div class="ttdoc">Get the Channel object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:252</div></div>
2022-05-08 22:01:23 +00:00
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a8296be8c449f88175285186831b995bc"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a8296be8c449f88175285186831b995bc">GpgFrontend::SingletonFunctionObject::~SingletonFunctionObject</a></div><div class="ttdeci">virtual ~SingletonFunctionObject()=default</div><div class="ttdoc">Destroy the Singleton Function Object object.</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html_ab0097bb648b2303d68a975c7cbea5a52"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html#ab0097bb648b2303d68a975c7cbea5a52">GpgFrontend::SingletonStorage::SetObjectInChannel</a></div><div class="ttdeci">ChannelObject * SetObjectInChannel(int channel, std::unique_ptr&lt; ChannelObject &gt; p_obj)</div><div class="ttdoc">Set a new object in channel object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:82</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html_a6181f2b5af39c6b86de89e1ba9eeff1c"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html#a6181f2b5af39c6b86de89e1ba9eeff1c">GpgFrontend::SingletonStorage::instances_map_</a></div><div class="ttdeci">std::map&lt; int, std::unique_ptr&lt; ChannelObject &gt; &gt; instances_map_</div><div class="ttdoc">map of singleton instances</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:129</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorageCollection_html_ab648cb257beb2475eb5fca6453c331f9"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorageCollection.html#ab648cb257beb2475eb5fca6453c331f9">GpgFrontend::SingletonStorageCollection::storages_mutex_</a></div><div class="ttdeci">std::shared_mutex storages_mutex_</div><div class="ttdoc">mutex for storages_map_</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:150</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorageCollection_html"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorageCollection.html">GpgFrontend::SingletonStorageCollection</a></div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:132</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html_a4c16c32e549494e394a0ddd859890a02"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html#a4c16c32e549494e394a0ddd859890a02">GpgFrontend::SingletonStorage::FindObjectInChannel</a></div><div class="ttdeci">ChannelObject * FindObjectInChannel(int channel)</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:57</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorageCollection_html_a16b4729ca79dcdccc794df70aa2a5aaf"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorageCollection.html#a16b4729ca79dcdccc794df70aa2a5aaf">GpgFrontend::SingletonStorageCollection::GetInstance</a></div><div class="ttdeci">static SingletonStorageCollection * GetInstance()</div><div class="ttdoc">Get the Instance object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:130</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a5f2f0474871971f86ff91fb6a2408621"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a5f2f0474871971f86ff91fb6a2408621">GpgFrontend::SingletonFunctionObject::GetAllChannelId</a></div><div class="ttdeci">static std::vector&lt; int &gt; GetAllChannelId()</div><div class="ttdoc">Get all the channel ids.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:259</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1ChannelObject_html_aedbf32eddc701e521bd8e790ef208da0"><div class="ttname"><a href="classGpgFrontend_1_1ChannelObject.html#aedbf32eddc701e521bd8e790ef208da0">GpgFrontend::ChannelObject::ChannelObject</a></div><div class="ttdeci">ChannelObject() noexcept</div><div class="ttdoc">Construct a new Default Channel Object object.</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a083807ff8cec58dc0aa732844edaf518"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a083807ff8cec58dc0aa732844edaf518">GpgFrontend::SingletonFunctionObject::CreateInstance</a></div><div class="ttdeci">static T &amp; CreateInstance(int channel, std::function&lt; std::unique_ptr&lt; ChannelObject &gt;(void)&gt; factory)</div><div class="ttdoc">Create a Instance object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:209</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1ChannelObject_html_aece9c525c49900734bc1bebf85b644ef"><div class="ttname"><a href="classGpgFrontend_1_1ChannelObject.html#aece9c525c49900734bc1bebf85b644ef">GpgFrontend::ChannelObject::GetDefaultChannel</a></div><div class="ttdeci">static int GetDefaultChannel()</div><div class="ttdoc">Get the Default Channel object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:45</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1ChannelObject_html"><div class="ttname"><a href="classGpgFrontend_1_1ChannelObject.html">GpgFrontend::ChannelObject</a></div><div class="ttdoc">object which in channel system</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:51</div></div>
2022-05-08 22:01:23 +00:00
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a02e76b42ab51d77588b01c7508bed258"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a02e76b42ab51d77588b01c7508bed258">GpgFrontend::SingletonFunctionObject::SingletonFunctionObject</a></div><div class="ttdeci">SingletonFunctionObject()=default</div><div class="ttdoc">Construct a new Singleton Function Object object.</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html_adb22cc80a1ab040b6e4bce962625edfd"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html#adb22cc80a1ab040b6e4bce962625edfd">GpgFrontend::SingletonStorage::ReleaseChannel</a></div><div class="ttdeci">void ReleaseChannel(int channel)</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:47</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_a50e2b3794d6553f4231eaec72d9d0a50"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#a50e2b3794d6553f4231eaec72d9d0a50">GpgFrontend::SingletonFunctionObject::GetDefaultChannel</a></div><div class="ttdeci">static int GetDefaultChannel()</div><div class="ttdoc">Get the Default Channel object.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:245</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html">GpgFrontend::SingletonStorage</a></div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:92</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html_a15161d0afafec602018a89266dab5641"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html#a15161d0afafec602018a89266dab5641">GpgFrontend::SingletonStorage::instances_mutex_</a></div><div class="ttdeci">std::shared_mutex instances_mutex_</div><div class="ttdoc">mutex for _instances_map</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:127</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonStorage_html_a3f09424ebdc097fbdab77564a7d723ea"><div class="ttname"><a href="classGpgFrontend_1_1SingletonStorage.html#a3f09424ebdc097fbdab77564a7d723ea">GpgFrontend::SingletonStorage::GetAllChannelId</a></div><div class="ttdeci">std::vector&lt; int &gt; GetAllChannelId()</div><div class="ttdoc">Get all the channel ids.</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.cpp:74</div></div>
<div class="ttc" id="aclassGpgFrontend_1_1SingletonFunctionObject_html_ab49b1d50252e1934691a9483a6df2106"><div class="ttname"><a href="classGpgFrontend_1_1SingletonFunctionObject.html#ab49b1d50252e1934691a9483a6df2106">GpgFrontend::SingletonFunctionObject::ReleaseChannel</a></div><div class="ttdeci">static void ReleaseChannel(int channel)</div><div class="ttdef"><b>Definition:</b> GpgFunctionObject.h:234</div></div>
2022-05-08 19:59:26 +00:00
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><b>GpgFunctionObject.h</b></li>
2022-05-08 22:01:23 +00:00
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
2022-05-08 19:59:26 +00:00
</ul>
</div>
</body>
</html>