<!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"/> <title>FAUST compiler: blockSchema.cpp Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>blockSchema.cpp</h1><a href="blockSchema_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/************************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> ************************************************************************</span> <a name="l00003"></a>00003 <span class="comment"> FAUST compiler</span> <a name="l00004"></a>00004 <span class="comment"> Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale</span> <a name="l00005"></a>00005 <span class="comment"> ---------------------------------------------------------------------</span> <a name="l00006"></a>00006 <span class="comment"> This program is free software; you can redistribute it and/or modify</span> <a name="l00007"></a>00007 <span class="comment"> it under the terms of the GNU General Public License as published by</span> <a name="l00008"></a>00008 <span class="comment"> the Free Software Foundation; either version 2 of the License, or</span> <a name="l00009"></a>00009 <span class="comment"> (at your option) any later version.</span> <a name="l00010"></a>00010 <span class="comment"></span> <a name="l00011"></a>00011 <span class="comment"> This program is distributed in the hope that it will be useful,</span> <a name="l00012"></a>00012 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00013"></a>00013 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00014"></a>00014 <span class="comment"> GNU General Public License for more details.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment"> You should have received a copy of the GNU General Public License</span> <a name="l00017"></a>00017 <span class="comment"> along with this program; if not, write to the Free Software</span> <a name="l00018"></a>00018 <span class="comment"> Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00019"></a>00019 <span class="comment"> ************************************************************************</span> <a name="l00020"></a>00020 <span class="comment"> ************************************************************************/</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="blockSchema_8h.html">blockSchema.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include <assert.h></span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="keyword">using namespace </span>std; <a name="l00027"></a>00027 <a name="l00028"></a><a class="code" href="blockSchema_8cpp.html#a82783eb82012f45834402b08210d2634">00028</a> <span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code" href="blockSchema_8cpp.html#a82783eb82012f45834402b08210d2634">quantize</a>(<span class="keywordtype">int</span> n) <a name="l00029"></a>00029 { <a name="l00030"></a>00030 <span class="keywordtype">int</span> q = 3; <a name="l00031"></a>00031 <span class="keywordflow">return</span> <a class="code" href="schema_8h.html#ad3489d9399e3efa442157d00b08f900b" title="width of a letter">dLetter</a> * (q *((n+q-1)/q)); <a name="l00032"></a>00032 } <a name="l00033"></a>00033 <a name="l00040"></a><a class="code" href="schema_8h.html#a2958776e5bacb0de30ad6173de5c4503">00040</a> <a class="code" href="classschema.html" title="An abstract block diagram schema.">schema</a>* <a class="code" href="blockSchema_8cpp.html#a4f795fe515331bbaed4f661d1fb2591a" title="Build a simple colored blockSchema with a certain number of inputs and outputs, a...">makeBlockSchema</a> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputs, <a name="l00041"></a>00041 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputs, <a name="l00042"></a>00042 <span class="keyword">const</span> <span class="keywordtype">string</span>& text, <a name="l00043"></a>00043 <span class="keyword">const</span> <span class="keywordtype">string</span>& color, <a name="l00044"></a>00044 <span class="keyword">const</span> <span class="keywordtype">string</span>& link ) <a name="l00045"></a>00045 { <a name="l00046"></a>00046 <span class="comment">// determine the optimal size of the box</span> <a name="l00047"></a>00047 <span class="keywordtype">double</span> minimal = 3*<a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>; <a name="l00048"></a>00048 <span class="keywordtype">double</span> w = 2*<a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a> + <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>( minimal, <a class="code" href="blockSchema_8cpp.html#a82783eb82012f45834402b08210d2634">quantize</a>(text.size()) ); <a name="l00049"></a>00049 <span class="keywordtype">double</span> h = 2*<a class="code" href="schema_8h.html#aa0adc663ea7e3401767e9b3e76c63a7b" title="marge verticale">dVert</a> + <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>( minimal, <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>(inputs, outputs) * <a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a> ); <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classblockSchema.html" title="A simple rectangular box with a text and inputs and outputs.">blockSchema</a>(inputs, outputs, w, h, text, color, link); <a name="l00052"></a>00052 } <a name="l00053"></a>00053 <a name="l00060"></a><a class="code" href="classblockSchema.html#acb6a21b650f8796dbff2d3482cf72a4f">00060</a> <a class="code" href="classblockSchema.html#acb6a21b650f8796dbff2d3482cf72a4f" title="Build a simple colored blockSchema with a certain number of inputs and outputs, a...">blockSchema::blockSchema</a> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputs, <a name="l00061"></a>00061 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputs, <a name="l00062"></a>00062 <span class="keywordtype">double</span> width, <a name="l00063"></a>00063 <span class="keywordtype">double</span> height, <a name="l00064"></a>00064 <span class="keyword">const</span> <span class="keywordtype">string</span>& text, <a name="l00065"></a>00065 <span class="keyword">const</span> <span class="keywordtype">string</span>& color, <a name="l00066"></a>00066 <span class="keyword">const</span> <span class="keywordtype">string</span>& link ) <a name="l00067"></a>00067 <a name="l00068"></a>00068 : <a class="code" href="classschema.html" title="An abstract block diagram schema.">schema</a>( inputs, outputs, width, height ), <a name="l00069"></a>00069 fText(text), <a name="l00070"></a>00070 fColor(color), <a name="l00071"></a>00071 fLink(link) <a name="l00072"></a>00072 { <a name="l00073"></a>00073 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<inputs; i++) <a class="code" href="classblockSchema.html#ac84b43b0f936d2d1a9c14601ccb1f21c" title="input connection points">fInputPoint</a>.push_back(<a class="code" href="structpoint.html">point</a>(0)); <a name="l00074"></a>00074 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<outputs; i++) <a class="code" href="classblockSchema.html#a5f647b14444c1a95336dc0e64d7036d2" title="output connection points">fOutputPoint</a>.push_back(<a class="code" href="structpoint.html">point</a>(0)); <a name="l00075"></a>00075 } <a name="l00076"></a>00076 <a name="l00082"></a><a class="code" href="classblockSchema.html#ac5e9e5fae7ab1544475cdc9cabec6411">00082</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#ac5e9e5fae7ab1544475cdc9cabec6411" title="Define the graphic position of the blockSchema.">blockSchema::place</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y, <span class="keywordtype">int</span> orientation) <a name="l00083"></a>00083 { <a name="l00084"></a>00084 <a class="code" href="classschema.html#a84e7eb74cb2a656495a93985db7d5c9d">beginPlace</a>(x, y, orientation); <a name="l00085"></a>00085 <a name="l00086"></a>00086 <a class="code" href="classblockSchema.html#a9fcbf30df9481a8407d1491ed322e42e" title="Computes the input points according to the position and the orientation of the blockSchema...">placeInputPoints</a>(); <a name="l00087"></a>00087 <a class="code" href="classblockSchema.html#a9093cc787459218f88502db264b8af71" title="Computes the output points according to the position and the orientation of the blockSchema...">placeOutputPoints</a>(); <a name="l00088"></a>00088 <a name="l00089"></a>00089 <a class="code" href="classschema.html#ad579c7aebc79bfbed5f73b35c399ff83">endPlace</a>(); <a name="l00090"></a>00090 } <a name="l00091"></a>00091 <a name="l00095"></a><a class="code" href="classblockSchema.html#afcc617bef891e0db47fa4ce4835e319e">00095</a> <a class="code" href="structpoint.html">point</a> <a class="code" href="classblockSchema.html#afcc617bef891e0db47fa4ce4835e319e" title="Returns an input point.">blockSchema::inputPoint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)<span class="keyword"> const</span> <a name="l00096"></a>00096 <span class="keyword"></span>{ <a name="l00097"></a>00097 assert (<a class="code" href="classschema.html#a8c432179c626462d041ce2d8c68ef875">placed</a>()); <a name="l00098"></a>00098 assert (i < <a class="code" href="classschema.html#ac0d35106760b7d113718e9ee9d02e108">inputs</a>()); <a name="l00099"></a>00099 <span class="keywordflow">return</span> <a class="code" href="classblockSchema.html#ac84b43b0f936d2d1a9c14601ccb1f21c" title="input connection points">fInputPoint</a>[i]; <a name="l00100"></a>00100 } <a name="l00101"></a>00101 <a name="l00105"></a><a class="code" href="classblockSchema.html#ab8aa4b475441fc6872f1d6265333dcf5">00105</a> <a class="code" href="structpoint.html">point</a> <a class="code" href="classblockSchema.html#ab8aa4b475441fc6872f1d6265333dcf5" title="Returns an output point.">blockSchema::outputPoint</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)<span class="keyword"> const</span> <a name="l00106"></a>00106 <span class="keyword"></span>{ <a name="l00107"></a>00107 assert (<a class="code" href="classschema.html#a8c432179c626462d041ce2d8c68ef875">placed</a>()); <a name="l00108"></a>00108 assert (i < <a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>()); <a name="l00109"></a>00109 <span class="keywordflow">return</span> <a class="code" href="classblockSchema.html#a5f647b14444c1a95336dc0e64d7036d2" title="output connection points">fOutputPoint</a>[i]; <a name="l00110"></a>00110 } <a name="l00111"></a>00111 <a name="l00116"></a><a class="code" href="classblockSchema.html#a9fcbf30df9481a8407d1491ed322e42e">00116</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#a9fcbf30df9481a8407d1491ed322e42e" title="Computes the input points according to the position and the orientation of the blockSchema...">blockSchema::placeInputPoints</a>() <a name="l00117"></a>00117 { <a name="l00118"></a>00118 <span class="keywordtype">int</span> N = <a class="code" href="classschema.html#ac0d35106760b7d113718e9ee9d02e108">inputs</a>(); <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="keywordflow">if</span> (<a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>() == <a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>) { <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="keywordtype">double</span> px = <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>(); <a name="l00123"></a>00123 <span class="keywordtype">double</span> py = <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + (<a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - <a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>*(N-1))/2; <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<N; i++) { <a name="l00126"></a>00126 <a class="code" href="classblockSchema.html#ac84b43b0f936d2d1a9c14601ccb1f21c" title="input connection points">fInputPoint</a>[i] = <a class="code" href="structpoint.html">point</a>(px, py+i*<a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>); <a name="l00127"></a>00127 } <a name="l00128"></a>00128 <a name="l00129"></a>00129 } <span class="keywordflow">else</span> { <a name="l00130"></a>00130 <a name="l00131"></a>00131 <span class="keywordtype">double</span> px = <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>() + <a class="code" href="classschema.html#aa598f06d50f5cee518892c572453cf67">width</a>(); <a name="l00132"></a>00132 <span class="keywordtype">double</span> py = <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + <a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - (<a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - <a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>*(N-1))/2; <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<N; i++) { <a name="l00135"></a>00135 <a class="code" href="classblockSchema.html#ac84b43b0f936d2d1a9c14601ccb1f21c" title="input connection points">fInputPoint</a>[i] = <a class="code" href="structpoint.html">point</a>(px, py-i*<a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>); <a name="l00136"></a>00136 } <a name="l00137"></a>00137 } <a name="l00138"></a>00138 } <a name="l00139"></a>00139 <a name="l00140"></a>00140 <a name="l00145"></a><a class="code" href="classblockSchema.html#a9093cc787459218f88502db264b8af71">00145</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#a9093cc787459218f88502db264b8af71" title="Computes the output points according to the position and the orientation of the blockSchema...">blockSchema::placeOutputPoints</a>() <a name="l00146"></a>00146 { <a name="l00147"></a>00147 <span class="keywordtype">int</span> N = <a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>(); <a name="l00148"></a>00148 <a name="l00149"></a>00149 <span class="keywordflow">if</span> (<a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>() == <a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>) { <a name="l00150"></a>00150 <a name="l00151"></a>00151 <span class="keywordtype">double</span> px = <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>() + <a class="code" href="classschema.html#aa598f06d50f5cee518892c572453cf67">width</a>(); <a name="l00152"></a>00152 <span class="keywordtype">double</span> py = <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + (<a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - <a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>*(N-1))/2; <a name="l00153"></a>00153 <a name="l00154"></a>00154 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<N; i++) { <a name="l00155"></a>00155 <a class="code" href="classblockSchema.html#a5f647b14444c1a95336dc0e64d7036d2" title="output connection points">fOutputPoint</a>[i] = <a class="code" href="structpoint.html">point</a>(px, py + i*<a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>); <a name="l00156"></a>00156 } <a name="l00157"></a>00157 <a name="l00158"></a>00158 } <span class="keywordflow">else</span> { <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="keywordtype">double</span> px = <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>(); <a name="l00161"></a>00161 <span class="keywordtype">double</span> py = <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + <a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - (<a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - <a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>*(N-1))/2; <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<N; i++) { <a name="l00164"></a>00164 <a class="code" href="classblockSchema.html#a5f647b14444c1a95336dc0e64d7036d2" title="output connection points">fOutputPoint</a>[i] = <a class="code" href="structpoint.html">point</a>(px, py - i*<a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a>); <a name="l00165"></a>00165 } <a name="l00166"></a>00166 } <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a>00169 <a name="l00174"></a><a class="code" href="classblockSchema.html#ac1293be3cac96a1f38daf9311eecd310">00174</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#ac1293be3cac96a1f38daf9311eecd310" title="Draw the blockSchema on the device.">blockSchema::draw</a>(<a class="code" href="classdevice.html">device</a>& dev) <a name="l00175"></a>00175 { <a name="l00176"></a>00176 assert(<a class="code" href="classschema.html#a8c432179c626462d041ce2d8c68ef875">placed</a>()); <a name="l00177"></a>00177 <a name="l00178"></a>00178 <a class="code" href="classblockSchema.html#aa68a8f26bf74adfcffe17367844ec78d" title="Draw the colored rectangle with the optional link.">drawRectangle</a>(dev); <a name="l00179"></a>00179 <a class="code" href="classblockSchema.html#aff8ec665e1575c6e3124c1eb51c280e2" title="Draw the text centered on the box.">drawText</a>(dev); <a name="l00180"></a>00180 <a class="code" href="classblockSchema.html#a84ca7ddceccaa4187463f0b1b5aa9e0a" title="Draw the orientation mark, a small point that indicates the first input (like integrated...">drawOrientationMark</a>(dev); <a name="l00181"></a>00181 <a class="code" href="classblockSchema.html#a6d96ceeba426d39dba0644ab0d6d765c" title="Draw horizontal arrows from the input points to the blockSchema rectangle.">drawInputWires</a>(dev); <a name="l00182"></a>00182 <a class="code" href="classblockSchema.html#a0066a78c1d214fdf347190904112fefe" title="Draw horizontal line from the blockSchema rectangle to the output points.">drawOutputWires</a>(dev); <a name="l00183"></a>00183 } <a name="l00184"></a>00184 <a name="l00188"></a><a class="code" href="classblockSchema.html#aa68a8f26bf74adfcffe17367844ec78d">00188</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#aa68a8f26bf74adfcffe17367844ec78d" title="Draw the colored rectangle with the optional link.">blockSchema::drawRectangle</a>(<a class="code" href="classdevice.html">device</a>& dev) <a name="l00189"></a>00189 { <a name="l00190"></a>00190 dev.<a class="code" href="classdevice.html#af5bf15228fed032fe21c0692153be25a">rect</a>( <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>() + <a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a>, <a name="l00191"></a>00191 <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + <a class="code" href="schema_8h.html#aa0adc663ea7e3401767e9b3e76c63a7b" title="marge verticale">dVert</a>, <a name="l00192"></a>00192 <a class="code" href="classschema.html#aa598f06d50f5cee518892c572453cf67">width</a>() - 2*<a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a>, <a name="l00193"></a>00193 <a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - 2*<a class="code" href="schema_8h.html#aa0adc663ea7e3401767e9b3e76c63a7b" title="marge verticale">dVert</a>, <a name="l00194"></a>00194 <a class="code" href="classblockSchema.html#a70fa61dfe8650572d7e780c231fba34f" title="color of the box">fColor</a>.c_str(), <a name="l00195"></a>00195 <a class="code" href="classblockSchema.html#aa83f85ff246d8c3b060057f6dbfe3a94" title="option URL link">fLink</a>.c_str() <a name="l00196"></a>00196 ); <a name="l00197"></a>00197 } <a name="l00198"></a>00198 <a name="l00199"></a>00199 <a name="l00203"></a><a class="code" href="classblockSchema.html#aff8ec665e1575c6e3124c1eb51c280e2">00203</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#aff8ec665e1575c6e3124c1eb51c280e2" title="Draw the text centered on the box.">blockSchema::drawText</a>(<a class="code" href="classdevice.html">device</a>& dev) <a name="l00204"></a>00204 { <a name="l00205"></a>00205 dev.<a class="code" href="classdevice.html#a4aec578878db9551e5538639d6b0339d">text</a>( <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>() + <a class="code" href="classschema.html#aa598f06d50f5cee518892c572453cf67">width</a>()/2, <a name="l00206"></a>00206 <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + <a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>()/2, <a name="l00207"></a>00207 <a class="code" href="classblockSchema.html#a04b7572fa7a39a8bf1f9c77ab029ccb8" title="Text to be displayed.">fText</a>.c_str() <a name="l00208"></a>00208 ); <a name="l00209"></a>00209 } <a name="l00210"></a>00210 <a name="l00215"></a><a class="code" href="classblockSchema.html#a84ca7ddceccaa4187463f0b1b5aa9e0a">00215</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#a84ca7ddceccaa4187463f0b1b5aa9e0a" title="Draw the orientation mark, a small point that indicates the first input (like integrated...">blockSchema::drawOrientationMark</a>(<a class="code" href="classdevice.html">device</a>& dev) <a name="l00216"></a>00216 { <a name="l00217"></a>00217 <span class="keywordtype">double</span> px, py; <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="keywordflow">if</span> (<a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>() == <a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>) { <a name="l00220"></a>00220 px = <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>() + <a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a>; <a name="l00221"></a>00221 py = <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + <a class="code" href="schema_8h.html#aa0adc663ea7e3401767e9b3e76c63a7b" title="marge verticale">dVert</a>; <a name="l00222"></a>00222 } <span class="keywordflow">else</span> { <a name="l00223"></a>00223 px = <a class="code" href="classschema.html#a120e106abe224a0e9170565edffa106a">x</a>() + <a class="code" href="classschema.html#aa598f06d50f5cee518892c572453cf67">width</a>() - <a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a>; <a name="l00224"></a>00224 py = <a class="code" href="classschema.html#a82c4e6b273c7e48607f3bbf44d5b2c27">y</a>() + <a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - <a class="code" href="schema_8h.html#aa0adc663ea7e3401767e9b3e76c63a7b" title="marge verticale">dVert</a>; <a name="l00225"></a>00225 } <a name="l00226"></a>00226 <a name="l00227"></a>00227 dev.<a class="code" href="classdevice.html#a3c59d783b2377769785e63d105b54095">markSens</a>( px, py, <a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>() ); <a name="l00228"></a>00228 } <a name="l00229"></a>00229 <a name="l00234"></a><a class="code" href="classblockSchema.html#a6d96ceeba426d39dba0644ab0d6d765c">00234</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#a6d96ceeba426d39dba0644ab0d6d765c" title="Draw horizontal arrows from the input points to the blockSchema rectangle.">blockSchema::drawInputWires</a>(<a class="code" href="classdevice.html">device</a>& dev) <a name="l00235"></a>00235 { <a name="l00236"></a>00236 <span class="keywordtype">double</span> dx = (<a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>() == <a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>) ? <a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a> : -<a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a>; <a name="l00237"></a>00237 <a name="l00238"></a>00238 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<<a class="code" href="classschema.html#ac0d35106760b7d113718e9ee9d02e108">inputs</a>(); i++) { <a name="l00239"></a>00239 <a class="code" href="structpoint.html">point</a> p = <a class="code" href="classblockSchema.html#ac84b43b0f936d2d1a9c14601ccb1f21c" title="input connection points">fInputPoint</a>[i]; <a name="l00240"></a>00240 dev.<a class="code" href="classdevice.html#a9fa8ce6f7449c3120908e75880f6b4e4">trait</a>(p.<a class="code" href="structpoint.html#a9c6b34deaf4900ad4193c17935fd384a">x</a>, p.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>, p.<a class="code" href="structpoint.html#a9c6b34deaf4900ad4193c17935fd384a">x</a>+dx, p.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>); <a name="l00241"></a>00241 dev.<a class="code" href="classdevice.html#ae9ee5d3dfc45b2816828430cf8b4f19c">fleche</a>(p.<a class="code" href="structpoint.html#a9c6b34deaf4900ad4193c17935fd384a">x</a>+dx, p.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>, 0, <a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>()); <a name="l00242"></a>00242 } <a name="l00243"></a>00243 } <a name="l00244"></a>00244 <a name="l00249"></a><a class="code" href="classblockSchema.html#a0066a78c1d214fdf347190904112fefe">00249</a> <span class="keywordtype">void</span> <a class="code" href="classblockSchema.html#a0066a78c1d214fdf347190904112fefe" title="Draw horizontal line from the blockSchema rectangle to the output points.">blockSchema::drawOutputWires</a>(<a class="code" href="classdevice.html">device</a>& dev) <a name="l00250"></a>00250 { <a name="l00251"></a>00251 <span class="keywordtype">double</span> dx = (<a class="code" href="classschema.html#a929b2d9ad9fabd5f41623cbfce72c1d3">orientation</a>() == <a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>) ? <a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a> : -<a class="code" href="schema_8h.html#a9d883e2a1657d36b7ac2e2b18caa109f" title="marge horizontale">dHorz</a>; <a name="l00252"></a>00252 <a name="l00253"></a>00253 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i<<a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>(); i++) { <a name="l00254"></a>00254 <a class="code" href="structpoint.html">point</a> p = <a class="code" href="classblockSchema.html#a5f647b14444c1a95336dc0e64d7036d2" title="output connection points">fOutputPoint</a>[i]; <a name="l00255"></a>00255 dev.<a class="code" href="classdevice.html#a9fa8ce6f7449c3120908e75880f6b4e4">trait</a>(p.<a class="code" href="structpoint.html#a9c6b34deaf4900ad4193c17935fd384a">x</a>, p.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>, p.<a class="code" href="structpoint.html#a9c6b34deaf4900ad4193c17935fd384a">x</a>-dx, p.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>); <a name="l00256"></a>00256 } <a name="l00257"></a>00257 } <a name="l00258"></a>00258 <a name="l00259"></a>00259 </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Apr 28 23:59:58 2010 for FAUST compiler by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>