| <!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.13"/> |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| <title>Apache Singa: /home/moaz/incubator-singa/include/singa/utils/channel.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="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> |
| <tr style="height: 56px;"> |
| <td id="projectalign" style="padding-left: 0.5em;"> |
| <div id="projectname">Apache Singa |
| </div> |
| <div id="projectbrief">A General Distributed Deep Learning Library</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <!-- end header part --> |
| <!-- Generated by Doxygen 1.8.13 --> |
| <script type="text/javascript"> |
| var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| </script> |
| <script type="text/javascript" src="menudata.js"></script> |
| <script type="text/javascript" src="menu.js"></script> |
| <script type="text/javascript"> |
| $(function() { |
| initMenu('',true,false,'search.php','Search'); |
| $(document).ready(function() { init_search(); }); |
| }); |
| </script> |
| <div id="main-nav"></div> |
| <!-- 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 id="nav-path" class="navpath"> |
| <ul> |
| <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_14a988756d30161f7e1f48b05d03905d.html">singa</a></li><li class="navelem"><a class="el" href="dir_54125cd652f9635a64a4101de1b8704d.html">utils</a></li> </ul> |
| </div> |
| </div><!-- top --> |
| <div class="header"> |
| <div class="headertitle"> |
| <div class="title">channel.h</div> </div> |
| </div><!--header--> |
| <div class="contents"> |
| <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/************************************************************</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">*</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">* Licensed to the Apache Software Foundation (ASF) under one</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">* or more contributor license agreements. See the NOTICE file</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">* distributed with this work for additional information</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">* regarding copyright ownership. The ASF licenses this file</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment">* to you under the Apache License, Version 2.0 (the</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">* "License"); you may not use this file except in compliance</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment">* with the License. You may obtain a copy of the License at</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment">*</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment">* http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">*</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">* Unless required by applicable law or agreed to in writing,</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">* software distributed under the License is distributed on an</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment">* KIND, either express or implied. See the License for the</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment">* specific language governing permissions and limitations</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment">* under the License.</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment">*</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment">*************************************************************/</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#ifndef SINGA_UTILS_CHANNEL_H_</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#define SINGA_UTILS_CHANNEL_H_</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> </div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <google/protobuf/message.h></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include <iostream></span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include <fstream></span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include <map></span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor">#include <string></span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> </div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">namespace </span><a class="code" href="namespacesinga.html">singa</a> {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classsinga_1_1Channel.html"> 35</a></span> <span class="keyword">class </span><a class="code" href="classsinga_1_1Channel.html">Channel</a> {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keyword">explicit</span> <a class="code" href="classsinga_1_1Channel.html">Channel</a>(<span class="keyword">const</span> std::string& name);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  ~<a class="code" href="classsinga_1_1Channel.html">Channel</a>();</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classsinga_1_1Channel.html#aba152cf4c1848dacb6a50f351d8bdc99"> 41</a></span>  <span class="keyword">inline</span> <span class="keyword">const</span> std::string& <a class="code" href="classsinga_1_1Channel.html#aba152cf4c1848dacb6a50f351d8bdc99">GetName</a>() { <span class="keywordflow">return</span> name_; }</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classsinga_1_1Channel.html#ae95a868b2cbce464b2b7e065ab4dfaa7"> 43</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classsinga_1_1Channel.html#ae95a868b2cbce464b2b7e065ab4dfaa7">EnableDestStderr</a>(<span class="keywordtype">bool</span> enable) { stderr_ = enable; }</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="classsinga_1_1Channel.html#a1b6759cf2879bc0b42dcfdbf3cfed1f0"> 45</a></span>  <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classsinga_1_1Channel.html#a1b6759cf2879bc0b42dcfdbf3cfed1f0">EnableDestFile</a>(<span class="keywordtype">bool</span> enable) { file_ = enable; }</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordtype">void</span> <a class="code" href="classsinga_1_1Channel.html#a13af9ce49d21bf3b04c198f5580097dd">SetDestFilePath</a>(<span class="keyword">const</span> std::string& file);</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">void</span> <a class="code" href="classsinga_1_1Channel.html#aa951f405d0cf20944afa5a73c2e166f6">Send</a>(<span class="keyword">const</span> std::string& message);</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordtype">void</span> <a class="code" href="classsinga_1_1Channel.html#aa951f405d0cf20944afa5a73c2e166f6">Send</a>(<span class="keyword">const</span> google::protobuf::Message& message);</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  std::string name_ = <span class="stringliteral">""</span>;</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordtype">bool</span> stderr_ = <span class="keyword">false</span>;</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">bool</span> file_ = <span class="keyword">false</span>;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  std::ofstream os_;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> };</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="classsinga_1_1ChannelManager.html"> 61</a></span> <span class="keyword">class </span><a class="code" href="classsinga_1_1ChannelManager.html">ChannelManager</a> {</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <a class="code" href="classsinga_1_1ChannelManager.html">ChannelManager</a>() {}</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  ~<a class="code" href="classsinga_1_1ChannelManager.html">ChannelManager</a>();</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordtype">void</span> Init();</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordtype">void</span> SetDefaultDir(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="classsinga_1_1Channel.html">Channel</a>* GetInstance(<span class="keyword">const</span> std::string& channel);</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  std::string dir_ = <span class="stringliteral">""</span>;</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  std::map<std::string, Channel*> name2ptr_;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span> };</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="keywordtype">void</span> <a class="code" href="namespacesinga.html#a89d23cb2a4ace11df4c98f6912facc5e">InitChannel</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* argv);</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">void</span> <a class="code" href="namespacesinga.html#adc9d8f53816244f6006141817e3b86db">SetChannelDirectory</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* path);</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <a class="code" href="classsinga_1_1Channel.html">Channel</a>* <a class="code" href="namespacesinga.html#a8f76ab8b6f81bc2400f9b8df855f40aa">GetChannel</a>(<span class="keyword">const</span> std::string& channel_name);</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> </div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> } <span class="comment">// namespace singa</span></div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="preprocessor">#endif // SINGA_UTILS_CHANNEL_H__</span></div><div class="ttc" id="classsinga_1_1Channel_html_aba152cf4c1848dacb6a50f351d8bdc99"><div class="ttname"><a href="classsinga_1_1Channel.html#aba152cf4c1848dacb6a50f351d8bdc99">singa::Channel::GetName</a></div><div class="ttdeci">const std::string & GetName()</div><div class="ttdoc">Return the channel name, which is also used for naming the output file. </div><div class="ttdef"><b>Definition:</b> channel.h:41</div></div> |
| <div class="ttc" id="classsinga_1_1Channel_html_aa951f405d0cf20944afa5a73c2e166f6"><div class="ttname"><a href="classsinga_1_1Channel.html#aa951f405d0cf20944afa5a73c2e166f6">singa::Channel::Send</a></div><div class="ttdeci">void Send(const std::string &message)</div><div class="ttdoc">Append a string message. </div></div> |
| <div class="ttc" id="classsinga_1_1ChannelManager_html"><div class="ttname"><a href="classsinga_1_1ChannelManager.html">singa::ChannelManager</a></div><div class="ttdef"><b>Definition:</b> channel.h:61</div></div> |
| <div class="ttc" id="classsinga_1_1Channel_html_ae95a868b2cbce464b2b7e065ab4dfaa7"><div class="ttname"><a href="classsinga_1_1Channel.html#ae95a868b2cbce464b2b7e065ab4dfaa7">singa::Channel::EnableDestStderr</a></div><div class="ttdeci">void EnableDestStderr(bool enable)</div><div class="ttdoc">Disabled by default. </div><div class="ttdef"><b>Definition:</b> channel.h:43</div></div> |
| <div class="ttc" id="classsinga_1_1Channel_html_a1b6759cf2879bc0b42dcfdbf3cfed1f0"><div class="ttname"><a href="classsinga_1_1Channel.html#a1b6759cf2879bc0b42dcfdbf3cfed1f0">singa::Channel::EnableDestFile</a></div><div class="ttdeci">void EnableDestFile(bool enable)</div><div class="ttdoc">Enabled by default. </div><div class="ttdef"><b>Definition:</b> channel.h:45</div></div> |
| <div class="ttc" id="namespacesinga_html_adc9d8f53816244f6006141817e3b86db"><div class="ttname"><a href="namespacesinga.html#adc9d8f53816244f6006141817e3b86db">singa::SetChannelDirectory</a></div><div class="ttdeci">void SetChannelDirectory(const char *path)</div><div class="ttdoc">Set the directory name for persisting channel content. </div></div> |
| <div class="ttc" id="classsinga_1_1Channel_html_a13af9ce49d21bf3b04c198f5580097dd"><div class="ttname"><a href="classsinga_1_1Channel.html#a13af9ce49d21bf3b04c198f5580097dd">singa::Channel::SetDestFilePath</a></div><div class="ttdeci">void SetDestFilePath(const std::string &file)</div><div class="ttdoc">Reset the output file path. </div></div> |
| <div class="ttc" id="classsinga_1_1Channel_html"><div class="ttname"><a href="classsinga_1_1Channel.html">singa::Channel</a></div><div class="ttdoc">Channel for appending metrics or other information into files or screen. </div><div class="ttdef"><b>Definition:</b> channel.h:35</div></div> |
| <div class="ttc" id="namespacesinga_html"><div class="ttname"><a href="namespacesinga.html">singa</a></div><div class="ttdoc">Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...</div><div class="ttdef"><b>Definition:</b> common.h:48</div></div> |
| <div class="ttc" id="namespacesinga_html_a8f76ab8b6f81bc2400f9b8df855f40aa"><div class="ttname"><a href="namespacesinga.html#a8f76ab8b6f81bc2400f9b8df855f40aa">singa::GetChannel</a></div><div class="ttdeci">Channel * GetChannel(const std::string &channel_name)</div><div class="ttdoc">Get the channel instance. </div></div> |
| <div class="ttc" id="namespacesinga_html_a89d23cb2a4ace11df4c98f6912facc5e"><div class="ttname"><a href="namespacesinga.html#a89d23cb2a4ace11df4c98f6912facc5e">singa::InitChannel</a></div><div class="ttdeci">void InitChannel(const char *argv)</div><div class="ttdoc">Initial function for global usage of channel. </div></div> |
| </div><!-- fragment --></div><!-- contents --> |
| <!-- start footer part --> |
| <hr class="footer"/><address class="footer"><small> |
| Generated on Mon Apr 22 2019 12:27:05 for Apache Singa by  <a href="http://www.doxygen.org/index.html"> |
| <img class="footer" src="doxygen.png" alt="doxygen"/> |
| </a> 1.8.13 |
| </small></address> |
| </body> |
| </html> |