Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 54cac1c2268db633d66eeff1b4faa585 > files > 489

frepple-doc-0.8.1-3.fc15.noarch.rpm

<!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>C++ API frePPLe: flowplan.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="../styles.css" rel="stylesheet"  type="text/css">
</head>
<body>
<div id="container">

<div id="menubar"> 
<div id="logo" align="center">
<br/><img src='../frepple.bmp' alt="frepple" /><br/>
<a href='http://www.frepple.com/'>
<strong>a Free<br/>Production Planning<br/>Library</strong>
</a>
</div>
<div id="menu">
<br/>
<h3><a href='../Main/HomePage.html'>Main</a></h3>
<h3><a href='../UI/Main.html'>User Manual</a></h3>
<h3><a href='../Tutorial/Main.html'>Tutorial</a></h3>
<h3><a href='../Frepple/Main.html'>Reference Manual</a></h3>
<h3><a href='../Main/FAQ.html'>FAQ</a></h3>
<h3><a href='index.html'>C++ API</a></h3>
<br/>
</div>  
</div>

<div id="content">
<br/>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</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>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_88117dff2735251a69c8eb9084477714.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_25032d30b6d615a661c02e2ac1394b01.html">model</a>
  </div>
</div>
<div class="contents">
<h1>flowplan.cpp</h1><a href="a00202.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">  file : $URL: https://frepple.svn.sourceforge.net/svnroot/frepple/trunk/src/model/flowplan.cpp $</span>
<a name="l00003"></a>00003 <span class="comment">  version : $LastChangedRevision: 1315 $  $LastChangedBy: jdetaeye $</span>
<a name="l00004"></a>00004 <span class="comment">  date : $LastChangedDate: 2010-07-17 18:08:53 +0200 (Sat, 17 Jul 2010) $</span>
<a name="l00005"></a>00005 <span class="comment"> ***************************************************************************/</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="comment">/***************************************************************************</span>
<a name="l00008"></a>00008 <span class="comment"> *                                                                         *</span>
<a name="l00009"></a>00009 <span class="comment"> * Copyright (C) 2007-2010 by Johan De Taeye                               *</span>
<a name="l00010"></a>00010 <span class="comment"> *                                                                         *</span>
<a name="l00011"></a>00011 <span class="comment"> * This library is free software; you can redistribute it and/or modify it *</span>
<a name="l00012"></a>00012 <span class="comment"> * under the terms of the GNU Lesser General Public License as published   *</span>
<a name="l00013"></a>00013 <span class="comment"> * by the Free Software Foundation; either version 2.1 of the License, or  *</span>
<a name="l00014"></a>00014 <span class="comment"> * (at your option) any later version.                                     *</span>
<a name="l00015"></a>00015 <span class="comment"> *                                                                         *</span>
<a name="l00016"></a>00016 <span class="comment"> * This library is distributed in the hope that it will be useful,         *</span>
<a name="l00017"></a>00017 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of          *</span>
<a name="l00018"></a>00018 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *</span>
<a name="l00019"></a>00019 <span class="comment"> * General Public License for more details.                                *</span>
<a name="l00020"></a>00020 <span class="comment"> *                                                                         *</span>
<a name="l00021"></a>00021 <span class="comment"> * You should have received a copy of the GNU Lesser General Public        *</span>
<a name="l00022"></a>00022 <span class="comment"> * License along with this library; if not, write to the Free Software     *</span>
<a name="l00023"></a>00023 <span class="comment"> * Foundation Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,*</span>
<a name="l00024"></a>00024 <span class="comment"> * USA                                                                     *</span>
<a name="l00025"></a>00025 <span class="comment"> *                                                                         *</span>
<a name="l00026"></a>00026 <span class="comment"> ***************************************************************************/</span>
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="a00202.html#a342983a479ae7a921be5face83fdb029">00028</a> <span class="preprocessor">#define FREPPLE_CORE</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="a00218.html">frepple/model.h</a>&quot;</span>
<a name="l00030"></a>00030 <span class="keyword">namespace </span>frepple
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keyword">const</span> <a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>* <a class="code" href="a00068.html#a784882efeb9633b6c44e9dc95834b852">FlowPlan::metadata</a>;
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 
<a name="l00036"></a><a class="code" href="a00068.html#a003341ddf9669d0ec1030b34c0a1f655">00036</a> <span class="keywordtype">int</span> <a class="code" href="a00068.html#a003341ddf9669d0ec1030b34c0a1f655">FlowPlan::initialize</a>()
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038   <span class="comment">// Initialize the metadata</span>
<a name="l00039"></a>00039   <a class="code" href="a00068.html#a784882efeb9633b6c44e9dc95834b852">metadata</a> = <span class="keyword">new</span> <a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>(<span class="stringliteral">&quot;flowplan&quot;</span>, <span class="stringliteral">&quot;flowplans&quot;</span>);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041   <span class="comment">// Initialize the Python type</span>
<a name="l00042"></a>00042   <a class="code" href="a00155.html" title="This class is a thin wrapper around the type information in Python.">PythonType</a>&amp; x = <a class="code" href="a00059.html#a93253992a64b3206dae154fc36bd6528">FreppleCategory&lt;FlowPlan&gt;::getType</a>();
<a name="l00043"></a>00043   x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">&quot;flowplan&quot;</span>);
<a name="l00044"></a>00044   x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">&quot;frePPLe flowplan&quot;</span>);
<a name="l00045"></a>00045   x.<a class="code" href="a00155.html#a8d3f24e0357f41ac3bc0be78bd2ab268">supportgetattro</a>();
<a name="l00046"></a>00046   <span class="keyword">const_cast&lt;</span><a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>*<span class="keyword">&gt;</span>(<a class="code" href="a00068.html#a784882efeb9633b6c44e9dc95834b852">metadata</a>)-&gt;pythonClass = x.<a class="code" href="a00155.html#aed0915f1cc32c0c1e12e209abfedf615">type_object</a>();
<a name="l00047"></a>00047   <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>();
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 
<a name="l00051"></a><a class="code" href="a00068.html#aeefe1a570e0676af44ccd3a875b2fc6a">00051</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00068.html#aeefe1a570e0676af44ccd3a875b2fc6a">FlowPlan::FlowPlan</a> (<a class="code" href="a00125.html" title="An operationplan is the key dynamic element of a plan. It represents a certain quantity...">OperationPlan</a> *opplan, <span class="keyword">const</span> <a class="code" href="a00065.html" title="This class defines a material flow to/from a buffer, linked with an operation. This...">Flow</a> *f)
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053   assert(opplan &amp;&amp; f);
<a name="l00054"></a>00054   fl = <span class="keyword">const_cast&lt;</span><a class="code" href="a00065.html" title="This class defines a material flow to/from a buffer, linked with an operation. This...">Flow</a>*<span class="keyword">&gt;</span>(f);
<a name="l00055"></a>00055 
<a name="l00056"></a>00056   <span class="comment">// Initialize the Python type</span>
<a name="l00057"></a>00057   <a class="code" href="a00151.html#ae5f2cd7cfa5367e07b3de396fe98fbfd">initType</a>(<a class="code" href="a00068.html#a784882efeb9633b6c44e9dc95834b852">metadata</a>);
<a name="l00058"></a>00058 
<a name="l00059"></a>00059   <span class="comment">// Link the flowplan to the operationplan</span>
<a name="l00060"></a>00060   oper = opplan;
<a name="l00061"></a>00061   nextFlowPlan = NULL;
<a name="l00062"></a>00062   <span class="keywordflow">if</span> (opplan-&gt;firstflowplan)
<a name="l00063"></a>00063   {
<a name="l00064"></a>00064     <span class="comment">// Append to the end</span>
<a name="l00065"></a>00065     <a class="code" href="a00068.html" title="A flowplan represents a planned material flow in or out of a buffer.">FlowPlan</a> *c = opplan-&gt;firstflowplan;
<a name="l00066"></a>00066     <span class="keywordflow">while</span> (c-&gt;nextFlowPlan) c = c-&gt;nextFlowPlan;
<a name="l00067"></a>00067     c-&gt;nextFlowPlan = <span class="keyword">this</span>;
<a name="l00068"></a>00068   }
<a name="l00069"></a>00069   <span class="keywordflow">else</span>
<a name="l00070"></a>00070     <span class="comment">// First in the list</span>
<a name="l00071"></a>00071     opplan-&gt;firstflowplan = <span class="keyword">this</span>;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="comment">// Compute the flowplan quantity</span>
<a name="l00074"></a>00074   fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;flowplans.insert(
<a name="l00075"></a>00075     <span class="keyword">this</span>,
<a name="l00076"></a>00076     fl-&gt;<a class="code" href="a00065.html#a13d896fb20aea3e8ca941b5d70e9be8f">getFlowplanQuantity</a>(<span class="keyword">this</span>),
<a name="l00077"></a>00077     fl-&gt;<a class="code" href="a00065.html#abb5314ce07f4b2ded0808e5cd410dbec">getFlowplanDate</a>(<span class="keyword">this</span>)
<a name="l00078"></a>00078     );
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   <span class="comment">// Mark the operation and buffer as having changed. This will trigger the</span>
<a name="l00081"></a>00081   <span class="comment">// recomputation of their problems</span>
<a name="l00082"></a>00082   fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00083"></a>00083   fl-&gt;<a class="code" href="a00065.html#af7649182aaa0020e9684ccd337a357ad">getOperation</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="a00068.html#aa33088a4a0f7150dd4ada78d4dacc754">00087</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00068.html#aa33088a4a0f7150dd4ada78d4dacc754">FlowPlan::update</a>()
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089   <span class="comment">// Update the timeline data structure</span>
<a name="l00090"></a>00090   fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;flowplans.update(
<a name="l00091"></a>00091     <span class="keyword">this</span>,
<a name="l00092"></a>00092     fl-&gt;<a class="code" href="a00065.html#a13d896fb20aea3e8ca941b5d70e9be8f">getFlowplanQuantity</a>(<span class="keyword">this</span>),
<a name="l00093"></a>00093     fl-&gt;<a class="code" href="a00065.html#abb5314ce07f4b2ded0808e5cd410dbec">getFlowplanDate</a>(<span class="keyword">this</span>)
<a name="l00094"></a>00094     );
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="comment">// Mark the operation and buffer as having changed. This will trigger the</span>
<a name="l00097"></a>00097   <span class="comment">// recomputation of their problems</span>
<a name="l00098"></a>00098   fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00099"></a>00099   fl-&gt;<a class="code" href="a00065.html#af7649182aaa0020e9684ccd337a357ad">getOperation</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00100"></a>00100 }
<a name="l00101"></a>00101 
<a name="l00102"></a>00102 
<a name="l00103"></a><a class="code" href="a00068.html#aaa7771a21e573b2a9981ff1c9bab321d">00103</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00068.html#aaa7771a21e573b2a9981ff1c9bab321d">FlowPlan::setFlow</a>(<span class="keyword">const</span> <a class="code" href="a00065.html" title="This class defines a material flow to/from a buffer, linked with an operation. This...">Flow</a>* newfl)
<a name="l00104"></a>00104 {
<a name="l00105"></a>00105   <span class="comment">// No change</span>
<a name="l00106"></a>00106   <span class="keywordflow">if</span> (newfl == fl) <span class="keywordflow">return</span>;
<a name="l00107"></a>00107 
<a name="l00108"></a>00108   <span class="comment">// Verify the data</span>
<a name="l00109"></a>00109   <span class="keywordflow">if</span> (!newfl) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t switch to NULL flow&quot;</span>);
<a name="l00110"></a>00110 
<a name="l00111"></a>00111   <span class="comment">// Remove from the old buffer, if there is one</span>
<a name="l00112"></a>00112   <span class="keywordflow">if</span> (fl)
<a name="l00113"></a>00113   {
<a name="l00114"></a>00114     <span class="keywordflow">if</span> (fl-&gt;<a class="code" href="a00065.html#af7649182aaa0020e9684ccd337a357ad">getOperation</a>() != newfl-&gt;<a class="code" href="a00065.html#af7649182aaa0020e9684ccd337a357ad">getOperation</a>())
<a name="l00115"></a>00115       <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Only switching to a flow on the same operation is allowed&quot;</span>);
<a name="l00116"></a>00116     fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;flowplans.erase(<span class="keyword">this</span>);
<a name="l00117"></a>00117     fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00118"></a>00118   }
<a name="l00119"></a>00119 
<a name="l00120"></a>00120   <span class="comment">// Insert in the new buffer</span>
<a name="l00121"></a>00121   fl = newfl;
<a name="l00122"></a>00122   fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;flowplans.insert(
<a name="l00123"></a>00123     <span class="keyword">this</span>,
<a name="l00124"></a>00124     fl-&gt;<a class="code" href="a00065.html#a13d896fb20aea3e8ca941b5d70e9be8f">getFlowplanQuantity</a>(<span class="keyword">this</span>),
<a name="l00125"></a>00125     fl-&gt;<a class="code" href="a00065.html#abb5314ce07f4b2ded0808e5cd410dbec">getFlowplanDate</a>(<span class="keyword">this</span>)
<a name="l00126"></a>00126     );
<a name="l00127"></a>00127   fl-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00128"></a>00128   fl-&gt;<a class="code" href="a00065.html#af7649182aaa0020e9684ccd337a357ad">getOperation</a>()-&gt;<a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>();
<a name="l00129"></a>00129 }
<a name="l00130"></a>00130 
<a name="l00131"></a>00131 
<a name="l00132"></a>00132 <span class="comment">// Remember that this method only superficially looks like a normal</span>
<a name="l00133"></a>00133 <span class="comment">// writeElement() method.</span>
<a name="l00134"></a><a class="code" href="a00068.html#ad54c77a23d8de5ae05e57352b09a40bc">00134</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00068.html#ad54c77a23d8de5ae05e57352b09a40bc">FlowPlan::writeElement</a>(<a class="code" href="a00189.html" title="Base class for writing XML formatted data to an output stream.">XMLOutput</a> *o, <span class="keyword">const</span> <a class="code" href="a00096.html" title="This class defines a keyword for the frePPLe data model.">Keyword</a>&amp; tag, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398">mode</a> m)<span class="keyword"> const</span>
<a name="l00135"></a>00135 <span class="keyword"></span>{
<a name="l00136"></a>00136   o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag);
<a name="l00137"></a>00137   o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#abca776609ba61919657e684eb8d88c55">Tags::tag_date</a>, <a class="code" href="a00058.html#a965645e70dd9f99b0bd4f1325fb382aa">getDate</a>());
<a name="l00138"></a>00138   o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ab99ddcbeef0f5d15a8731dcdffa0dcff">Tags::tag_quantity</a>, <a class="code" href="a00059.html#a665af7bb916d05a8c9a06f1a8170090f">getQuantity</a>());
<a name="l00139"></a>00139   o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a94ff585d707284cf4d69287f4ea4a9ba">Tags::tag_onhand</a>, <a class="code" href="a00058.html#a8e4bb6dd9d8927b8de76747cb64ee693">getOnhand</a>());
<a name="l00140"></a>00140   o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ac361ec1b9a7c26e74fbc4c21acb99049">Tags::tag_minimum</a>, <a class="code" href="a00058.html#af5bdea8d596cdb2ce0cf5efd40f38cc6">getMin</a>());
<a name="l00141"></a>00141   o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>, <a class="code" href="a00058.html#aa6d3b3c8966ba646bc261c2a346f115f">getMax</a>());
<a name="l00142"></a>00142   <span class="keywordflow">if</span> (!dynamic_cast&lt;OperationPlan*&gt;(o-&gt;<a class="code" href="a00189.html#a5783b534ee71d6e882a899b19a5a5680">getCurrentObject</a>()))
<a name="l00143"></a>00143     o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a6c742342d4a7f8112aca62435d43912a">Tags::tag_operationplan</a>, &amp;*<a class="code" href="a00068.html#afe1300d2e208fb1420a32caa3568e13d">getOperationPlan</a>());
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   <span class="comment">// Write pegging info</span>
<a name="l00146"></a>00146   <span class="keywordflow">if</span> (o-&gt;<a class="code" href="a00189.html#a364e86ed0671915df858bc52adadd29f">getContentType</a>() == XMLOutput::PLANDETAIL)
<a name="l00147"></a>00147   {
<a name="l00148"></a>00148     <span class="comment">// Write the upstream pegging</span>
<a name="l00149"></a>00149     <a class="code" href="a00131.html" title="This class allows upstream and downstream navigation through the plan.">PeggingIterator</a> k(<span class="keyword">this</span>, <span class="keyword">false</span>);
<a name="l00150"></a>00150     <span class="keywordflow">if</span> (k) --k;
<a name="l00151"></a>00151     <span class="keywordflow">for</span> (; k; --k)
<a name="l00152"></a>00152     {
<a name="l00153"></a>00153       o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(<a class="code" href="a00177.html#af002165635e4c2f9d7ec5a44adaa8079">Tags::tag_pegging</a>, <a class="code" href="a00177.html#ab0b51261656d7b486c09abe3f2cd7025">Tags::tag_level</a>, k.<a class="code" href="a00131.html#a8495b82ca78a1538d808dd2bac5baa7d">getLevel</a>());
<a name="l00154"></a>00154       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ab99ddcbeef0f5d15a8731dcdffa0dcff">Tags::tag_quantity</a>, k.<a class="code" href="a00131.html#a98a6ba2e04556019f964e845a423e614">getQuantityDemand</a>());
<a name="l00155"></a>00155       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a82d66ff2c60fc7c85db8f93938410393">Tags::tag_factor</a>, k.<a class="code" href="a00131.html#af632716ea5dba8ea48ed27c5daf236ce">getFactor</a>());
<a name="l00156"></a>00156       <span class="keywordflow">if</span> (!k.<a class="code" href="a00131.html#a7954650512af3da3de962376c61f0ad0">getPegged</a>()) o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a9a660b4455888adc9ad733f07826840f">Tags::tag_id</a>, <span class="stringliteral">&quot;unpegged&quot;</span>);
<a name="l00157"></a>00157       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#abbb33739cafd28ff9a14d3e96d41b8c4">Tags::tag_buffer</a>, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, k.<a class="code" href="a00131.html#a48ef63840684ba1f16874d4a8482c852">getBuffer</a>()-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>());
<a name="l00158"></a>00158       <span class="keywordflow">if</span> (k.<a class="code" href="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>())
<a name="l00159"></a>00159         o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ace665290e18c2008ab27843bf4723ec5">Tags::tag_consuming</a>,
<a name="l00160"></a>00160           <a class="code" href="a00177.html#a9a660b4455888adc9ad733f07826840f">Tags::tag_id</a>, k.<a class="code" href="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2fc22f86c78b34f91bf535c742e2e740">getIdentifier</a>(),
<a name="l00161"></a>00161           <a class="code" href="a00177.html#ad70b79a1c1f3f6d13539207da4f19609">Tags::tag_operation</a>, k.<a class="code" href="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>()-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>());
<a name="l00162"></a>00162       <span class="keywordflow">if</span> (k.<a class="code" href="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>())
<a name="l00163"></a>00163         o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a419541bdc90e7a049a3d9bd9a1e6615f">Tags::tag_producing</a>,
<a name="l00164"></a>00164           <a class="code" href="a00177.html#a9a660b4455888adc9ad733f07826840f">Tags::tag_id</a>, k.<a class="code" href="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2fc22f86c78b34f91bf535c742e2e740">getIdentifier</a>(),
<a name="l00165"></a>00165           <a class="code" href="a00177.html#ad70b79a1c1f3f6d13539207da4f19609">Tags::tag_operation</a>, k.<a class="code" href="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>()-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>());
<a name="l00166"></a>00166       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#afd46a2b7fae8802813bcfca5bb5cdbcd">Tags::tag_dates</a>, <a class="code" href="a00050.html" title="This class defines a date-range, i.e. a start-date and end-date pair.">DateRange</a>(k.<a class="code" href="a00131.html#a300048d940a1178ddce0f1b6355e1f53">getProducingDate</a>(),k.<a class="code" href="a00131.html#a91a7eb11f8f4a343a6368b72ae4cba36">getConsumingDate</a>()));
<a name="l00167"></a>00167       o-&gt;<a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(<a class="code" href="a00177.html#af002165635e4c2f9d7ec5a44adaa8079">Tags::tag_pegging</a>);
<a name="l00168"></a>00168     }
<a name="l00169"></a>00169 
<a name="l00170"></a>00170     <span class="comment">// Write the downstream pegging</span>
<a name="l00171"></a>00171     <a class="code" href="a00131.html" title="This class allows upstream and downstream navigation through the plan.">PeggingIterator</a> l(<span class="keyword">this</span>, <span class="keyword">true</span>);
<a name="l00172"></a>00172     <span class="keywordflow">if</span> (l) ++l;
<a name="l00173"></a>00173     <span class="keywordflow">for</span> (; l; ++l)
<a name="l00174"></a>00174     {
<a name="l00175"></a>00175       o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(<a class="code" href="a00177.html#af002165635e4c2f9d7ec5a44adaa8079">Tags::tag_pegging</a>, <a class="code" href="a00177.html#ab0b51261656d7b486c09abe3f2cd7025">Tags::tag_level</a>, l.<a class="code" href="a00131.html#a8495b82ca78a1538d808dd2bac5baa7d">getLevel</a>());
<a name="l00176"></a>00176       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ab99ddcbeef0f5d15a8731dcdffa0dcff">Tags::tag_quantity</a>, l.<a class="code" href="a00131.html#a98a6ba2e04556019f964e845a423e614">getQuantityDemand</a>());
<a name="l00177"></a>00177       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a82d66ff2c60fc7c85db8f93938410393">Tags::tag_factor</a>, l.<a class="code" href="a00131.html#af632716ea5dba8ea48ed27c5daf236ce">getFactor</a>());
<a name="l00178"></a>00178       <span class="keywordflow">if</span> (!l.<a class="code" href="a00131.html#a7954650512af3da3de962376c61f0ad0">getPegged</a>()) o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a9a660b4455888adc9ad733f07826840f">Tags::tag_id</a>, <span class="stringliteral">&quot;unpegged&quot;</span>);
<a name="l00179"></a>00179       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#abbb33739cafd28ff9a14d3e96d41b8c4">Tags::tag_buffer</a>, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, l.<a class="code" href="a00131.html#a48ef63840684ba1f16874d4a8482c852">getBuffer</a>()-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>());
<a name="l00180"></a>00180       <span class="keywordflow">if</span> (l.<a class="code" href="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>())
<a name="l00181"></a>00181         o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ace665290e18c2008ab27843bf4723ec5">Tags::tag_consuming</a>,
<a name="l00182"></a>00182           <a class="code" href="a00177.html#a9a660b4455888adc9ad733f07826840f">Tags::tag_id</a>, l.<a class="code" href="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2fc22f86c78b34f91bf535c742e2e740">getIdentifier</a>(),
<a name="l00183"></a>00183           <a class="code" href="a00177.html#ad70b79a1c1f3f6d13539207da4f19609">Tags::tag_operation</a>, l.<a class="code" href="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>()-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>());
<a name="l00184"></a>00184       <span class="keywordflow">if</span> (l.<a class="code" href="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>())
<a name="l00185"></a>00185         o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a419541bdc90e7a049a3d9bd9a1e6615f">Tags::tag_producing</a>,
<a name="l00186"></a>00186           <a class="code" href="a00177.html#a9a660b4455888adc9ad733f07826840f">Tags::tag_id</a>, l.<a class="code" href="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2fc22f86c78b34f91bf535c742e2e740">getIdentifier</a>(),
<a name="l00187"></a>00187           <a class="code" href="a00177.html#ad70b79a1c1f3f6d13539207da4f19609">Tags::tag_operation</a>, l.<a class="code" href="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>()-&gt;<a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>()-&gt;<a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>());
<a name="l00188"></a>00188       o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#afd46a2b7fae8802813bcfca5bb5cdbcd">Tags::tag_dates</a>, <a class="code" href="a00050.html" title="This class defines a date-range, i.e. a start-date and end-date pair.">DateRange</a>(l.<a class="code" href="a00131.html#a300048d940a1178ddce0f1b6355e1f53">getProducingDate</a>(),l.<a class="code" href="a00131.html#a91a7eb11f8f4a343a6368b72ae4cba36">getConsumingDate</a>()));
<a name="l00189"></a>00189       o-&gt;<a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(<a class="code" href="a00177.html#af002165635e4c2f9d7ec5a44adaa8079">Tags::tag_pegging</a>);
<a name="l00190"></a>00190     }
<a name="l00191"></a>00191   }
<a name="l00192"></a>00192 
<a name="l00193"></a>00193   o-&gt;<a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(tag);
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195 
<a name="l00196"></a>00196 
<a name="l00197"></a>00197 PyObject* FlowPlan::getattro(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00198"></a>00198 {
<a name="l00199"></a>00199   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6c742342d4a7f8112aca62435d43912a">Tags::tag_operationplan</a>))
<a name="l00200"></a>00200     <span class="keywordflow">return</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(<a class="code" href="a00068.html#afe1300d2e208fb1420a32caa3568e13d">getOperationPlan</a>());
<a name="l00201"></a>00201   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ab99ddcbeef0f5d15a8731dcdffa0dcff">Tags::tag_quantity</a>))
<a name="l00202"></a>00202     <span class="keywordflow">return</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(<a class="code" href="a00059.html#a665af7bb916d05a8c9a06f1a8170090f">getQuantity</a>());
<a name="l00203"></a>00203   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a2b7f55f8d34c873afe442d0eca79c122">Tags::tag_flow</a>))
<a name="l00204"></a>00204     <span class="keywordflow">return</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(<a class="code" href="a00068.html#afad8d8ad9e551d7abb012bf1383b18c8">getFlow</a>());
<a name="l00205"></a>00205   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#abca776609ba61919657e684eb8d88c55">Tags::tag_date</a>))
<a name="l00206"></a>00206     <span class="keywordflow">return</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(<a class="code" href="a00058.html#a965645e70dd9f99b0bd4f1325fb382aa">getDate</a>());
<a name="l00207"></a>00207   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a94ff585d707284cf4d69287f4ea4a9ba">Tags::tag_onhand</a>))
<a name="l00208"></a>00208     <span class="keywordflow">return</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(<a class="code" href="a00058.html#a8e4bb6dd9d8927b8de76747cb64ee693">getOnhand</a>());
<a name="l00209"></a>00209   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#abbb33739cafd28ff9a14d3e96d41b8c4">Tags::tag_buffer</a>))
<a name="l00210"></a>00210     <span class="keywordflow">return</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(<a class="code" href="a00068.html#afad8d8ad9e551d7abb012bf1383b18c8">getFlow</a>()-&gt;<a class="code" href="a00065.html#a3034ea6d121f86338faeab26ec7464d4">getBuffer</a>());
<a name="l00211"></a>00211   <span class="keywordflow">return</span> NULL;
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 
<a name="l00215"></a><a class="code" href="a00070.html#a2bea3f3b6dfc94f5ba80a3e226e9ecb7">00215</a> <span class="keywordtype">int</span> <a class="code" href="a00070.html#a2bea3f3b6dfc94f5ba80a3e226e9ecb7">FlowPlanIterator::initialize</a>()
<a name="l00216"></a>00216 {
<a name="l00217"></a>00217   <span class="comment">// Initialize the type</span>
<a name="l00218"></a>00218   <a class="code" href="a00155.html" title="This class is a thin wrapper around the type information in Python.">PythonType</a>&amp; x = <a class="code" href="a00150.html#aec65c2cd811051918027ae6dc00fcfaf">PythonExtension&lt;FlowPlanIterator&gt;::getType</a>();
<a name="l00219"></a>00219   x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">&quot;flowplanIterator&quot;</span>);
<a name="l00220"></a>00220   x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">&quot;frePPLe iterator for flowplan&quot;</span>);
<a name="l00221"></a>00221   x.<a class="code" href="a00155.html#a5bacf8ad021ab55b1056440880cf8760">supportiter</a>();
<a name="l00222"></a>00222   <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>();
<a name="l00223"></a>00223 }
<a name="l00224"></a>00224 
<a name="l00225"></a>00225 
<a name="l00226"></a>00226 PyObject* FlowPlanIterator::iternext()
<a name="l00227"></a>00227 {
<a name="l00228"></a>00228   <a class="code" href="a00068.html" title="A flowplan represents a planned material flow in or out of a buffer.">FlowPlan</a>* fl;
<a name="l00229"></a>00229   <span class="keywordflow">if</span> (buffer_or_opplan)
<a name="l00230"></a>00230   {
<a name="l00231"></a>00231     <span class="comment">// Skip uninteresting entries</span>
<a name="l00232"></a>00232     <span class="keywordflow">while</span> (*<a class="code" href="a00070.html#a83472bb14ff086ff0db4d216b5bd85a9">bufiter</a> != <a class="code" href="a00070.html#a33a8bd3e835160f552f501905cef40ec">buf</a>-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().end() &amp;&amp; (*bufiter)-&gt;getQuantity()==0.0)
<a name="l00233"></a>00233       ++(*bufiter);
<a name="l00234"></a>00234     <span class="keywordflow">if</span> (*<a class="code" href="a00070.html#a83472bb14ff086ff0db4d216b5bd85a9">bufiter</a> == <a class="code" href="a00070.html#a33a8bd3e835160f552f501905cef40ec">buf</a>-&gt;<a class="code" href="a00008.html#ad8189150ceacd114c8cd91346323fa03">getFlowPlans</a>().end()) <span class="keywordflow">return</span> NULL;
<a name="l00235"></a>00235     fl = <span class="keyword">const_cast&lt;</span><a class="code" href="a00068.html" title="A flowplan represents a planned material flow in or out of a buffer.">FlowPlan</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span><span class="keyword">const </span><a class="code" href="a00068.html" title="A flowplan represents a planned material flow in or out of a buffer.">FlowPlan</a>*<span class="keyword">&gt;</span>(&amp;*((*bufiter)++)));
<a name="l00236"></a>00236   }
<a name="l00237"></a>00237   <span class="keywordflow">else</span>
<a name="l00238"></a>00238   {
<a name="l00239"></a>00239     <span class="comment">// Skip uninteresting entries</span>
<a name="l00240"></a>00240     <span class="keywordflow">while</span> (*<a class="code" href="a00070.html#ad0e0fcae8504bc0e91151529f63917f6">opplaniter</a> != <a class="code" href="a00070.html#a250556ff35903522e0eaa8e976bc518b">opplan</a>-&gt;endFlowPlans() &amp;&amp; (*opplaniter)-&gt;getQuantity()==0.0)
<a name="l00241"></a>00241       ++(*opplaniter);
<a name="l00242"></a>00242     <span class="keywordflow">if</span> (*<a class="code" href="a00070.html#ad0e0fcae8504bc0e91151529f63917f6">opplaniter</a> == <a class="code" href="a00070.html#a250556ff35903522e0eaa8e976bc518b">opplan</a>-&gt;endFlowPlans()) <span class="keywordflow">return</span> NULL;
<a name="l00243"></a>00243     fl = <span class="keyword">static_cast&lt;</span>FlowPlan*<span class="keyword">&gt;</span>(&amp;*((*opplaniter)++));
<a name="l00244"></a>00244   }
<a name="l00245"></a>00245   Py_INCREF(fl);
<a name="l00246"></a>00246   <span class="keywordflow">return</span> <span class="keyword">const_cast&lt;</span>FlowPlan*<span class="keyword">&gt;</span>(fl);
<a name="l00247"></a>00247 }
<a name="l00248"></a>00248 
<a name="l00249"></a>00249 } <span class="comment">// end namespace</span>
</pre></div></div>
<hr size="1"/><address style="align: right;"><small>Documentation generated for frePPLe by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"/></a></small></address>
</div>
</div>
</body>
</html>