<!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: loadplan.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 Page</span></a></li> <li><a href="pages.html"><span>Related 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_88117dff2735251a69c8eb9084477714.html">src</a> » <a class="el" href="dir_25032d30b6d615a661c02e2ac1394b01.html">model</a> </div> </div> <div class="contents"> <h1>loadplan.cpp</h1><a href="a00213.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/loadplan.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="a00213.html#a342983a479ae7a921be5face83fdb029">00028</a> <span class="preprocessor">#define FREPPLE_CORE</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="a00218.html">frepple/model.h</a>"</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="a00105.html#a5105155c6ef43ae632c2f8ef74968324">LoadPlan::metadata</a>; <a name="l00035"></a>00035 <a name="l00036"></a>00036 <a name="l00037"></a><a class="code" href="a00105.html#a25d02bae2fdf98b0e172fa1ed43826d4">00037</a> <span class="keywordtype">int</span> <a class="code" href="a00105.html#a25d02bae2fdf98b0e172fa1ed43826d4">LoadPlan::initialize</a>() <a name="l00038"></a>00038 { <a name="l00039"></a>00039 <span class="comment">// Initialize the metadata</span> <a name="l00040"></a>00040 <a class="code" href="a00105.html#a5105155c6ef43ae632c2f8ef74968324">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">"loadplan"</span>, <span class="stringliteral">"loadplans"</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>& x = <a class="code" href="a00059.html#a93253992a64b3206dae154fc36bd6528">FreppleCategory<LoadPlan>::getType</a>(); <a name="l00044"></a>00044 x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">"loadplan"</span>); <a name="l00045"></a>00045 x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">"frePPLe loadplan"</span>); <a name="l00046"></a>00046 x.<a class="code" href="a00155.html#a8d3f24e0357f41ac3bc0be78bd2ab268">supportgetattro</a>(); <a name="l00047"></a>00047 <span class="keyword">const_cast<</span><a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>*<span class="keyword">></span>(<a class="code" href="a00105.html#a5105155c6ef43ae632c2f8ef74968324">metadata</a>)->pythonClass = x.<a class="code" href="a00155.html#aed0915f1cc32c0c1e12e209abfedf615">type_object</a>(); <a name="l00048"></a>00048 <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>(); <a name="l00049"></a>00049 } <a name="l00050"></a>00050 <a name="l00051"></a>00051 <a name="l00052"></a><a class="code" href="a00105.html#af510b8574f749397aabc3bbc0310db5b">00052</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00105.html#af510b8574f749397aabc3bbc0310db5b">LoadPlan::LoadPlan</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> *o, <span class="keyword">const</span> <a class="code" href="a00103.html" title="This class links a resource to a certain operation.">Load</a> *r) <a name="l00053"></a>00053 { <a name="l00054"></a>00054 assert(o); <a name="l00055"></a>00055 ld = <span class="keyword">const_cast<</span><a class="code" href="a00103.html" title="This class links a resource to a certain operation.">Load</a>*<span class="keyword">></span>(r); <a name="l00056"></a>00056 oper = o; <a name="l00057"></a>00057 start_or_end = START; <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="comment">// Add to the operationplan</span> <a name="l00060"></a>00060 nextLoadPlan = NULL; <a name="l00061"></a>00061 <span class="keywordflow">if</span> (o->firstloadplan) <a name="l00062"></a>00062 { <a name="l00063"></a>00063 <span class="comment">// Append to the end</span> <a name="l00064"></a>00064 <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *c = o->firstloadplan; <a name="l00065"></a>00065 <span class="keywordflow">while</span> (c->nextLoadPlan) c = c->nextLoadPlan; <a name="l00066"></a>00066 c->nextLoadPlan = <span class="keyword">this</span>; <a name="l00067"></a>00067 } <a name="l00068"></a>00068 <span class="keywordflow">else</span> <a name="l00069"></a>00069 <span class="comment">// First in the list</span> <a name="l00070"></a>00070 o->firstloadplan = <span class="keyword">this</span>; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="comment">// Insert in the resource timeline</span> <a name="l00073"></a>00073 r-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()->loadplans.insert( <a name="l00074"></a>00074 <span class="keyword">this</span>, <a name="l00075"></a>00075 ld-><a class="code" href="a00103.html#a61b673421557d1b833d841502fa851a9">getLoadplanQuantity</a>(<span class="keyword">this</span>), <a name="l00076"></a>00076 ld-><a class="code" href="a00103.html#a7379c868caf6f7d20ba18a6235ede122">getLoadplanDate</a>(<span class="keyword">this</span>) <a name="l00077"></a>00077 ); <a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="comment">// Initialize the Python type</span> <a name="l00080"></a>00080 <a class="code" href="a00151.html#ae5f2cd7cfa5367e07b3de396fe98fbfd">initType</a>(<a class="code" href="a00105.html#a5105155c6ef43ae632c2f8ef74968324">metadata</a>); <a name="l00081"></a>00081 <a name="l00082"></a>00082 <span class="comment">// Create a loadplan to mark the end of the operationplan.</span> <a name="l00083"></a>00083 <span class="keyword">new</span> <a class="code" href="a00105.html#af510b8574f749397aabc3bbc0310db5b">LoadPlan</a>(o, r, <span class="keyword">this</span>); <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="comment">// Mark the operation and resource as being changed. This will trigger</span> <a name="l00086"></a>00086 <span class="comment">// the recomputation of their problems</span> <a name="l00087"></a>00087 r-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00088"></a>00088 r-><a class="code" href="a00103.html#a6cb533b9f893a9af0137bf78b07e3987">getOperation</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00089"></a>00089 } <a name="l00090"></a>00090 <a name="l00091"></a>00091 <a name="l00092"></a>00092 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00105.html#af510b8574f749397aabc3bbc0310db5b">LoadPlan::LoadPlan</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> *o, <span class="keyword">const</span> <a class="code" href="a00103.html" title="This class links a resource to a certain operation.">Load</a> *r, <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *lp) <a name="l00093"></a>00093 { <a name="l00094"></a>00094 ld = <span class="keyword">const_cast<</span><a class="code" href="a00103.html" title="This class links a resource to a certain operation.">Load</a>*<span class="keyword">></span>(r); <a name="l00095"></a>00095 oper = o; <a name="l00096"></a>00096 start_or_end = END; <a name="l00097"></a>00097 <a name="l00098"></a>00098 <span class="comment">// Add to the operationplan</span> <a name="l00099"></a>00099 nextLoadPlan = NULL; <a name="l00100"></a>00100 <span class="keywordflow">if</span> (o->firstloadplan) <a name="l00101"></a>00101 { <a name="l00102"></a>00102 <span class="comment">// Append to the end</span> <a name="l00103"></a>00103 <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *c = o->firstloadplan; <a name="l00104"></a>00104 <span class="keywordflow">while</span> (c->nextLoadPlan) c = c->nextLoadPlan; <a name="l00105"></a>00105 c->nextLoadPlan = <span class="keyword">this</span>; <a name="l00106"></a>00106 } <a name="l00107"></a>00107 <span class="keywordflow">else</span> <a name="l00108"></a>00108 <span class="comment">// First in the list</span> <a name="l00109"></a>00109 o->firstloadplan = <span class="keyword">this</span>; <a name="l00110"></a>00110 <a name="l00111"></a>00111 <span class="comment">// Insert in the resource timeline</span> <a name="l00112"></a>00112 r-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()->loadplans.insert( <a name="l00113"></a>00113 <span class="keyword">this</span>, <a name="l00114"></a>00114 ld->getLoadplanQuantity(<span class="keyword">this</span>), <a name="l00115"></a>00115 ld->getLoadplanDate(<span class="keyword">this</span>) <a name="l00116"></a>00116 ); <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="comment">// Initialize the Python type</span> <a name="l00119"></a>00119 <a class="code" href="a00151.html#ae5f2cd7cfa5367e07b3de396fe98fbfd">initType</a>(<a class="code" href="a00105.html#a5105155c6ef43ae632c2f8ef74968324">metadata</a>); <a name="l00120"></a>00120 } <a name="l00121"></a>00121 <a name="l00122"></a>00122 <a name="l00123"></a><a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">00123</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>* <a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">LoadPlan::getOtherLoadPlan</a>()<span class="keyword"> const</span> <a name="l00124"></a>00124 <span class="keyword"></span>{ <a name="l00125"></a>00125 <span class="keywordflow">for</span> (<a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *i = oper->firstloadplan; i; i = i->nextLoadPlan) <a name="l00126"></a>00126 <span class="keywordflow">if</span> (i->ld == ld && i != <span class="keyword">this</span>) <span class="keywordflow">return</span> i; <a name="l00127"></a>00127 <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">"No matching loadplan found"</span>); <a name="l00128"></a>00128 } <a name="l00129"></a>00129 <a name="l00130"></a>00130 <a name="l00131"></a><a class="code" href="a00105.html#a10145d82ee2c48553803262480792f2d">00131</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00105.html#a10145d82ee2c48553803262480792f2d">LoadPlan::update</a>() <a name="l00132"></a>00132 { <a name="l00133"></a>00133 <span class="comment">// Update the timeline data structure</span> <a name="l00134"></a>00134 ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().update( <a name="l00135"></a>00135 <span class="keyword">this</span>, <a name="l00136"></a>00136 ld-><a class="code" href="a00103.html#a61b673421557d1b833d841502fa851a9">getLoadplanQuantity</a>(<span class="keyword">this</span>), <a name="l00137"></a>00137 ld-><a class="code" href="a00103.html#a7379c868caf6f7d20ba18a6235ede122">getLoadplanDate</a>(<span class="keyword">this</span>) <a name="l00138"></a>00138 ); <a name="l00139"></a>00139 <a name="l00140"></a>00140 <span class="comment">// Review adjacent setups</span> <a name="l00141"></a>00141 <span class="keywordflow">if</span> (!<a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>()) ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a31e8e7adb37b107cd64d9dba09be0555">updateSetups</a>(<span class="keyword">this</span>); <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="comment">// Mark the operation and resource as being changed. This will trigger</span> <a name="l00144"></a>00144 <span class="comment">// the recomputation of their problems</span> <a name="l00145"></a>00145 ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00146"></a>00146 ld-><a class="code" href="a00103.html#a6cb533b9f893a9af0137bf78b07e3987">getOperation</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00147"></a>00147 } <a name="l00148"></a>00148 <a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="a00105.html#a15b97b617417b2186a43a4b827ecee73">00150</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keyword">const</span> <span class="keywordtype">string</span>& <a class="code" href="a00105.html#a15b97b617417b2186a43a4b827ecee73">LoadPlan::getSetup</a>(<span class="keywordtype">bool</span> current)<span class="keyword"> const</span> <a name="l00151"></a>00151 <span class="keyword"></span>{ <a name="l00152"></a>00152 <span class="comment">// This resource has no setupmatrix</span> <a name="l00153"></a>00153 <span class="keyword">static</span> <span class="keywordtype">string</span> nosetup; <a name="l00154"></a>00154 assert(ld); <a name="l00155"></a>00155 <span class="keywordflow">if</span> (!ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>()) <span class="keywordflow">return</span> nosetup; <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">// Current load has a setup</span> <a name="l00158"></a>00158 <span class="keywordflow">if</span> (!ld-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>().empty() && current) <span class="keywordflow">return</span> ld-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>(); <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="comment">// Scan earlier setups</span> <a name="l00161"></a>00161 <span class="keywordflow">for</span> (Resource::loadplanlist::const_iterator i(<span class="keyword">this</span>); <a name="l00162"></a>00162 i != <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end(); --i) <a name="l00163"></a>00163 { <a name="l00164"></a>00164 <span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>* j = <span class="keyword">dynamic_cast<</span><span class="keyword">const </span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(&*i); <a name="l00165"></a>00165 <span class="keywordflow">if</span> (j && !j-><a class="code" href="a00105.html#aa62c4a262f2146c1f53f032314aebe97">getLoad</a>()-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>().empty() && (current || j != <span class="keyword">this</span>)) <a name="l00166"></a>00166 <span class="keywordflow">return</span> j-><a class="code" href="a00105.html#aa62c4a262f2146c1f53f032314aebe97">getLoad</a>()-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>(); <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a>00169 <span class="comment">// No conversions found - return the original setup</span> <a name="l00170"></a>00170 <span class="keywordflow">return</span> ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a2c8506a14137a874a02280ce0933a90e">getSetup</a>(); <a name="l00171"></a>00171 } <a name="l00172"></a>00172 <a name="l00173"></a>00173 <a name="l00174"></a><a class="code" href="a00105.html#a845aea8535b5fd2bbc91bd95ba517995">00174</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00105.html#a845aea8535b5fd2bbc91bd95ba517995">LoadPlan::~LoadPlan</a>() <a name="l00175"></a>00175 { <a name="l00176"></a>00176 ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00177"></a>00177 <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *prevldplan = NULL; <a name="l00178"></a>00178 <span class="keywordflow">if</span> (!<a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>() && oper-><a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>() == <a class="code" href="a00129.html#add35ebccc253401c86cc40dc2fed3f04">OperationSetup::setupoperation</a>) <a name="l00179"></a>00179 { <a name="l00180"></a>00180 <span class="keywordflow">for</span> (<a class="code" href="a00178.html" title="This class implements a &quot;sorted list&quot; data structure, sorting &quot;events&quot;...">TimeLine<LoadPlan>::const_iterator</a> i = <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().begin(<a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>() ? <a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">getOtherLoadPlan</a>() : <span class="keyword">this</span>); <a name="l00181"></a>00181 i != <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end(); --i) <a name="l00182"></a>00182 { <a name="l00183"></a>00183 <span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *l = <span class="keyword">dynamic_cast<</span><span class="keyword">const </span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(&*i); <a name="l00184"></a>00184 <span class="keywordflow">if</span> (l && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() <a name="l00185"></a>00185 && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a5d8b863740c3c1a948442c470e603393">getOwner</a>() <a name="l00186"></a>00186 && !l-><a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>()) <a name="l00187"></a>00187 { <a name="l00188"></a>00188 prevldplan = <span class="keyword">const_cast<</span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(l); <a name="l00189"></a>00189 <span class="keywordflow">break</span>; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 } <a name="l00192"></a>00192 <span class="keywordflow">if</span> (!prevldplan) <a name="l00193"></a>00193 { <a name="l00194"></a>00194 <span class="keywordflow">for</span> (<a class="code" href="a00178.html" title="This class implements a &quot;sorted list&quot; data structure, sorting &quot;events&quot;...">TimeLine<LoadPlan>::const_iterator</a> i = <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().begin(<a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>() ? <a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">getOtherLoadPlan</a>() : <span class="keyword">this</span>); <a name="l00195"></a>00195 i != <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end(); ++i) <a name="l00196"></a>00196 { <a name="l00197"></a>00197 <span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *l = <span class="keyword">dynamic_cast<</span><span class="keyword">const </span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(&*i); <a name="l00198"></a>00198 <span class="keywordflow">if</span> (l && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() <a name="l00199"></a>00199 && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a5d8b863740c3c1a948442c470e603393">getOwner</a>() <a name="l00200"></a>00200 && !l-><a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>()) <a name="l00201"></a>00201 { <a name="l00202"></a>00202 prevldplan = <span class="keyword">const_cast<</span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(l); <a name="l00203"></a>00203 <span class="keywordflow">break</span>; <a name="l00204"></a>00204 } <a name="l00205"></a>00205 } <a name="l00206"></a>00206 } <a name="l00207"></a>00207 } <a name="l00208"></a>00208 ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()->loadplans.erase(<span class="keyword">this</span>); <a name="l00209"></a>00209 <span class="keywordflow">if</span> (prevldplan) ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a31e8e7adb37b107cd64d9dba09be0555">updateSetups</a>(prevldplan); <a name="l00210"></a>00210 } <a name="l00211"></a>00211 <a name="l00212"></a>00212 <a name="l00213"></a><a class="code" href="a00105.html#af29285721b0f1da7828967fd751bf252">00213</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00105.html#af29285721b0f1da7828967fd751bf252">LoadPlan::setLoad</a>(<span class="keyword">const</span> <a class="code" href="a00103.html" title="This class links a resource to a certain operation.">Load</a>* newld) <a name="l00214"></a>00214 { <a name="l00215"></a>00215 <span class="comment">// No change</span> <a name="l00216"></a>00216 <span class="keywordflow">if</span> (newld == ld) <span class="keywordflow">return</span>; <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="comment">// Verify the data</span> <a name="l00219"></a>00219 <span class="keywordflow">if</span> (!newld) <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">"Can't switch to NULL load"</span>); <a name="l00220"></a>00220 <span class="keywordflow">if</span> (ld && ld-><a class="code" href="a00103.html#a6cb533b9f893a9af0137bf78b07e3987">getOperation</a>() != newld-><a class="code" href="a00103.html#a6cb533b9f893a9af0137bf78b07e3987">getOperation</a>()) <a name="l00221"></a>00221 <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">"Only switching to a load on the same operation is allowed"</span>); <a name="l00222"></a>00222 <a name="l00223"></a>00223 <span class="comment">// Mark entities as changed</span> <a name="l00224"></a>00224 <span class="keywordflow">if</span> (oper) oper-><a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00225"></a>00225 <span class="keywordflow">if</span> (ld) ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00226"></a>00226 newld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00227"></a>00227 <a name="l00228"></a>00228 <span class="comment">// Update also the setup operationplan</span> <a name="l00229"></a>00229 <span class="keywordflow">if</span> (oper && oper-><a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>() != <a class="code" href="a00129.html#add35ebccc253401c86cc40dc2fed3f04">OperationSetup::setupoperation</a>) <a name="l00230"></a>00230 { <a name="l00231"></a>00231 <span class="keywordtype">bool</span> oldHasSetup = ld && !ld-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>().empty() <a name="l00232"></a>00232 && ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>(); <a name="l00233"></a>00233 <span class="keywordtype">bool</span> newHasSetup = !newld-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>().empty() <a name="l00234"></a>00234 && newld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>(); <a name="l00235"></a>00235 <a class="code" href="a00125.html" title="An operationplan is the key dynamic element of a plan. It represents a certain quantity...">OperationPlan</a> *setupOpplan = NULL; <a name="l00236"></a>00236 <span class="keywordflow">if</span> (oldHasSetup) <a name="l00237"></a>00237 { <a name="l00238"></a>00238 <span class="keywordflow">for</span> (<a class="code" href="a00093.html" title="This class models an STL-like iterator that allows us to iterate over the operationplans...">OperationPlan::iterator</a> i(oper); i != oper-><a class="code" href="a00125.html#a0f9f6ba7d4fe7e20e9b88c765fe24f25">end</a>(); ++i) <a name="l00239"></a>00239 <span class="keywordflow">if</span> (i->getOperation() == <a class="code" href="a00129.html#add35ebccc253401c86cc40dc2fed3f04">OperationSetup::setupoperation</a>) <a name="l00240"></a>00240 { <a name="l00241"></a>00241 setupOpplan = &*i; <a name="l00242"></a>00242 <span class="keywordflow">break</span>; <a name="l00243"></a>00243 } <a name="l00244"></a>00244 <span class="keywordflow">if</span> (!setupOpplan) oldHasSetup = <span class="keyword">false</span>; <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <span class="keywordflow">if</span> (oldHasSetup) <a name="l00247"></a>00247 { <a name="l00248"></a>00248 <span class="keywordflow">if</span> (newHasSetup) <a name="l00249"></a>00249 { <a name="l00250"></a>00250 <span class="comment">// Case 1: Both the old and new load require a setup</span> <a name="l00251"></a>00251 <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *setupLdplan = NULL; <a name="l00252"></a>00252 <span class="keywordflow">for</span> (<a class="code" href="a00106.html" title="An iterator class to go through all loadplans of an operationplan.">OperationPlan::LoadPlanIterator</a> j = setupOpplan-><a class="code" href="a00125.html#af14047934961e9c5f04c0ecc70df649c">beginLoadPlans</a>(); <a name="l00253"></a>00253 j != setupOpplan-><a class="code" href="a00125.html#af4b4401df92ad9e292edd56d3272b79c">endLoadPlans</a>(); ++j) <a name="l00254"></a>00254 <span class="keywordflow">if</span> (j->getLoad() == ld) <a name="l00255"></a>00255 { <a name="l00256"></a>00256 setupLdplan = &*j; <a name="l00257"></a>00257 <span class="keywordflow">break</span>; <a name="l00258"></a>00258 } <a name="l00259"></a>00259 <span class="keywordflow">if</span> (!setupLdplan) <a name="l00260"></a>00260 <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">"Can't find loadplan on setup operationplan"</span>); <a name="l00261"></a>00261 <span class="comment">// Update the loadplan</span> <a name="l00262"></a>00262 setupLdplan-><a class="code" href="a00105.html#af29285721b0f1da7828967fd751bf252">setLoad</a>(newld); <a name="l00263"></a>00263 setupOpplan-><a class="code" href="a00125.html#af70f6b33dcda3739d1c090a632408cd4">setEnd</a>(setupOpplan-><a class="code" href="a00125.html#a9f19aec0a96f30616f2ee06e3c8f371a">getDates</a>().<a class="code" href="a00050.html#a165a8f748d8468e5ba8331c0e06bd3a2">getEnd</a>()); <a name="l00264"></a>00264 } <a name="l00265"></a>00265 <span class="keywordflow">else</span> <a name="l00266"></a>00266 { <a name="l00267"></a>00267 <span class="comment">// Case 2: Delete the old setup which is not required any more</span> <a name="l00268"></a>00268 oper-><a class="code" href="a00125.html#a229e9661189af68191319f759f3021a5">eraseSubOperationPlan</a>(setupOpplan); <a name="l00269"></a>00269 } <a name="l00270"></a>00270 } <a name="l00271"></a>00271 <span class="keywordflow">else</span> <a name="l00272"></a>00272 { <a name="l00273"></a>00273 <span class="keywordflow">if</span> (newHasSetup) <a name="l00274"></a>00274 { <a name="l00275"></a>00275 <span class="comment">// Case 3: Create a new setup operationplan</span> <a name="l00276"></a>00276 <a class="code" href="a00129.html#add35ebccc253401c86cc40dc2fed3f04">OperationSetup::setupoperation</a>-><a class="code" href="a00121.html#ad183a2e72b75cdd83f9e71f6bc235424">createOperationPlan</a>( <a name="l00277"></a>00277 1, Date::infinitePast, oper-><a class="code" href="a00125.html#a9f19aec0a96f30616f2ee06e3c8f371a">getDates</a>().<a class="code" href="a00050.html#a165a8f748d8468e5ba8331c0e06bd3a2">getEnd</a>(), NULL, oper); <a name="l00278"></a>00278 } <a name="l00279"></a>00279 <span class="comment">//else: </span> <a name="l00280"></a>00280 <span class="comment">// Case 4: No setup for the old or new load</span> <a name="l00281"></a>00281 } <a name="l00282"></a>00282 } <a name="l00283"></a>00283 <a name="l00284"></a>00284 <span class="comment">// Find the loadplan before the setup</span> <a name="l00285"></a>00285 <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *prevldplan = NULL; <a name="l00286"></a>00286 <span class="keywordflow">if</span> (<a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>() == <a class="code" href="a00129.html#add35ebccc253401c86cc40dc2fed3f04">OperationSetup::setupoperation</a>) <a name="l00287"></a>00287 { <a name="l00288"></a>00288 <span class="keywordflow">for</span> (<a class="code" href="a00178.html" title="This class implements a &quot;sorted list&quot; data structure, sorting &quot;events&quot;...">TimeLine<LoadPlan>::const_iterator</a> i = <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().begin(<a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>() ? <a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">getOtherLoadPlan</a>() : <span class="keyword">this</span>); <a name="l00289"></a>00289 i != <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end(); --i) <a name="l00290"></a>00290 { <a name="l00291"></a>00291 <span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *l = <span class="keyword">dynamic_cast<</span><span class="keyword">const </span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(&*i); <a name="l00292"></a>00292 <span class="keywordflow">if</span> (l && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() <a name="l00293"></a>00293 && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a5d8b863740c3c1a948442c470e603393">getOwner</a>() <a name="l00294"></a>00294 && !l-><a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>()) <a name="l00295"></a>00295 { <a name="l00296"></a>00296 prevldplan = <span class="keyword">const_cast<</span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(l); <a name="l00297"></a>00297 <span class="keywordflow">break</span>; <a name="l00298"></a>00298 } <a name="l00299"></a>00299 } <a name="l00300"></a>00300 <span class="keywordflow">if</span> (!prevldplan) <a name="l00301"></a>00301 { <a name="l00302"></a>00302 <span class="keywordflow">for</span> (<a class="code" href="a00178.html" title="This class implements a &quot;sorted list&quot; data structure, sorting &quot;events&quot;...">TimeLine<LoadPlan>::const_iterator</a> i = <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().begin(<a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>() ? <a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">getOtherLoadPlan</a>() : <span class="keyword">this</span>); <a name="l00303"></a>00303 i != <a class="code" href="a00105.html#a88541f3fad5fb0f1b12fc2cb91908e7e">getResource</a>()-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end(); ++i) <a name="l00304"></a>00304 { <a name="l00305"></a>00305 <span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *l = <span class="keyword">dynamic_cast<</span><span class="keyword">const </span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(&*i); <a name="l00306"></a>00306 <span class="keywordflow">if</span> (l && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() <a name="l00307"></a>00307 && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != <a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a5d8b863740c3c1a948442c470e603393">getOwner</a>() <a name="l00308"></a>00308 && !l-><a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>()) <a name="l00309"></a>00309 { <a name="l00310"></a>00310 prevldplan = <span class="keyword">const_cast<</span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(l); <a name="l00311"></a>00311 <span class="keywordflow">break</span>; <a name="l00312"></a>00312 } <a name="l00313"></a>00313 } <a name="l00314"></a>00314 } <a name="l00315"></a>00315 } <a name="l00316"></a>00316 <a name="l00317"></a>00317 <span class="comment">// Change this loadplan and its brother</span> <a name="l00318"></a>00318 <span class="keywordflow">for</span> (<a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *ldplan = <a class="code" href="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">getOtherLoadPlan</a>(); <span class="keyword">true</span>; ) <a name="l00319"></a>00319 { <a name="l00320"></a>00320 <span class="comment">// Remove from the old resource, if there is one</span> <a name="l00321"></a>00321 <span class="keywordflow">if</span> (ldplan->ld) <a name="l00322"></a>00322 ldplan->ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()->loadplans.erase(ldplan); <a name="l00323"></a>00323 <a name="l00324"></a>00324 <span class="comment">// Insert in the new resource</span> <a name="l00325"></a>00325 ldplan->ld = newld; <a name="l00326"></a>00326 newld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()->loadplans.insert( <a name="l00327"></a>00327 ldplan, <a name="l00328"></a>00328 newld-><a class="code" href="a00103.html#a61b673421557d1b833d841502fa851a9">getLoadplanQuantity</a>(ldplan), <a name="l00329"></a>00329 newld-><a class="code" href="a00103.html#a7379c868caf6f7d20ba18a6235ede122">getLoadplanDate</a>(ldplan) <a name="l00330"></a>00330 ); <a name="l00331"></a>00331 <a name="l00332"></a>00332 <span class="comment">// Repeat for the brother loadplan or exit</span> <a name="l00333"></a>00333 <span class="keywordflow">if</span> (ldplan != <span class="keyword">this</span>) ldplan = <span class="keyword">this</span>; <a name="l00334"></a>00334 <span class="keywordflow">else</span> <span class="keywordflow">break</span>; <a name="l00335"></a>00335 } <a name="l00336"></a>00336 <a name="l00337"></a>00337 <span class="comment">// Update the setups on the old resource</span> <a name="l00338"></a>00338 <span class="keywordflow">if</span> (prevldplan) <a name="l00339"></a>00339 prevldplan->ld-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()-><a class="code" href="a00156.html#a31e8e7adb37b107cd64d9dba09be0555">updateSetups</a>(prevldplan); <a name="l00340"></a>00340 } <a name="l00341"></a>00341 <a name="l00342"></a>00342 <a name="l00343"></a><a class="code" href="a00105.html#a9a3adbd225be3dac4ff62f622b1b6a66">00343</a> PyObject* <a class="code" href="a00105.html#a9a3adbd225be3dac4ff62f622b1b6a66">LoadPlan::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>& attr) <a name="l00344"></a>00344 { <a name="l00345"></a>00345 <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="l00346"></a>00346 <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="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()); <a name="l00347"></a>00347 <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="l00348"></a>00348 <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="l00349"></a>00349 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ad9f517eb408578e29b6ad9f219174a17">Tags::tag_startdate</a>)) <a name="l00350"></a>00350 <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="l00351"></a>00351 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6ed90c86398dbf951ebdee0a767f2e28">Tags::tag_enddate</a>)) <a name="l00352"></a>00352 <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="a00105.html#acad3d65dc1ef64a74ba42474d5dd20fa">getOtherLoadPlan</a>()-><a class="code" href="a00058.html#a965645e70dd9f99b0bd4f1325fb382aa">getDate</a>()); <a name="l00353"></a>00353 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6d26a78a470df1af466b504a120ff98f">Tags::tag_resource</a>)) <a name="l00354"></a>00354 <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="a00105.html#aa62c4a262f2146c1f53f032314aebe97">getLoad</a>()-><a class="code" href="a00103.html#ab929aafe9c6085a216ad3084ec23c93b">getResource</a>()); <a name="l00355"></a>00355 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ad82a69d14ccb381f200a1af582cb98e2">Tags::tag_load</a>)) <a name="l00356"></a>00356 <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="a00105.html#aa62c4a262f2146c1f53f032314aebe97">getLoad</a>()); <a name="l00357"></a>00357 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a16bef223df3695e99b5e22a14ce0ef20">Tags::tag_setup</a>)) <a name="l00358"></a>00358 <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="a00105.html#a15b97b617417b2186a43a4b827ecee73">getSetup</a>()); <a name="l00359"></a>00359 <span class="keywordflow">return</span> NULL; <a name="l00360"></a>00360 } <a name="l00361"></a>00361 <a name="l00362"></a>00362 <a name="l00363"></a><a class="code" href="a00107.html#ad6aea221aa9a5381274f2bb84e64ae17">00363</a> <span class="keywordtype">int</span> <a class="code" href="a00107.html#ad6aea221aa9a5381274f2bb84e64ae17">LoadPlanIterator::initialize</a>() <a name="l00364"></a>00364 { <a name="l00365"></a>00365 <span class="comment">// Initialize the type</span> <a name="l00366"></a>00366 <a class="code" href="a00155.html" title="This class is a thin wrapper around the type information in Python.">PythonType</a>& x = <a class="code" href="a00150.html#aec65c2cd811051918027ae6dc00fcfaf">PythonExtension<LoadPlanIterator>::getType</a>(); <a name="l00367"></a>00367 x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">"loadplanIterator"</span>); <a name="l00368"></a>00368 x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">"frePPLe iterator for loadplan"</span>); <a name="l00369"></a>00369 x.<a class="code" href="a00155.html#a5bacf8ad021ab55b1056440880cf8760">supportiter</a>(); <a name="l00370"></a>00370 <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>(); <a name="l00371"></a>00371 } <a name="l00372"></a>00372 <a name="l00373"></a>00373 <a name="l00374"></a>00374 PyObject* LoadPlanIterator::iternext() <a name="l00375"></a>00375 { <a name="l00376"></a>00376 <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>* ld; <a name="l00377"></a>00377 <span class="keywordflow">if</span> (resource_or_opplan) <a name="l00378"></a>00378 { <a name="l00379"></a>00379 <span class="comment">// Skip zero quantity loadplans and load ends</span> <a name="l00380"></a>00380 <span class="keywordflow">while</span> (*<a class="code" href="a00107.html#adffe4e87b2f9d60e611f9c9d9a1c63f2">resiter</a> != <a class="code" href="a00107.html#a920c1df2b6a9fc996ccb405b4f62ffd4">res</a>-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end() && (*resiter)->getQuantity()<=0.0) <a name="l00381"></a>00381 ++(*resiter); <a name="l00382"></a>00382 <span class="keywordflow">if</span> (*<a class="code" href="a00107.html#adffe4e87b2f9d60e611f9c9d9a1c63f2">resiter</a> == <a class="code" href="a00107.html#a920c1df2b6a9fc996ccb405b4f62ffd4">res</a>-><a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().end()) <span class="keywordflow">return</span> NULL; <a name="l00383"></a>00383 <a name="l00384"></a>00384 <span class="comment">// Return result</span> <a name="l00385"></a>00385 ld = <span class="keyword">const_cast<</span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(<span class="keyword">static_cast<</span><span class="keyword">const </span><a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>*<span class="keyword">></span>(&*((*resiter)++))); <a name="l00386"></a>00386 } <a name="l00387"></a>00387 <span class="keywordflow">else</span> <a name="l00388"></a>00388 { <a name="l00389"></a>00389 <span class="keywordflow">while</span> (*<a class="code" href="a00107.html#a0d153a793f2473518def4d791f2a83f9">opplaniter</a> != <a class="code" href="a00107.html#aa83319301475464ea115cf78694706fa">opplan</a>->endLoadPlans() && (*opplaniter)->getQuantity()==0.0) <a name="l00390"></a>00390 ++(*opplaniter); <a name="l00391"></a>00391 <span class="keywordflow">if</span> (*<a class="code" href="a00107.html#a0d153a793f2473518def4d791f2a83f9">opplaniter</a> == <a class="code" href="a00107.html#aa83319301475464ea115cf78694706fa">opplan</a>->endLoadPlans()) <span class="keywordflow">return</span> NULL; <a name="l00392"></a>00392 ld = <span class="keyword">static_cast<</span>LoadPlan*<span class="keyword">></span>(&*((*opplaniter)++)); <a name="l00393"></a>00393 } <a name="l00394"></a>00394 Py_INCREF(ld); <a name="l00395"></a>00395 <span class="keywordflow">return</span> <span class="keyword">const_cast<</span>LoadPlan*<span class="keyword">></span>(ld); <a name="l00396"></a>00396 } <a name="l00397"></a>00397 <a name="l00398"></a>00398 } <span class="comment">// end namespace</span> </pre></div></div> <hr size="1"/><address style="align: right;"><small>Documentation generated for frePPLe by <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>