123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <!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>TTTT Analysis: /home/caleb/Sources/TTTT/filval/filter.hpp 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">TTTT Analysis
-  <span id="projectnumber">0.1</span>
- </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_b2e1228fdb7fe80fc606210a4045f658.html">filval</a></li> </ul>
- </div>
- </div><!-- top -->
- <div class="header">
- <div class="headertitle">
- <div class="title">filter.hpp</div> </div>
- </div><!--header-->
- <div class="contents">
- <a href="filter_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> </div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor">#ifndef filter_h</span></div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> <span class="preprocessor">#define filter_h</span></div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="preprocessor">#include <iostream></span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="preprocessor">#include <functional></span></div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> <span class="preprocessor">#include "value.hpp"</span></div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="keyword">namespace </span><a class="code" href="namespacefv.html">fv</a> {</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> </div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> <span class="keyword">class </span>ObsFilter : <span class="keyword">public</span> DerivedValue<bool>{</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  Function<bool()>& filter_function;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordtype">void</span> update_value(){</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  value = filter_function();</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  }</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> </div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordtype">void</span> verify_integrity(){ };</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">public</span>:</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  ObsFilter(<span class="keyword">const</span> std::string& name, std::function<<span class="keywordtype">bool</span>()> filter_function, <span class="keyword">const</span> std::string& impl=<span class="stringliteral">""</span>)</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  :DerivedValue<bool>(name),</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  filter_function(GenFunction::register_function<bool()>(<span class="stringliteral">"filter::"</span>+name, filter_function, impl)){ }</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  ObsFilter* operator*(ObsFilter *f){</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keyword">auto</span> new_name = this->get_name() + <span class="stringliteral">"&&"</span> + f->get_name();</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">return</span> <span class="keyword">new</span> ObsFilter(new_name, [<span class="keyword">this</span>, f](){<span class="keywordflow">return</span> this-><a class="code" href="classfv_1_1DerivedValue.html#a39970158aa8f6eb062a28037df6e2128">get_value</a>() && f->get_value();});</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> </div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  ObsFilter* operator+(ObsFilter *f){</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keyword">auto</span> new_name = this->get_name() + <span class="stringliteral">"||"</span> + f->get_name();</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keywordflow">return</span> <span class="keyword">new</span> ObsFilter(new_name, [<span class="keyword">this</span>, f](){<span class="keywordflow">return</span> this-><a class="code" href="classfv_1_1DerivedValue.html#a39970158aa8f6eb062a28037df6e2128">get_value</a>() || f->get_value();});</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>  ObsFilter* operator!(){</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keyword">auto</span> new_name = std::string(<span class="stringliteral">"!("</span>) + this->get_name() + std::string(<span class="stringliteral">")"</span>);</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">return</span> <span class="keyword">new</span> ObsFilter(new_name, [<span class="keyword">this</span>](){<span class="keywordflow">return</span> !this-><a class="code" href="classfv_1_1DerivedValue.html#a39970158aa8f6eb062a28037df6e2128">get_value</a>();});</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  }</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> };</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="keyword">template</span> <<span class="keyword">typename</span> T></div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="keyword">class </span>RangeObsFilter : <span class="keyword">public</span> ObsFilter{</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  RangeObsFilter(<span class="keyword">const</span> std::string name, Value<T>* test_value, T range_low, T range_high):</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  ObsFilter(name, [test_value, range_low, range_high]{</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  T val = test_value->get_value();</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">return</span> (val >= range_low) && (val < range_high);</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  }) { }</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span> };</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> }</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> <span class="preprocessor">#endif // filter_h</span></div><div class="ttc" id="classfv_1_1DerivedValue_html_a39970158aa8f6eb062a28037df6e2128"><div class="ttname"><a href="classfv_1_1DerivedValue.html#a39970158aa8f6eb062a28037df6e2128">fv::DerivedValue< bool >::get_value</a></div><div class="ttdeci">bool & get_value()</div><div class="ttdef"><b>Definition:</b> value.hpp:516</div></div>
- <div class="ttc" id="namespacefv_html"><div class="ttname"><a href="namespacefv.html">fv</a></div><div class="ttdoc">The namespace containing all filval classes and functions. </div><div class="ttdef"><b>Definition:</b> api.hpp:38</div></div>
- </div><!-- fragment --></div><!-- contents -->
- <!-- start footer part -->
- <hr class="footer"/><address class="footer"><small>
- Generated 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>
|