Sophie

Sophie

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

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: pegging.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>pegging.cpp</h1><a href="a00225.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/pegging.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="a00225.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 
<a name="l00031"></a>00031 <span class="keyword">namespace </span>frepple
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <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="a00131.html#a91e7242dc3e6de8ced18195d5bf5933d">PeggingIterator::metadata</a>;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="a00131.html#a5df24add46f53dc91de8ce01a0a775e1">00037</a> <span class="keywordtype">int</span> <a class="code" href="a00131.html#a5df24add46f53dc91de8ce01a0a775e1">PeggingIterator::initialize</a>()
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039   <span class="comment">// Initialize the pegging metadata</span>
<a name="l00040"></a>00040   <a class="code" href="a00131.html#a91e7242dc3e6de8ced18195d5bf5933d">PeggingIterator::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;pegging&quot;</span>,<span class="stringliteral">&quot;peggings&quot;</span>);
<a name="l00041"></a>00041 
<a name="l00042"></a>00042   <span class="comment">// Initialize the Python type</span>
<a name="l00043"></a>00043   <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="a00131.html#aa0879486800600a37a7e95b8f4d5e215">PythonExtension&lt;PeggingIterator&gt;::getType</a>();
<a name="l00044"></a>00044   x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">&quot;peggingIterator&quot;</span>);
<a name="l00045"></a>00045   x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">&quot;frePPLe iterator for demand pegging&quot;</span>);
<a name="l00046"></a>00046   x.<a class="code" href="a00155.html#a8d3f24e0357f41ac3bc0be78bd2ab268">supportgetattro</a>();
<a name="l00047"></a>00047   x.<a class="code" href="a00155.html#a5bacf8ad021ab55b1056440880cf8760">supportiter</a>();
<a name="l00048"></a>00048   <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="a00131.html#a91e7242dc3e6de8ced18195d5bf5933d">PeggingIterator::metadata</a>)-&gt;pythonClass = x.<a class="code" href="a00155.html#aed0915f1cc32c0c1e12e209abfedf615">type_object</a>();
<a name="l00049"></a>00049   <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>();
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 
<a name="l00053"></a><a class="code" href="a00131.html#a3e9aadbd91e53e67d85279670065768a">00053</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00131.html#a3e9aadbd91e53e67d85279670065768a">PeggingIterator::PeggingIterator</a>(<span class="keyword">const</span> <a class="code" href="a00051.html" title="Represents the (independent) demand in the system. It can represent a customer order...">Demand</a>* d)
<a name="l00054"></a>00054   : downstream(false), firstIteration(true)
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056   <span class="comment">// Loop through all delivery operationplans</span>
<a name="l00057"></a>00057   first = <span class="keyword">false</span>;  <span class="comment">// ... because the stack is still empty</span>
<a name="l00058"></a>00058   <span class="keywordflow">for</span> (Demand::OperationPlan_list::const_iterator opplaniter = d-&gt;<a class="code" href="a00051.html#ac7955c7abfa551ef2426263d1e78de5d">getDelivery</a>().begin();
<a name="l00059"></a>00059     opplaniter != d-&gt;<a class="code" href="a00051.html#ac7955c7abfa551ef2426263d1e78de5d">getDelivery</a>().end(); ++opplaniter)
<a name="l00060"></a>00060     followPegging(*opplaniter, 0, (*opplaniter)-&gt;getQuantity(), 1.0);
<a name="l00061"></a>00061 
<a name="l00062"></a>00062   <span class="comment">// Initialize Python type information</span>
<a name="l00063"></a>00063   <a class="code" href="a00151.html#ae5f2cd7cfa5367e07b3de396fe98fbfd">initType</a>(<a class="code" href="a00131.html#a91e7242dc3e6de8ced18195d5bf5933d">metadata</a>);
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00131.html#ae54c20a1ee7a60ef6448f05207c11990">PeggingIterator::updateStack</a>
<a name="l00068"></a><a class="code" href="a00131.html#ae54c20a1ee7a60ef6448f05207c11990">00068</a>   (<span class="keywordtype">short</span> l, <span class="keywordtype">double</span> q, <span class="keywordtype">double</span> f, <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>* fc, <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>* fp, <span class="keywordtype">bool</span> p)
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070   <span class="comment">// Avoid very small pegging quantities</span>
<a name="l00071"></a>00071   <span class="keywordflow">if</span> (q &lt; 0.1) <span class="keywordflow">return</span>;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073   <span class="keywordflow">if</span> (first)
<a name="l00074"></a>00074   {
<a name="l00075"></a>00075     <span class="comment">// We can update the current top element of the stack</span>
<a name="l00076"></a>00076     state&amp; t = states.top();
<a name="l00077"></a>00077     t.cons_flowplan = fc;
<a name="l00078"></a>00078     t.prod_flowplan = fp;
<a name="l00079"></a>00079     t.qty = q;
<a name="l00080"></a>00080     t.factor = f;
<a name="l00081"></a>00081     t.level = l;
<a name="l00082"></a>00082     t.pegged = p;
<a name="l00083"></a>00083     first = <span class="keyword">false</span>;
<a name="l00084"></a>00084   }
<a name="l00085"></a>00085   <span class="keywordflow">else</span>
<a name="l00086"></a>00086     <span class="comment">// We need to create a new element on the stack</span>
<a name="l00087"></a>00087     states.push(state(l, q, f, fc, fp, p));
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 
<a name="l00091"></a><a class="code" href="a00131.html#a811307b4da595f2c945eaa98814adc67">00091</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00131.html" title="This class allows upstream and downstream navigation through the plan.">PeggingIterator</a>&amp; <a class="code" href="a00131.html#a811307b4da595f2c945eaa98814adc67">PeggingIterator::operator++</a>()
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093   <span class="comment">// Validate</span>
<a name="l00094"></a>00094   <span class="keywordflow">if</span> (states.empty())
<a name="l00095"></a>00095     <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;Incrementing the iterator beyond it&apos;s end&quot;</span>);
<a name="l00096"></a>00096   <span class="keywordflow">if</span> (!downstream)
<a name="l00097"></a>00097     <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;Incrementing a downstream iterator&quot;</span>);
<a name="l00098"></a>00098   state&amp; st = states.top();
<a name="l00099"></a>00099 
<a name="l00100"></a>00100   <span class="comment">// Handle unconsumed material entries on the stack</span>
<a name="l00101"></a>00101   <span class="keywordflow">if</span> (!st.pegged)
<a name="l00102"></a>00102   {
<a name="l00103"></a>00103     states.pop();
<a name="l00104"></a>00104     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00105"></a>00105   }
<a name="l00106"></a>00106 
<a name="l00107"></a>00107   <span class="comment">// Mark the top entry in the stack as invalid, so it can be reused</span>
<a name="l00108"></a>00108   first = <span class="keyword">true</span>;
<a name="l00109"></a>00109 
<a name="l00110"></a>00110   <span class="comment">// Take the consuming flowplan and follow the pegging</span>
<a name="l00111"></a>00111   <span class="keywordflow">if</span> (st.cons_flowplan)
<a name="l00112"></a>00112     followPegging(st.cons_flowplan-&gt;getOperationPlan()-&gt;getTopOwner(),
<a name="l00113"></a>00113       st.level-1, st.qty, st.factor);
<a name="l00114"></a>00114 
<a name="l00115"></a>00115   <span class="comment">// Pop invalid entries from the stack</span>
<a name="l00116"></a>00116   <span class="keywordflow">if</span> (first) states.pop();
<a name="l00117"></a>00117 
<a name="l00118"></a>00118   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00119"></a>00119 }
<a name="l00120"></a>00120 
<a name="l00121"></a>00121 
<a name="l00122"></a><a class="code" href="a00131.html#aebce5b987ad17f344d269b5c3f5b5621">00122</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00131.html" title="This class allows upstream and downstream navigation through the plan.">PeggingIterator</a>&amp; <a class="code" href="a00131.html#aebce5b987ad17f344d269b5c3f5b5621">PeggingIterator::operator--</a>()
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124   <span class="comment">// Validate</span>
<a name="l00125"></a>00125   <span class="keywordflow">if</span> (states.empty())
<a name="l00126"></a>00126     <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;Incrementing the iterator beyond it&apos;s end&quot;</span>);
<a name="l00127"></a>00127   <span class="keywordflow">if</span> (downstream)
<a name="l00128"></a>00128     <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;Decrementing an upstream iterator&quot;</span>);
<a name="l00129"></a>00129   state&amp; st = states.top();
<a name="l00130"></a>00130 
<a name="l00131"></a>00131   <span class="comment">// Handle unconsumed material entries on the stack</span>
<a name="l00132"></a>00132   <span class="keywordflow">if</span> (!st.pegged)
<a name="l00133"></a>00133   {
<a name="l00134"></a>00134     states.pop();
<a name="l00135"></a>00135     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00136"></a>00136   }
<a name="l00137"></a>00137 
<a name="l00138"></a>00138   <span class="comment">// Mark the top entry in the stack as invalid, so it can be reused</span>
<a name="l00139"></a>00139   first = <span class="keyword">true</span>;
<a name="l00140"></a>00140 
<a name="l00141"></a>00141   <span class="comment">// Take the producing flowplan and follow the pegging</span>
<a name="l00142"></a>00142   <span class="keywordflow">if</span> (st.prod_flowplan)
<a name="l00143"></a>00143     followPegging(st.prod_flowplan-&gt;getOperationPlan()-&gt;getTopOwner(),
<a name="l00144"></a>00144       st.level+1, st.qty, st.factor);
<a name="l00145"></a>00145 
<a name="l00146"></a>00146   <span class="comment">// Pop invalid entries from the stack</span>
<a name="l00147"></a>00147   <span class="keywordflow">if</span> (first) states.pop();
<a name="l00148"></a>00148 
<a name="l00149"></a>00149   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00150"></a>00150 }
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 
<a name="l00153"></a>00153 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> PeggingIterator::followPegging
<a name="l00154"></a>00154   (<span class="keyword">const</span> <a class="code" href="a00125.html" title="An operationplan is the key dynamic element of a plan. It represents a certain quantity...">OperationPlan</a>* op, <span class="keywordtype">short</span> nextlevel, <span class="keywordtype">double</span> qty, <span class="keywordtype">double</span> factor)
<a name="l00155"></a>00155 {
<a name="l00156"></a>00156   <span class="comment">// For each flowplan (producing or consuming depending on whether we go</span>
<a name="l00157"></a>00157   <span class="comment">// upstream or downstream) ask the buffer to give us the pegged flowplans.</span>
<a name="l00158"></a>00158   <span class="keywordtype">bool</span> noFlowPlans = <span class="keyword">true</span>;
<a name="l00159"></a>00159   <span class="keywordflow">if</span> (downstream)
<a name="l00160"></a>00160     <span class="keywordflow">for</span> (<a class="code" href="a00069.html" title="An iterator class to go through all flowplans of an operationplan.">OperationPlan::FlowPlanIterator</a> i = op-&gt;<a class="code" href="a00125.html#a4fb68598ded2db1ae3a9f5f975dd09c6">beginFlowPlans</a>();
<a name="l00161"></a>00161         i != op-&gt;<a class="code" href="a00125.html#a1b421f000d0a136fa3f9dc3abd5b76cc">endFlowPlans</a>(); ++i)
<a name="l00162"></a>00162     {
<a name="l00163"></a>00163       <span class="comment">// We&apos;re interested in producing flowplans of an operationplan when</span>
<a name="l00164"></a>00164       <span class="comment">// walking downstream.</span>
<a name="l00165"></a>00165       <span class="keywordflow">if</span> (i-&gt;getQuantity()&gt;<a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00166"></a>00166       {
<a name="l00167"></a>00167         i-&gt;getFlow()-&gt;getBuffer()-&gt;followPegging(*<span class="keyword">this</span>, &amp;*i, nextlevel, qty, factor);
<a name="l00168"></a>00168         noFlowPlans = <span class="keyword">false</span>;
<a name="l00169"></a>00169       }
<a name="l00170"></a>00170     }
<a name="l00171"></a>00171   <span class="keywordflow">else</span>
<a name="l00172"></a>00172     <span class="keywordflow">for</span> (OperationPlan::FlowPlanIterator i = op-&gt;<a class="code" href="a00125.html#a4fb68598ded2db1ae3a9f5f975dd09c6">beginFlowPlans</a>();
<a name="l00173"></a>00173         i != op-&gt;<a class="code" href="a00125.html#a1b421f000d0a136fa3f9dc3abd5b76cc">endFlowPlans</a>(); ++i)
<a name="l00174"></a>00174     {
<a name="l00175"></a>00175       <span class="comment">// We&apos;re interested in consuming flowplans of an operationplan when</span>
<a name="l00176"></a>00176       <span class="comment">// walking upstream.</span>
<a name="l00177"></a>00177       <span class="keywordflow">if</span> (i-&gt;getQuantity()&lt;-<a class="code" href="a00252.html#a42d90a6275119e1b4ce73c50f1867e60">ROUNDING_ERROR</a>)
<a name="l00178"></a>00178       {
<a name="l00179"></a>00179         i-&gt;getFlow()-&gt;getBuffer()-&gt;followPegging(*<span class="keyword">this</span>, &amp;*i, nextlevel, qty, factor);
<a name="l00180"></a>00180         noFlowPlans = <span class="keyword">false</span>;
<a name="l00181"></a>00181       }
<a name="l00182"></a>00182     }
<a name="l00183"></a>00183 
<a name="l00184"></a>00184   <span class="comment">// Special case: the operationplan doesn&apos;t have flowplans</span>
<a name="l00185"></a>00185   <span class="comment">// @todo if (noFlowPlans) updateStack(nextlevel, qty, factor, NULL, NULL);</span>
<a name="l00186"></a>00186 
<a name="l00187"></a>00187   <span class="comment">// Recursively call this function for all sub-operationplans.</span>
<a name="l00188"></a>00188   <span class="keywordflow">for</span> (<a class="code" href="a00125.html#a67171474c4da6cc8efe0c7fafefd2b2d">OperationPlan::iterator</a> j(op); j != <a class="code" href="a00125.html#a0f9f6ba7d4fe7e20e9b88c765fe24f25">OperationPlan::end</a>(); ++j)
<a name="l00189"></a>00189     followPegging(&amp;*j, nextlevel, qty, factor);
<a name="l00190"></a>00190 }
<a name="l00191"></a>00191 
<a name="l00192"></a>00192 
<a name="l00193"></a>00193 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* PeggingIterator::iternext()
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195   <span class="keywordflow">if</span> (firstIteration)
<a name="l00196"></a>00196     firstIteration = <span class="keyword">false</span>;
<a name="l00197"></a>00197   <span class="keywordflow">else</span>
<a name="l00198"></a>00198     <a class="code" href="a00131.html#aebce5b987ad17f344d269b5c3f5b5621">operator--</a>();
<a name="l00199"></a>00199   <span class="keywordflow">if</span> (!<span class="keyword">operator</span> <span class="keywordtype">bool</span>()) <span class="keywordflow">return</span> NULL;
<a name="l00200"></a>00200   Py_INCREF(<span class="keyword">this</span>);
<a name="l00201"></a>00201   <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>PyObject*<span class="keyword">&gt;</span>(<span class="keyword">this</span>);
<a name="l00202"></a>00202 }
<a name="l00203"></a>00203 
<a name="l00204"></a>00204 
<a name="l00205"></a>00205 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* PeggingIterator::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="l00206"></a>00206 {
<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#ab0b51261656d7b486c09abe3f2cd7025">Tags::tag_level</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="a00131.html#a8495b82ca78a1538d808dd2bac5baa7d">getLevel</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#ace665290e18c2008ab27843bf4723ec5">Tags::tag_consuming</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="a00131.html#a13a0e06f84a6454978b771bab1d3c501">getConsumingOperationplan</a>());
<a name="l00211"></a>00211   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a419541bdc90e7a049a3d9bd9a1e6615f">Tags::tag_producing</a>))
<a name="l00212"></a>00212     <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="a00131.html#ac68b526ebb111056385f33b42ddacdf0">getProducingOperationplan</a>());
<a name="l00213"></a>00213   <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="l00214"></a>00214     <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="a00131.html#a48ef63840684ba1f16874d4a8482c852">getBuffer</a>());
<a name="l00215"></a>00215   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ac30247ee45ff7209b4ee4ba80be81e11">Tags::tag_quantity_demand</a>))
<a name="l00216"></a>00216     <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="a00131.html#a98a6ba2e04556019f964e845a423e614">getQuantityDemand</a>());
<a name="l00217"></a>00217   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a8318a1e2d239265e6389c5908e841d3f">Tags::tag_quantity_buffer</a>))
<a name="l00218"></a>00218     <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="a00131.html#ad194bcf1218ad4f5a461789ed7040807">getQuantityBuffer</a>());
<a name="l00219"></a>00219   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a484a2bdf7b294743e883cd802d7f354c">Tags::tag_pegged</a>))
<a name="l00220"></a>00220     <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="a00131.html#a7954650512af3da3de962376c61f0ad0">getPegged</a>());
<a name="l00221"></a>00221   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a4c38d062899b1e3e41b928c6dfffd366">Tags::tag_consuming_date</a>))
<a name="l00222"></a>00222     <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="a00131.html#a91a7eb11f8f4a343a6368b72ae4cba36">getConsumingDate</a>());
<a name="l00223"></a>00223   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#af77354c4d6df625bf5bc1dcd3f877e2c">Tags::tag_producing_date</a>))
<a name="l00224"></a>00224     <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="a00131.html#a300048d940a1178ddce0f1b6355e1f53">getProducingDate</a>());
<a name="l00225"></a>00225   <span class="keywordflow">return</span> NULL;
<a name="l00226"></a>00226 }
<a name="l00227"></a>00227 
<a name="l00228"></a>00228 
<a name="l00229"></a>00229 } <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>