<!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: seqSchema.cpp File Reference</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> </div> <div class="contents"> <h1>seqSchema.cpp File Reference</h1><code>#include "<a class="el" href="seqSchema_8cpp_source.html">seqSchema.h</a>"</code><br/> <code>#include "<a class="el" href="schema_8h_source.html">schema.h</a>"</code><br/> <code>#include <iostream></code><br/> <code>#include <assert.h></code><br/> <div class="dynheader"> Include dependency graph for seqSchema.cpp:</div> <div class="dynsection"> </div> <div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dynsection"> </div> <p><a href="seqSchema_8cpp_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Enumerations</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom">{ <a class="el" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a1b3d50e6be47ce8f8e6e8f955018bc00">kHorDir</a>, <a class="el" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5acba44df569a8148c0168036959ce8f3c">kUpDir</a>, <a class="el" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a5f95a53682f5604ce8e44a4c9330f0c3">kDownDir</a> }</td></tr> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static double </td><td class="memItemRight" valign="bottom"><a class="el" href="seqSchema_8cpp.html#aca44d85b44abd6505d868bcdab933d1c">computeHorzGap</a> (<a class="el" href="classschema.html">schema</a> *a, <a class="el" href="classschema.html">schema</a> *b)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the horizontal gap needed to draw the internal wires. <a href="#aca44d85b44abd6505d868bcdab933d1c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="seqSchema_8cpp.html#acf436182adf0ee5748df99c826ca6834">direction</a> (const <a class="el" href="structpoint.html">point</a> &a, const <a class="el" href="structpoint.html">point</a> &b)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the direction of a connection. <a href="#acf436182adf0ee5748df99c826ca6834"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classschema.html">schema</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="seqSchema_8cpp.html#aee99b4bfcc6a9f9ab9c91af512e5daee">makeSeqSchema</a> (<a class="el" href="classschema.html">schema</a> *s1, <a class="el" href="classschema.html">schema</a> *s2)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Make a sequential schema. <a href="#aee99b4bfcc6a9f9ab9c91af512e5daee"></a><br/></td></tr> </table> <hr/><h2>Enumeration Type Documentation</h2> <a class="anchor" id="a99fb83031ce9923c84392b4e92f956b5"></a><!-- doxytag: member="seqSchema.cpp::@2" ref="a99fb83031ce9923c84392b4e92f956b5" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">anonymous enum</td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><em><a class="anchor" id="a99fb83031ce9923c84392b4e92f956b5a1b3d50e6be47ce8f8e6e8f955018bc00"></a><!-- doxytag: member="kHorDir" ref="a99fb83031ce9923c84392b4e92f956b5a1b3d50e6be47ce8f8e6e8f955018bc00" args="" -->kHorDir</em> </td><td> </td></tr> <tr><td valign="top"><em><a class="anchor" id="a99fb83031ce9923c84392b4e92f956b5acba44df569a8148c0168036959ce8f3c"></a><!-- doxytag: member="kUpDir" ref="a99fb83031ce9923c84392b4e92f956b5acba44df569a8148c0168036959ce8f3c" args="" -->kUpDir</em> </td><td> </td></tr> <tr><td valign="top"><em><a class="anchor" id="a99fb83031ce9923c84392b4e92f956b5a5f95a53682f5604ce8e44a4c9330f0c3"></a><!-- doxytag: member="kDownDir" ref="a99fb83031ce9923c84392b4e92f956b5a5f95a53682f5604ce8e44a4c9330f0c3" args="" -->kDownDir</em> </td><td> </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="seqSchema_8cpp_source.html#l00029">29</a> of file <a class="el" href="seqSchema_8cpp_source.html">seqSchema.cpp</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00029"></a>00029 {<a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a1b3d50e6be47ce8f8e6e8f955018bc00">kHorDir</a>, <a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5acba44df569a8148c0168036959ce8f3c">kUpDir</a>, <a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a5f95a53682f5604ce8e44a4c9330f0c3">kDownDir</a>}; </pre></div></p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="aca44d85b44abd6505d868bcdab933d1c"></a><!-- doxytag: member="seqSchema.cpp::computeHorzGap" ref="aca44d85b44abd6505d868bcdab933d1c" args="(schema *a, schema *b)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static double computeHorzGap </td> <td>(</td> <td class="paramtype"><a class="el" href="classschema.html">schema</a> * </td> <td class="paramname"> <em>a</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classschema.html">schema</a> * </td> <td class="paramname"> <em>b</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Compute the horizontal gap needed to draw the internal wires. </p> <p>It depends on the largest group of connections that go in the same direction. </p> <p>Definition at line <a class="el" href="seqSchema_8cpp_source.html#l00230">230</a> of file <a class="el" href="seqSchema_8cpp_source.html">seqSchema.cpp</a>.</p> <p>References <a class="el" href="seqSchema_8cpp_source.html#l00218">direction()</a>, <a class="el" href="schema_8h_source.html#l00032">dWire</a>, <a class="el" href="schema_8h_source.html#l00086">schema::height()</a>, <a class="el" href="classschema.html#a6b533651c7b65aeec424762c42777bd8">schema::inputPoint()</a>, <a class="el" href="schema_8h_source.html#l00087">schema::inputs()</a>, <a class="el" href="seqSchema_8cpp_source.html#l00029">kDownDir</a>, <a class="el" href="schema_8h_source.html#l00050">kLeftRight</a>, <a class="el" href="seqSchema_8cpp_source.html#l00029">kUpDir</a>, <a class="el" href="interval_8hh_source.html#l00060">max()</a>, <a class="el" href="classschema.html#a9521bca5db264dfdd0f523e1c3c03263">schema::outputPoint()</a>, <a class="el" href="schema_8h_source.html#l00088">schema::outputs()</a>, and <a class="el" href="classschema.html#aa3ef082636956bead276445f203259a4">schema::place()</a>.</p> <p>Referenced by <a class="el" href="seqSchema_8cpp_source.html#l00043">makeSeqSchema()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00231"></a>00231 { <a name="l00232"></a>00232 assert(a-><a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>() == b-><a class="code" href="classschema.html#ac0d35106760b7d113718e9ee9d02e108">inputs</a>()); <a name="l00233"></a>00233 <a name="l00234"></a>00234 <span class="keywordflow">if</span> (a-><a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>() == 0) { <a name="l00235"></a>00235 <span class="keywordflow">return</span> 0; <a name="l00236"></a>00236 } <span class="keywordflow">else</span> { <a name="l00237"></a>00237 <span class="comment">// store here the size of the largest group for each direction</span> <a name="l00238"></a>00238 <span class="keywordtype">int</span> MaxGroupSize[3]; <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<3; i++) MaxGroupSize[i]=0; <a name="l00239"></a>00239 <a name="l00240"></a>00240 <span class="comment">// place a and b to have valid connection points</span> <a name="l00241"></a>00241 <span class="keywordtype">double</span> ya = <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>(0.0, 0.5*(b-><a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - a-><a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>())); <a name="l00242"></a>00242 <span class="keywordtype">double</span> yb = <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>(0.0, 0.5*(a-><a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>() - b-><a class="code" href="classschema.html#acd72d5b630acd4eadf3f856aa6176c99">height</a>())); <a name="l00243"></a>00243 a-><a class="code" href="classschema.html#aa3ef082636956bead276445f203259a4">place</a>(0,ya,<a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>); <a name="l00244"></a>00244 b-><a class="code" href="classschema.html#aa3ef082636956bead276445f203259a4">place</a>(0,yb,<a class="code" href="schema_8h.html#adf764cbdea00d65edcd07bb9953ad2b7ad0e4d4a0baf519fc3f4a41e2d30f4e96">kLeftRight</a>); <a name="l00245"></a>00245 <a name="l00246"></a>00246 <span class="comment">// init current group direction and size</span> <a name="l00247"></a>00247 <span class="keywordtype">int</span> gdir = <a class="code" href="seqSchema_8cpp.html#acf436182adf0ee5748df99c826ca6834" title="Compute the direction of a connection.">direction</a>(a-><a class="code" href="classschema.html#a9521bca5db264dfdd0f523e1c3c03263">outputPoint</a>(0), b-><a class="code" href="classschema.html#a6b533651c7b65aeec424762c42777bd8">inputPoint</a>(0)); <a name="l00248"></a>00248 <span class="keywordtype">int</span> gsize = 1; <a name="l00249"></a>00249 <a name="l00250"></a>00250 <span class="comment">// analyze direction of remaining points</span> <a name="l00251"></a>00251 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=1; i<a-><a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>(); i++) { <a name="l00252"></a>00252 <span class="keywordtype">int</span> d = <a class="code" href="seqSchema_8cpp.html#acf436182adf0ee5748df99c826ca6834" title="Compute the direction of a connection.">direction</a>(a-><a class="code" href="classschema.html#a9521bca5db264dfdd0f523e1c3c03263">outputPoint</a>(i), b-><a class="code" href="classschema.html#a6b533651c7b65aeec424762c42777bd8">inputPoint</a>(i)); <a name="l00253"></a>00253 <span class="keywordflow">if</span> (d == gdir) { <a name="l00254"></a>00254 gsize++; <a name="l00255"></a>00255 } <span class="keywordflow">else</span> { <a name="l00256"></a>00256 <span class="keywordflow">if</span> (gsize > MaxGroupSize[gdir]) MaxGroupSize[gdir]=gsize; <a name="l00257"></a>00257 gsize = 1; <a name="l00258"></a>00258 gdir = d; <a name="l00259"></a>00259 } <a name="l00260"></a>00260 } <a name="l00261"></a>00261 <a name="l00262"></a>00262 <span class="comment">// update for last group</span> <a name="l00263"></a>00263 <span class="keywordflow">if</span> (gsize > MaxGroupSize[gdir]) MaxGroupSize[gdir]=gsize; <a name="l00264"></a>00264 <a name="l00265"></a>00265 <span class="comment">// the gap required for the connections</span> <a name="l00266"></a>00266 <span class="keywordflow">return</span> <a class="code" href="schema_8h.html#a30d1c9623bb68689e23907427368ed1f" title="distance between two wires">dWire</a> * <a class="code" href="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>(MaxGroupSize[<a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5acba44df569a8148c0168036959ce8f3c">kUpDir</a>],MaxGroupSize[<a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a5f95a53682f5604ce8e44a4c9330f0c3">kDownDir</a>]); <a name="l00267"></a>00267 } <a name="l00268"></a>00268 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="acf436182adf0ee5748df99c826ca6834"></a><!-- doxytag: member="seqSchema.cpp::direction" ref="acf436182adf0ee5748df99c826ca6834" args="(const point &a, const point &b)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int direction </td> <td>(</td> <td class="paramtype">const <a class="el" href="structpoint.html">point</a> & </td> <td class="paramname"> <em>a</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structpoint.html">point</a> & </td> <td class="paramname"> <em>b</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Compute the direction of a connection. </p> <p>Note that Y axis goes from top to bottom </p> <p>Definition at line <a class="el" href="seqSchema_8cpp_source.html#l00218">218</a> of file <a class="el" href="seqSchema_8cpp_source.html">seqSchema.cpp</a>.</p> <p>References <a class="el" href="seqSchema_8cpp_source.html#l00029">kDownDir</a>, <a class="el" href="seqSchema_8cpp_source.html#l00029">kHorDir</a>, <a class="el" href="seqSchema_8cpp_source.html#l00029">kUpDir</a>, and <a class="el" href="schema_8h_source.html#l00042">point::y</a>.</p> <p>Referenced by <a class="el" href="seqSchema_8cpp_source.html#l00230">computeHorzGap()</a>, and <a class="el" href="seqSchema_8cpp_source.html#l00141">seqSchema::drawInternalWires()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00219"></a>00219 { <a name="l00220"></a>00220 <span class="keywordflow">if</span> (a.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a> > b.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>) <span class="keywordflow">return</span> <a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5acba44df569a8148c0168036959ce8f3c">kUpDir</a>; <span class="comment">// upward connections</span> <a name="l00221"></a>00221 <span class="keywordflow">if</span> (a.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a> < b.<a class="code" href="structpoint.html#a613f8f0d7352731638b0094e1b958b87">y</a>) <span class="keywordflow">return</span> <a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a5f95a53682f5604ce8e44a4c9330f0c3">kDownDir</a>; <span class="comment">// downward connection</span> <a name="l00222"></a>00222 <span class="keywordflow">return</span> <a class="code" href="seqSchema_8cpp.html#a99fb83031ce9923c84392b4e92f956b5a1b3d50e6be47ce8f8e6e8f955018bc00">kHorDir</a>; <span class="comment">// horizontal connections</span> <a name="l00223"></a>00223 } </pre></div></p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="aee99b4bfcc6a9f9ab9c91af512e5daee"></a><!-- doxytag: member="seqSchema.cpp::makeSeqSchema" ref="aee99b4bfcc6a9f9ab9c91af512e5daee" args="(schema *s1, schema *s2)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classschema.html">schema</a>* makeSeqSchema </td> <td>(</td> <td class="paramtype"><a class="el" href="classschema.html">schema</a> * </td> <td class="paramname"> <em>s1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classschema.html">schema</a> * </td> <td class="paramname"> <em>s2</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Make a sequential schema. </p> <p>May add cables to ensure the internal connections are between the same number of outputs and inputs. Compute an horizontal gap based on the number of upward and downward connections. </p> <p>Definition at line <a class="el" href="seqSchema_8cpp_source.html#l00043">43</a> of file <a class="el" href="seqSchema_8cpp_source.html">seqSchema.cpp</a>.</p> <p>References <a class="el" href="seqSchema_8cpp_source.html#l00230">computeHorzGap()</a>, <a class="el" href="schema_8h_source.html#l00087">schema::inputs()</a>, <a class="el" href="cableSchema_8cpp_source.html#l00032">makeCableSchema()</a>, <a class="el" href="parSchema_8cpp_source.html#l00028">makeParSchema()</a>, and <a class="el" href="schema_8h_source.html#l00088">schema::outputs()</a>.</p> <p>Referenced by <a class="el" href="drawschema_8cpp_source.html#l00491">generateAbstractionSchema()</a>, and <a class="el" href="drawschema_8cpp_source.html#l00358">generateInsideSchema()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00044"></a>00044 { <a name="l00045"></a>00045 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> o = s1-><a class="code" href="classschema.html#a217dc5df9996203d3ea0521c84c38567">outputs</a>(); <a name="l00046"></a>00046 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = s2-><a class="code" href="classschema.html#ac0d35106760b7d113718e9ee9d02e108">inputs</a>(); <a name="l00047"></a>00047 <a name="l00048"></a>00048 <a class="code" href="classschema.html" title="An abstract block diagram schema.">schema</a>* a = (o < i) ? <a class="code" href="parSchema_8cpp.html#aedc4f34e04691a4368884450608b5721">makeParSchema</a>(s1, <a class="code" href="cableSchema_8cpp.html#aa5b7242ed5c2ea862d01978390a1bdda" title="Build n cables in parallel.">makeCableSchema</a>(i-o)) : s1; <a name="l00049"></a>00049 <a class="code" href="classschema.html" title="An abstract block diagram schema.">schema</a>* b = (o > i) ? <a class="code" href="parSchema_8cpp.html#aedc4f34e04691a4368884450608b5721">makeParSchema</a>(s2, <a class="code" href="cableSchema_8cpp.html#aa5b7242ed5c2ea862d01978390a1bdda" title="Build n cables in parallel.">makeCableSchema</a>(o-i)) : s2; <a name="l00050"></a>00050 <a name="l00051"></a>00051 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classseqSchema.html" title="Sequential composition.">seqSchema</a>(a, b, <a class="code" href="seqSchema_8cpp.html#aca44d85b44abd6505d868bcdab933d1c" title="Compute the horizontal gap needed to draw the internal wires.">computeHorzGap</a>(a,b)); <a name="l00052"></a>00052 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:11 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>