<!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: resource.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>resource.cpp</h1><a href="a00235.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/resource.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="a00235.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 <span class="keyword">template</span><<span class="keyword">class</span> Resource> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00181.html" title="This class implements a binary tree data structure. It is used as a container for...">Tree</a> utils::HasName<Resource>::st; <a name="l00035"></a>00035 <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="a00156.html#a1be825fa478f96d8d3a67d18b50eace6">Resource::metadata</a>; <a name="l00036"></a>00036 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keyword">const</span> <a class="code" href="a00115.html" title="This class stores metadata about the classes in the library. The stored information...">MetaClass</a>* <a class="code" href="a00157.html#a374498bb40845e98eee8fd17d095c1c6">ResourceDefault::metadata</a>; <a name="l00037"></a>00037 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keyword">const</span> <a class="code" href="a00115.html" title="This class stores metadata about the classes in the library. The stored information...">MetaClass</a>* <a class="code" href="a00158.html#a0664e858a1584b883135fb8e0f095479">ResourceInfinite::metadata</a>; <a name="l00038"></a>00038 <a name="l00039"></a>00039 <a name="l00040"></a><a class="code" href="a00156.html#a924410474c6eb748927eada72ac6b574">00040</a> <span class="keywordtype">int</span> <a class="code" href="a00156.html#a924410474c6eb748927eada72ac6b574">Resource::initialize</a>() <a name="l00041"></a>00041 { <a name="l00042"></a>00042 <span class="comment">// Initialize the metadata</span> <a name="l00043"></a>00043 <a class="code" href="a00156.html#a1be825fa478f96d8d3a67d18b50eace6">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">"resource"</span>, <span class="stringliteral">"resources"</span>, <a class="code" href="a00085.html#ac14340cc8781e6f2b7235d50a1d17914">reader</a>, <a class="code" href="a00085.html#a1071369052edea444a06baa35d7e991e">writer</a>); <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="comment">// Initialize the Python class</span> <a name="l00046"></a>00046 <span class="keywordflow">return</span> <a class="code" href="a00156.html#a924410474c6eb748927eada72ac6b574">FreppleCategory<Resource>::initialize</a>(); <a name="l00047"></a>00047 } <a name="l00048"></a>00048 <a name="l00049"></a>00049 <a name="l00050"></a><a class="code" href="a00157.html#a1edd19a82fa1940a725c229c2ddeda42">00050</a> <span class="keywordtype">int</span> <a class="code" href="a00157.html#a1edd19a82fa1940a725c229c2ddeda42">ResourceDefault::initialize</a>() <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <span class="comment">// Initialize the metadata</span> <a name="l00053"></a>00053 <a class="code" href="a00157.html#a374498bb40845e98eee8fd17d095c1c6">ResourceDefault::metadata</a> = <span class="keyword">new</span> <a class="code" href="a00115.html" title="This class stores metadata about the classes in the library. The stored information...">MetaClass</a>( <a name="l00054"></a>00054 <span class="stringliteral">"resource"</span>, <a name="l00055"></a>00055 <span class="stringliteral">"resource_default"</span>, <a name="l00056"></a>00056 Object::createString<ResourceDefault>, <a name="l00057"></a>00057 <span class="keyword">true</span>); <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="comment">// Initialize the Python class</span> <a name="l00060"></a>00060 <span class="keywordflow">return</span> <a class="code" href="a00157.html#a1edd19a82fa1940a725c229c2ddeda42">FreppleClass<ResourceDefault,Resource>::initialize</a>(); <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <a name="l00063"></a>00063 <a name="l00064"></a><a class="code" href="a00158.html#aa933cbb620c1425084b9ee6c59eafa74">00064</a> <span class="keywordtype">int</span> <a class="code" href="a00158.html#aa933cbb620c1425084b9ee6c59eafa74">ResourceInfinite::initialize</a>() <a name="l00065"></a>00065 { <a name="l00066"></a>00066 <span class="comment">// Initialize the metadata</span> <a name="l00067"></a>00067 <a class="code" href="a00158.html#a0664e858a1584b883135fb8e0f095479">ResourceInfinite::metadata</a> = <span class="keyword">new</span> <a class="code" href="a00115.html" title="This class stores metadata about the classes in the library. The stored information...">MetaClass</a>( <a name="l00068"></a>00068 <span class="stringliteral">"resource"</span>, <a name="l00069"></a>00069 <span class="stringliteral">"resource_infinite"</span>, <a name="l00070"></a>00070 Object::createString<ResourceInfinite>); <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="comment">// Initialize the Python class</span> <a name="l00073"></a>00073 <span class="keywordflow">return</span> <a class="code" href="a00158.html#aa933cbb620c1425084b9ee6c59eafa74">FreppleClass<ResourceInfinite,Resource>::initialize</a>(); <a name="l00074"></a>00074 } <a name="l00075"></a>00075 <a name="l00076"></a>00076 <a name="l00077"></a><a class="code" href="a00156.html#a87a25645d9e8896221820cc5d6a39df0">00077</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00156.html#a87a25645d9e8896221820cc5d6a39df0">Resource::setMaximum</a>(<a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a>* c) <a name="l00078"></a>00078 { <a name="l00079"></a>00079 <span class="comment">// Resetting the same calendar</span> <a name="l00080"></a>00080 <span class="keywordflow">if</span> (max_cal == c) <span class="keywordflow">return</span>; <a name="l00081"></a>00081 <a name="l00082"></a>00082 <span class="comment">// Mark as changed</span> <a name="l00083"></a>00083 <a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00084"></a>00084 <a name="l00085"></a>00085 <span class="comment">// Calendar is already set. Need to remove the current max events.</span> <a name="l00086"></a>00086 <span class="keywordflow">if</span> (max_cal) <a name="l00087"></a>00087 { <a name="l00088"></a>00088 <span class="keywordflow">for</span> (loadplanlist::iterator oo=loadplans.<a class="code" href="a00178.html#ad6fe958ddd6a9a63662a40079d777a2f">begin</a>(); oo!=loadplans.<a class="code" href="a00178.html#a247a6dfded3b61f1aeb838719ac295bc">end</a>(); ) <a name="l00089"></a>00089 <span class="keywordflow">if</span> (oo->getType() == 4) <a name="l00090"></a>00090 { <a name="l00091"></a>00091 loadplans.<a class="code" href="a00178.html#a8b48bf8187fd711ae67dcdd8e35c554f">erase</a>(&(*oo)); <a name="l00092"></a>00092 <span class="keyword">delete</span> &(*(oo++)); <a name="l00093"></a>00093 } <a name="l00094"></a>00094 <span class="keywordflow">else</span> ++oo; <a name="l00095"></a>00095 } <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="comment">// Null pointer passed</span> <a name="l00098"></a>00098 <span class="keywordflow">if</span> (!c) <span class="keywordflow">return</span>; <a name="l00099"></a>00099 <a name="l00100"></a>00100 <span class="comment">// Create timeline structures for every bucket.</span> <a name="l00101"></a>00101 max_cal = c; <a name="l00102"></a>00102 <span class="keywordtype">double</span> curMax = 0.0; <a name="l00103"></a>00103 <span class="keywordflow">for</span> (<a class="code" href="a00061.html" title="An iterator class to go through all dates where the calendar value changes.">CalendarDouble::EventIterator</a> x(max_cal); x.getDate()<Date::infiniteFuture; ++x) <a name="l00104"></a>00104 <span class="keywordflow">if</span> (curMax != x.getValue()) <a name="l00105"></a>00105 { <a name="l00106"></a>00106 curMax = x.<a class="code" href="a00023.html#a269067e065a9ca2a62be6cbfcf489fa1">getValue</a>(); <a name="l00107"></a>00107 loadplanlist::EventMaxQuantity *newBucket = <a name="l00108"></a>00108 <span class="keyword">new</span> loadplanlist::EventMaxQuantity(x.getDate(), curMax); <a name="l00109"></a>00109 loadplans.<a class="code" href="a00178.html#a8f2260de9aaf8f821d2ad3d097cf2a34">insert</a>(newBucket); <a name="l00110"></a>00110 } <a name="l00111"></a>00111 } <a name="l00112"></a>00112 <a name="l00113"></a>00113 <a name="l00114"></a><a class="code" href="a00156.html#a9b84a7753b5eca34228a34170d4b7174">00114</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00156.html#a9b84a7753b5eca34228a34170d4b7174">Resource::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>& tag, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398">mode</a> m)<span class="keyword"> const</span> <a name="l00115"></a>00115 <span class="keyword"></span>{ <a name="l00116"></a>00116 <span class="comment">// Write a reference</span> <a name="l00117"></a>00117 <span class="keywordflow">if</span> (m == <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a874240ada53cc5b608466064d86d91ae">REFERENCE</a>) <a name="l00118"></a>00118 { <a name="l00119"></a>00119 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>()); <a name="l00120"></a>00120 <span class="keywordflow">return</span>; <a name="l00121"></a>00121 } <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="comment">// Write the complete object</span> <a name="l00124"></a>00124 <span class="keywordflow">if</span> (m != <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a2ad5e75fe119e297630882d182832243">NOHEADER</a>) o-><a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>()); <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="comment">// Write my fields</span> <a name="l00127"></a>00127 <a class="code" href="a00156.html#a9b84a7753b5eca34228a34170d4b7174">HasDescription::writeElement</a>(o, tag); <a name="l00128"></a>00128 <a class="code" href="a00156.html#a9b84a7753b5eca34228a34170d4b7174">HasHierarchy<Resource>::writeElement</a>(o, tag); <a name="l00129"></a>00129 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>, max_cal); <a name="l00130"></a>00130 <span class="keywordflow">if</span> (<a class="code" href="a00156.html#a41799c1cc2defacadd1c97d576ada6a5">getMaxEarly</a>() != <a class="code" href="a00179.html" title="This class represents a time duration with an accuracy of one second.">TimePeriod</a>(<a class="code" href="a00156.html#a1bb5d90beb679d7e324131597196ab08">defaultMaxEarly</a>)) <a name="l00131"></a>00131 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a0fa5f96fbd30ae0cb40b3d8880ab8730">Tags::tag_maxearly</a>, <a class="code" href="a00156.html#a41799c1cc2defacadd1c97d576ada6a5">getMaxEarly</a>()); <a name="l00132"></a>00132 <span class="keywordflow">if</span> (<a class="code" href="a00156.html#ae9928a8cd7d0abc6f2b5c7f8b1852cfb">getCost</a>() != 0.0) o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a26ba9b767f074c42558fe812da43c8ab">Tags::tag_cost</a>, <a class="code" href="a00156.html#ae9928a8cd7d0abc6f2b5c7f8b1852cfb">getCost</a>()); <a name="l00133"></a>00133 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a3355294c37c4e6cd3a72a17115567071">Tags::tag_location</a>, loc); <a name="l00134"></a>00134 <span class="keywordflow">if</span> (!<a class="code" href="a00156.html#a2c8506a14137a874a02280ce0933a90e">getSetup</a>().<a class="code" href="a00085.html#a5514c78c650d5d2cc5dadc72869259fc">empty</a>()) o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a16bef223df3695e99b5e22a14ce0ef20">Tags::tag_setup</a>, <a class="code" href="a00156.html#a2c8506a14137a874a02280ce0933a90e">getSetup</a>()); <a name="l00135"></a>00135 <span class="keywordflow">if</span> (<a class="code" href="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>()) <a name="l00136"></a>00136 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a6114790dd7f73dde04060d0e3f3e89fb">Tags::tag_setupmatrix</a>, <a class="code" href="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>()); <a name="l00137"></a>00137 <a class="code" href="a00156.html#a9b84a7753b5eca34228a34170d4b7174">Plannable::writeElement</a>(o, tag); <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="comment">// Write extra plan information</span> <a name="l00140"></a>00140 loadplanlist::const_iterator i = loadplans.<a class="code" href="a00178.html#ad6fe958ddd6a9a63662a40079d777a2f">begin</a>(); <a name="l00141"></a>00141 <span class="keywordflow">if</span> (o-><a class="code" href="a00189.html#a364e86ed0671915df858bc52adadd29f">getContentType</a>() == XMLOutput::PLAN && i!=loadplans.<a class="code" href="a00178.html#a247a6dfded3b61f1aeb838719ac295bc">end</a>()) <a name="l00142"></a>00142 { <a name="l00143"></a>00143 o-><a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(<a class="code" href="a00177.html#a8af77889e6092a30c9b191a28a2c79d0">Tags::tag_loadplans</a>); <a name="l00144"></a>00144 <span class="keywordflow">for</span> (; i!=loadplans.<a class="code" href="a00178.html#a247a6dfded3b61f1aeb838719ac295bc">end</a>(); ++i) <a name="l00145"></a>00145 <span class="keywordflow">if</span> (i->getType()==1) <a name="l00146"></a>00146 { <a name="l00147"></a>00147 <span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a> *lp = <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="l00148"></a>00148 o-><a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(<a class="code" href="a00177.html#a46a644c5456f38b137a7bfab9ffb0ffc">Tags::tag_loadplan</a>); <a name="l00149"></a>00149 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#abca776609ba61919657e684eb8d88c55">Tags::tag_date</a>, lp-><a class="code" href="a00058.html#a965645e70dd9f99b0bd4f1325fb382aa">getDate</a>()); <a name="l00150"></a>00150 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ab99ddcbeef0f5d15a8731dcdffa0dcff">Tags::tag_quantity</a>, lp-><a class="code" href="a00059.html#a665af7bb916d05a8c9a06f1a8170090f">getQuantity</a>()); <a name="l00151"></a>00151 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a94ff585d707284cf4d69287f4ea4a9ba">Tags::tag_onhand</a>, lp-><a class="code" href="a00058.html#a8e4bb6dd9d8927b8de76747cb64ee693">getOnhand</a>()); <a name="l00152"></a>00152 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#ac361ec1b9a7c26e74fbc4c21acb99049">Tags::tag_minimum</a>, lp-><a class="code" href="a00058.html#af5bdea8d596cdb2ce0cf5efd40f38cc6">getMin</a>()); <a name="l00153"></a>00153 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>, lp-><a class="code" href="a00058.html#aa6d3b3c8966ba646bc261c2a346f115f">getMax</a>()); <a name="l00154"></a>00154 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#a6c742342d4a7f8112aca62435d43912a">Tags::tag_operationplan</a>, &*(lp-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()), <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398ae6f8960699e19b8d77b093b7e2c48619">FULL</a>); <a name="l00155"></a>00155 o-><a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(<a class="code" href="a00177.html#a46a644c5456f38b137a7bfab9ffb0ffc">Tags::tag_loadplan</a>); <a name="l00156"></a>00156 } <a name="l00157"></a>00157 o-><a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(<a class="code" href="a00177.html#a8af77889e6092a30c9b191a28a2c79d0">Tags::tag_loadplans</a>); <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="comment">// That was it</span> <a name="l00161"></a>00161 o-><a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(tag); <a name="l00162"></a>00162 } <a name="l00163"></a>00163 <a name="l00164"></a>00164 <a name="l00165"></a><a class="code" href="a00156.html#a3aebc6b1b8688cf955774731c842f3bc">00165</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00156.html#a3aebc6b1b8688cf955774731c842f3bc">Resource::beginElement</a>(<a class="code" href="a00186.html" title="This class will read in an XML-file and call the appropriate handler functions of...">XMLInput</a>& pIn, <span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>& pAttr) <a name="l00166"></a>00166 { <a name="l00167"></a>00167 <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#ad82a69d14ccb381f200a1af582cb98e2">Tags::tag_load</a>) <a name="l00168"></a>00168 && pIn.<a class="code" href="a00186.html#a407522e9d0dde7f7eebfafe182d050cf">getParentElement</a>().first.isA(<a class="code" href="a00177.html#a2e32d4c89079c071ec2bd8e634e9b440">Tags::tag_loads</a>)) <a name="l00169"></a>00169 { <a name="l00170"></a>00170 <a class="code" href="a00103.html" title="This class links a resource to a certain operation.">Load</a>* l = <span class="keyword">new</span> <a class="code" href="a00156.html#ada8f776cb873ad4dc1202c73c08d0f53">Load</a>(); <a name="l00171"></a>00171 l-><a class="code" href="a00103.html#a90023cac148b876db4f1bb3da876f21c">setResource</a>(<span class="keyword">this</span>); <a name="l00172"></a>00172 pIn.<a class="code" href="a00186.html#a88dd6be5af6fc605d2d420fbcb397b18">readto</a>(&*l); <a name="l00173"></a>00173 } <a name="l00174"></a>00174 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>)) <a name="l00175"></a>00175 pIn.<a class="code" href="a00186.html#a88dd6be5af6fc605d2d420fbcb397b18">readto</a>( <a class="code" href="a00085.html#ac14340cc8781e6f2b7235d50a1d17914">Calendar::reader</a>(<a class="code" href="a00013.html#a80be0bca89b0fd95ed0dfefa2f965a6f">Calendar::metadata</a>,pIn.<a class="code" href="a00186.html#adcc4751961526c0103536acd194d32a0">getAttributes</a>()) ); <a name="l00176"></a>00176 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a8af77889e6092a30c9b191a28a2c79d0">Tags::tag_loadplans</a>)) <a name="l00177"></a>00177 pIn.<a class="code" href="a00186.html#af1ffc5c65dd968dcb04a23e05a0da5ba">IgnoreElement</a>(); <a name="l00178"></a>00178 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a3355294c37c4e6cd3a72a17115567071">Tags::tag_location</a>)) <a name="l00179"></a>00179 pIn.<a class="code" href="a00186.html#a88dd6be5af6fc605d2d420fbcb397b18">readto</a>( <a class="code" href="a00085.html#ac14340cc8781e6f2b7235d50a1d17914">Location::reader</a>(<a class="code" href="a00108.html#a92b7d2941cf8330f08acd95992dc89ad">Location::metadata</a>,pIn.<a class="code" href="a00186.html#adcc4751961526c0103536acd194d32a0">getAttributes</a>()) ); <a name="l00180"></a>00180 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6114790dd7f73dde04060d0e3f3e89fb">Tags::tag_setupmatrix</a>)) <a name="l00181"></a>00181 pIn.<a class="code" href="a00186.html#a88dd6be5af6fc605d2d420fbcb397b18">readto</a>( <a class="code" href="a00085.html#ac14340cc8781e6f2b7235d50a1d17914">SetupMatrix::reader</a>(<a class="code" href="a00165.html#a1d872c221ddb757bd195c43c85ee160b">SetupMatrix::metadata</a>,pIn.<a class="code" href="a00186.html#adcc4751961526c0103536acd194d32a0">getAttributes</a>()) ); <a name="l00182"></a>00182 <span class="keywordflow">else</span> <a name="l00183"></a>00183 <a class="code" href="a00156.html#a3aebc6b1b8688cf955774731c842f3bc">HasHierarchy<Resource>::beginElement</a>(pIn, pAttr); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 <a name="l00186"></a>00186 <a name="l00187"></a><a class="code" href="a00156.html#a9c2b68e465e4a45d7e1c0f2125172eb6">00187</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00156.html#a9c2b68e465e4a45d7e1c0f2125172eb6">Resource::endElement</a> (<a class="code" href="a00186.html" title="This class will read in an XML-file and call the appropriate handler functions of...">XMLInput</a>& pIn, <span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>& pAttr, <span class="keyword">const</span> <a class="code" href="a00047.html" title="This abstract class represents a attribute and value pair for updating objects in...">DataElement</a>& pElement) <a name="l00188"></a>00188 { <a name="l00189"></a>00189 <span class="comment">/* Note that while restoring the size, the parent's size is NOT</span> <a name="l00190"></a>00190 <span class="comment"> automatically updated. The getDescription of the 'set_size' function may</span> <a name="l00191"></a>00191 <span class="comment"> suggest this would be the case... */</span> <a name="l00192"></a>00192 <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>)) <a name="l00193"></a>00193 { <a name="l00194"></a>00194 <a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a> * c = <span class="keyword">dynamic_cast<</span><a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a>*<span class="keyword">></span>(pIn.<a class="code" href="a00186.html#a98008d76b6971b2592ee5ae6f0f03d4c">getPreviousObject</a>()); <a name="l00195"></a>00195 <span class="keywordflow">if</span> (c) <a name="l00196"></a>00196 <a class="code" href="a00156.html#a87a25645d9e8896221820cc5d6a39df0">setMaximum</a>(c); <a name="l00197"></a>00197 <span class="keywordflow">else</span> <a name="l00198"></a>00198 { <a name="l00199"></a>00199 <a class="code" href="a00013.html" title="This is the class used to represent variables that are varying over time.">Calendar</a> *c = <span class="keyword">dynamic_cast<</span><a class="code" href="a00013.html" title="This is the class used to represent variables that are varying over time.">Calendar</a>*<span class="keyword">></span>(pIn.<a class="code" href="a00186.html#a98008d76b6971b2592ee5ae6f0f03d4c">getPreviousObject</a>()); <a name="l00200"></a>00200 <span class="keywordflow">if</span> (!c) <a name="l00201"></a>00201 <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">"Incorrect object type during read operation"</span>); <a name="l00202"></a>00202 <span class="keywordflow">throw</span> <a class="code" href="a00048.html" title="An exception of this type is thrown when data errors are found.">DataException</a>(<span class="stringliteral">"Calendar '"</span> + c-><a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>() + <a name="l00203"></a>00203 <span class="stringliteral">"' has invalid type for use as resource max calendar"</span>); <a name="l00204"></a>00204 } <a name="l00205"></a>00205 } <a name="l00206"></a>00206 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#a0fa5f96fbd30ae0cb40b3d8880ab8730">Tags::tag_maxearly</a>)) <a name="l00207"></a>00207 <a class="code" href="a00156.html#a4d6177c516049594125d8a9912abd7d0">setMaxEarly</a>(pElement.<a class="code" href="a00047.html#a41d128a13b3037cba281931330f7bdc1">getTimeperiod</a>()); <a name="l00208"></a>00208 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#a26ba9b767f074c42558fe812da43c8ab">Tags::tag_cost</a>)) <a name="l00209"></a>00209 <a class="code" href="a00156.html#aa1bc68aa40a950eddbb2e2376487dd41">setCost</a>(pElement.<a class="code" href="a00047.html#a88f1178689f984215c4bef4eb5a0d5d9">getDouble</a>()); <a name="l00210"></a>00210 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a3355294c37c4e6cd3a72a17115567071">Tags::tag_location</a>)) <a name="l00211"></a>00211 { <a name="l00212"></a>00212 <a class="code" href="a00108.html" title="This abstract class is used to associate buffers and resources with a physical or...">Location</a> * d = <span class="keyword">dynamic_cast<</span><a class="code" href="a00108.html" title="This abstract class is used to associate buffers and resources with a physical or...">Location</a>*<span class="keyword">></span>(pIn.<a class="code" href="a00186.html#a98008d76b6971b2592ee5ae6f0f03d4c">getPreviousObject</a>()); <a name="l00213"></a>00213 <span class="keywordflow">if</span> (d) <a class="code" href="a00156.html#a84f1b9ce3e3dfaddd30e83a44907caf3">setLocation</a>(d); <a name="l00214"></a>00214 <span class="keywordflow">else</span> <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">"Incorrect object type during read operation"</span>); <a name="l00215"></a>00215 } <a name="l00216"></a>00216 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#a16bef223df3695e99b5e22a14ce0ef20">Tags::tag_setup</a>)) <a name="l00217"></a>00217 <a class="code" href="a00156.html#a7ec55c828d9dbc5f94991f154e1315f7">setSetup</a>(pElement.<a class="code" href="a00047.html#a053aa4cde35b21a399f26bca0132ab3f">getString</a>()); <a name="l00218"></a>00218 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6114790dd7f73dde04060d0e3f3e89fb">Tags::tag_setupmatrix</a>)) <a name="l00219"></a>00219 { <a name="l00220"></a>00220 <a class="code" href="a00165.html" title="This class is used to represent a matrix defining the changeover times between setups...">SetupMatrix</a> * d = <span class="keyword">dynamic_cast<</span><a class="code" href="a00165.html" title="This class is used to represent a matrix defining the changeover times between setups...">SetupMatrix</a>*<span class="keyword">></span>(pIn.<a class="code" href="a00186.html#a98008d76b6971b2592ee5ae6f0f03d4c">getPreviousObject</a>()); <a name="l00221"></a>00221 <span class="keywordflow">if</span> (d) <a class="code" href="a00156.html#a31ff924489e39f5b7198f43260dfc9fc">setSetupMatrix</a>(d); <a name="l00222"></a>00222 <span class="keywordflow">else</span> <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">"Incorrect object type during read operation"</span>); <a name="l00223"></a>00223 } <a name="l00224"></a>00224 <span class="keywordflow">else</span> <a name="l00225"></a>00225 { <a name="l00226"></a>00226 <a class="code" href="a00156.html#a9c2b68e465e4a45d7e1c0f2125172eb6">Plannable::endElement</a>(pIn, pAttr, pElement); <a name="l00227"></a>00227 <a class="code" href="a00156.html#a9c2b68e465e4a45d7e1c0f2125172eb6">HasDescription::endElement</a>(pIn, pAttr, pElement); <a name="l00228"></a>00228 <a class="code" href="a00156.html#a9c2b68e465e4a45d7e1c0f2125172eb6">HasHierarchy<Resource>::endElement</a> (pIn, pAttr, pElement); <a name="l00229"></a>00229 } <a name="l00230"></a>00230 } <a name="l00231"></a>00231 <a name="l00232"></a>00232 <a name="l00233"></a><a class="code" href="a00156.html#ace1c6083e80d411d43f4ad3625e57304">00233</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00156.html#ace1c6083e80d411d43f4ad3625e57304">Resource::deleteOperationPlans</a>(<span class="keywordtype">bool</span> deleteLocked) <a name="l00234"></a>00234 { <a name="l00235"></a>00235 <span class="comment">// Delete the operationplans</span> <a name="l00236"></a>00236 <span class="keywordflow">for</span> (loadlist::iterator i=loads.begin(); i!=loads.end(); ++i) <a name="l00237"></a>00237 <a class="code" href="a00125.html#aebe0ba79364fcd6952413913a0bc5a92">OperationPlan::deleteOperationPlans</a>(i->getOperation(),deleteLocked); <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="comment">// Mark to recompute the problems</span> <a name="l00240"></a>00240 <a class="code" href="a00133.html#a11a86a6e020664a337325a96a64f6d2c">setChanged</a>(); <a name="l00241"></a>00241 } <a name="l00242"></a>00242 <a name="l00243"></a>00243 <a name="l00244"></a><a class="code" href="a00156.html#ae3fd0c53eac34767eadadacfbcce4db6">00244</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00156.html#ae3fd0c53eac34767eadadacfbcce4db6">Resource::~Resource</a>() <a name="l00245"></a>00245 { <a name="l00246"></a>00246 <span class="comment">// Delete all operationplans</span> <a name="l00247"></a>00247 <span class="comment">// An alternative logic would be to delete only the loadplans for this</span> <a name="l00248"></a>00248 <span class="comment">// resource and leave the rest of the plan untouched. The currently</span> <a name="l00249"></a>00249 <span class="comment">// implemented method is way more drastic...</span> <a name="l00250"></a>00250 <a class="code" href="a00156.html#ace1c6083e80d411d43f4ad3625e57304">deleteOperationPlans</a>(<span class="keyword">true</span>); <a name="l00251"></a>00251 <a name="l00252"></a>00252 <span class="comment">// The Load objects are automatically deleted by the destructor</span> <a name="l00253"></a>00253 <span class="comment">// of the Association list class.</span> <a name="l00254"></a>00254 } <a name="l00255"></a>00255 <a name="l00256"></a>00256 <a name="l00257"></a><a class="code" href="a00156.html#a31e8e7adb37b107cd64d9dba09be0555">00257</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00156.html#a31e8e7adb37b107cd64d9dba09be0555">Resource::updateSetups</a>(<span class="keyword">const</span> <a class="code" href="a00105.html" title="This class represents the resource capacity of an operationplan.">LoadPlan</a>* ldplan) <a name="l00258"></a>00258 { <a name="l00259"></a>00259 <span class="comment">// No updating required this resource</span> <a name="l00260"></a>00260 <span class="keywordflow">if</span> (!<a class="code" href="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>() || (ldplan && ldplan-><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="l00261"></a>00261 <span class="keywordflow">return</span>; <a name="l00262"></a>00262 <a name="l00263"></a>00263 <span class="comment">// Update later setup opplans</span> <a name="l00264"></a>00264 <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 = ldplan ? ldplan-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() : NULL; <a name="l00265"></a>00265 loadplanlist::const_iterator i = ldplan ? <a name="l00266"></a>00266 <a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().<a class="code" href="a00178.html#ad6fe958ddd6a9a63662a40079d777a2f">begin</a>(ldplan) : <a name="l00267"></a>00267 <a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().<a class="code" href="a00178.html#ad6fe958ddd6a9a63662a40079d777a2f">begin</a>(); <a name="l00268"></a>00268 <span class="keywordtype">string</span> prevsetup = ldplan ? ldplan-><a class="code" href="a00105.html#a15b97b617417b2186a43a4b827ecee73">getSetup</a>() : <a class="code" href="a00156.html#a2c8506a14137a874a02280ce0933a90e">getSetup</a>(); <a name="l00269"></a>00269 <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> latestCheckDate = ldplan ? ldplan-><a class="code" href="a00058.html#a965645e70dd9f99b0bd4f1325fb382aa">getDate</a>() : Date::infiniteFuture; <a name="l00270"></a>00270 <span class="keywordflow">for</span> (; i != <a class="code" href="a00156.html#a2788d75fc71a151629e8ef557e722314">getLoadPlans</a>().<a class="code" href="a00178.html#a247a6dfded3b61f1aeb838719ac295bc">end</a>(); ++i) <a name="l00271"></a>00271 { <a name="l00272"></a>00272 <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="l00273"></a>00273 <span class="keywordflow">if</span> (l && !l-><a class="code" href="a00105.html#aa62c4a262f2146c1f53f032314aebe97">getLoad</a>()-><a class="code" href="a00103.html#a7cab9031b62cd9d89a924ff5dcb2aa60">getSetup</a>().empty() <a name="l00274"></a>00274 && l-><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="l00275"></a>00275 && l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>() != opplan <a name="l00276"></a>00276 && !l-><a class="code" href="a00105.html#ad9328f39af6a9759d0e97572f87d6f67">isStart</a>()) <a name="l00277"></a>00277 { <a name="l00278"></a>00278 <span class="comment">// Next conversion operation</span> <a name="l00279"></a>00279 <a class="code" href="a00127.html" title="A simple class to easily remember the date and quantity of an operationplan.">OperationPlanState</a> x = l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a2f5ae1046cd50f98e59520ed8910c458">getOperation</a>()-><a class="code" href="a00121.html#a744480cdd80e70a2b0a7606114e1ab73">setOperationPlanParameters</a>( <a name="l00280"></a>00280 l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>(), <a name="l00281"></a>00281 l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#aa32661a65b2309ba7c35576940274687">getQuantity</a>(), <a name="l00282"></a>00282 Date::infinitePast, <a name="l00283"></a>00283 l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a9f19aec0a96f30616f2ee06e3c8f371a">getDates</a>().<a class="code" href="a00050.html#a165a8f748d8468e5ba8331c0e06bd3a2">getEnd</a>(), <a name="l00284"></a>00284 <span class="keyword">true</span>, <a name="l00285"></a>00285 <span class="keyword">false</span>); <a name="l00286"></a>00286 <span class="keywordflow">if</span> (x.<a class="code" href="a00127.html#adc56f9e1f5ddccca5f50c50229e18c27">start</a> != l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a9f19aec0a96f30616f2ee06e3c8f371a">getDates</a>().<a class="code" href="a00050.html#a73e574de7fbf5df8ebc4c5190e7d49c3">getStart</a>()) <a name="l00287"></a>00287 <span class="comment">// We need to change a setup plan</span> <a name="l00288"></a>00288 l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a74fda632de58936beb2adf31f0731d09">restore</a>(x); <a name="l00289"></a>00289 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (ldplan && x.<a class="code" href="a00127.html#adc56f9e1f5ddccca5f50c50229e18c27">start</a> == l-><a class="code" href="a00105.html#a0969aca89148ba44b97211d25177cbed">getOperationPlan</a>()-><a class="code" href="a00125.html#a9f19aec0a96f30616f2ee06e3c8f371a">getDates</a>().<a class="code" href="a00050.html#a73e574de7fbf5df8ebc4c5190e7d49c3">getStart</a>()) <a name="l00290"></a>00290 <span class="comment">// We found a setup plan that doesn't need updating. Later setup plans</span> <a name="l00291"></a>00291 <span class="comment">// won't require updating either</span> <a name="l00292"></a>00292 <span class="keywordflow">return</span>; <a name="l00293"></a>00293 } <a name="l00294"></a>00294 } <a name="l00295"></a>00295 } <a name="l00296"></a>00296 <a name="l00297"></a>00297 <a name="l00298"></a>00298 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00158.html#a5cde905609c6f34480bb33dfc0cd9add">ResourceInfinite::writeElement</a> <a name="l00299"></a><a class="code" href="a00158.html#a5cde905609c6f34480bb33dfc0cd9add">00299</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> &tag, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398">mode</a> m) <span class="keyword">const</span> <a name="l00300"></a>00300 { <a name="l00301"></a>00301 <span class="comment">// Writing a reference</span> <a name="l00302"></a>00302 <span class="keywordflow">if</span> (m == <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a874240ada53cc5b608466064d86d91ae">REFERENCE</a>) <a name="l00303"></a>00303 { <a name="l00304"></a>00304 o-><a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a> <a name="l00305"></a>00305 (tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, getName(), <a class="code" href="a00177.html#a6745112e0237e378e2b0cbe41aa5926a">Tags::tag_type</a>, getType().<a class="code" href="a00156.html" title="This class represents a workcentre, a physical or logical representation of capacity...">type</a>); <a name="l00306"></a>00306 <span class="keywordflow">return</span>; <a name="l00307"></a>00307 } <a name="l00308"></a>00308 <a name="l00309"></a>00309 <span class="comment">// Write the complete object</span> <a name="l00310"></a>00310 <span class="keywordflow">if</span> (m != <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a2ad5e75fe119e297630882d182832243">NOHEADER</a>) o-><a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a> <a name="l00311"></a>00311 (tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, getName(), <a class="code" href="a00177.html#a6745112e0237e378e2b0cbe41aa5926a">Tags::tag_type</a>, getType().<a class="code" href="a00156.html" title="This class represents a workcentre, a physical or logical representation of capacity...">type</a>); <a name="l00312"></a>00312 <a name="l00313"></a>00313 <span class="comment">// Write the fields</span> <a name="l00314"></a>00314 <a class="code" href="a00156.html#a9b84a7753b5eca34228a34170d4b7174">Resource::writeElement</a>(o, tag, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a2ad5e75fe119e297630882d182832243">NOHEADER</a>); <a name="l00315"></a>00315 } <a name="l00316"></a>00316 <a name="l00317"></a>00317 <a name="l00318"></a><a class="code" href="a00156.html#a9d6cf8567db1286e8903a9370010274d">00318</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00156.html#a9d6cf8567db1286e8903a9370010274d">Resource::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="l00319"></a>00319 { <a name="l00320"></a>00320 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>)) <a name="l00321"></a>00321 <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="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>()); <a name="l00322"></a>00322 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6ae79e34440e259269ed2f902cd47157">Tags::tag_description</a>)) <a name="l00323"></a>00323 <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="a00082.html#aff438ae1fc6f5899acdc16217bbdd3a8">getDescription</a>()); <a name="l00324"></a>00324 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a712bcf2d196c0ddae4c4971127d4d43b">Tags::tag_category</a>)) <a name="l00325"></a>00325 <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="a00082.html#af0eb12cffb01b34278b77d1af02d2ddd">getCategory</a>()); <a name="l00326"></a>00326 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ac932faef2edd6d850d233d2c2de7eb68">Tags::tag_subcategory</a>)) <a name="l00327"></a>00327 <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="a00082.html#a3f197282206d815ab8e8cdb0f4b49cc0">getSubCategory</a>()); <a name="l00328"></a>00328 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#aaa2f978792ac2320979871ceafdc5c16">Tags::tag_owner</a>)) <a name="l00329"></a>00329 <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="a00083.html#a4bda4eb77f34c0528e176446886fcce1">getOwner</a>()); <a name="l00330"></a>00330 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a3355294c37c4e6cd3a72a17115567071">Tags::tag_location</a>)) <a name="l00331"></a>00331 <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="a00156.html#a83cba91fd0f2c79d3a823d2d11814dc2">getLocation</a>()); <a name="l00332"></a>00332 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>)) <a name="l00333"></a>00333 <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="a00156.html#a19abdb9e5319a6c5fca5ce7c5cc1015f">getMaximum</a>()); <a name="l00334"></a>00334 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a0fa5f96fbd30ae0cb40b3d8880ab8730">Tags::tag_maxearly</a>)) <a name="l00335"></a>00335 <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="a00156.html#a41799c1cc2defacadd1c97d576ada6a5">getMaxEarly</a>()); <a name="l00336"></a>00336 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a26ba9b767f074c42558fe812da43c8ab">Tags::tag_cost</a>)) <a name="l00337"></a>00337 <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="a00156.html#ae9928a8cd7d0abc6f2b5c7f8b1852cfb">getCost</a>()); <a name="l00338"></a>00338 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ac016b995f75e5fdb50eefc35924c6503">Tags::tag_hidden</a>)) <a name="l00339"></a>00339 <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="a00156.html#a6aff2488026931e71ce3762c8ec52c05">getHidden</a>()); <a name="l00340"></a>00340 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a8af77889e6092a30c9b191a28a2c79d0">Tags::tag_loadplans</a>)) <a name="l00341"></a>00341 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="a00107.html">LoadPlanIterator</a>(<span class="keyword">this</span>); <a name="l00342"></a>00342 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a2e32d4c89079c071ec2bd8e634e9b440">Tags::tag_loads</a>)) <a name="l00343"></a>00343 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="a00104.html">LoadIterator</a>(<span class="keyword">this</span>); <a name="l00344"></a>00344 <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="l00345"></a>00345 <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="a00156.html#a2c8506a14137a874a02280ce0933a90e">getSetup</a>()); <a name="l00346"></a>00346 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6114790dd7f73dde04060d0e3f3e89fb">Tags::tag_setupmatrix</a>)) <a name="l00347"></a>00347 <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="a00156.html#a364f95ef308af4b2be6e202d71f4f630">getSetupMatrix</a>()); <a name="l00348"></a>00348 <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="l00349"></a>00349 <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="a00084.html#a44c879fcf3b6ae9193c393630e25fd13">getLevel</a>()); <a name="l00350"></a>00350 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a5853f07e0af5d432d25a87b49e627e92">Tags::tag_cluster</a>)) <a name="l00351"></a>00351 <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="a00084.html#a1bd01594632b07953d6fa9babfa39d58">getCluster</a>()); <a name="l00352"></a>00352 <span class="keywordflow">return</span> NULL; <a name="l00353"></a>00353 } <a name="l00354"></a>00354 <a name="l00355"></a>00355 <a name="l00356"></a><a class="code" href="a00156.html#a3fc21124733af95e743bd8259a9f54ad">00356</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00156.html#a3fc21124733af95e743bd8259a9f54ad">Resource::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>& attr, <span class="keyword">const</span> <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>& field) <a name="l00357"></a>00357 { <a name="l00358"></a>00358 <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>)) <a name="l00359"></a>00359 <a class="code" href="a00085.html#a97d855d8c9bc9774da9cd8905e242dde">setName</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>()); <a name="l00360"></a>00360 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6ae79e34440e259269ed2f902cd47157">Tags::tag_description</a>)) <a name="l00361"></a>00361 <a class="code" href="a00082.html#a86430aaf17c259450986d8ad73aa2fbf">setDescription</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>()); <a name="l00362"></a>00362 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a712bcf2d196c0ddae4c4971127d4d43b">Tags::tag_category</a>)) <a name="l00363"></a>00363 <a class="code" href="a00082.html#a765bec78ade5db873ae5d2c1a56238ab">setCategory</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>()); <a name="l00364"></a>00364 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ac932faef2edd6d850d233d2c2de7eb68">Tags::tag_subcategory</a>)) <a name="l00365"></a>00365 <a class="code" href="a00082.html#abd65cc21a6a0636f3569e90e89e54e5f">setSubCategory</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>()); <a name="l00366"></a>00366 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#aaa2f978792ac2320979871ceafdc5c16">Tags::tag_owner</a>)) <a name="l00367"></a>00367 { <a name="l00368"></a>00368 <span class="keywordflow">if</span> (!field.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00150.html" title="Template class to define Python extensions.">PythonExtension<Resource>::getType</a>())) <a name="l00369"></a>00369 { <a name="l00370"></a>00370 PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">"resource owner must be of type resource"</span>); <a name="l00371"></a>00371 <span class="keywordflow">return</span> -1; <a name="l00372"></a>00372 } <a name="l00373"></a>00373 <a class="code" href="a00156.html" title="This class represents a workcentre, a physical or logical representation of capacity...">Resource</a>* y = <span class="keyword">static_cast<</span><a class="code" href="a00156.html" title="This class represents a workcentre, a physical or logical representation of capacity...">Resource</a>*<span class="keyword">></span>(<span class="keyword">static_cast<</span>PyObject*<span class="keyword">></span>(field)); <a name="l00374"></a>00374 <a class="code" href="a00083.html#a9072d43b9a5670ce1492f55fefdc4b7f">setOwner</a>(y); <a name="l00375"></a>00375 } <a name="l00376"></a>00376 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a3355294c37c4e6cd3a72a17115567071">Tags::tag_location</a>)) <a name="l00377"></a>00377 { <a name="l00378"></a>00378 <span class="keywordflow">if</span> (!field.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00108.html#a92b7d2941cf8330f08acd95992dc89ad">Location::metadata</a>)) <a name="l00379"></a>00379 { <a name="l00380"></a>00380 PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">"buffer location must be of type location"</span>); <a name="l00381"></a>00381 <span class="keywordflow">return</span> -1; <a name="l00382"></a>00382 } <a name="l00383"></a>00383 <a class="code" href="a00108.html" title="This abstract class is used to associate buffers and resources with a physical or...">Location</a>* y = <span class="keyword">static_cast<</span><a class="code" href="a00108.html" title="This abstract class is used to associate buffers and resources with a physical or...">Location</a>*<span class="keyword">></span>(<span class="keyword">static_cast<</span>PyObject*<span class="keyword">></span>(field)); <a name="l00384"></a>00384 <a class="code" href="a00156.html#a84f1b9ce3e3dfaddd30e83a44907caf3">setLocation</a>(y); <a name="l00385"></a>00385 } <a name="l00386"></a>00386 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a608a97000f23fdec1baec4504d095b24">Tags::tag_maximum</a>)) <a name="l00387"></a>00387 { <a name="l00388"></a>00388 <span class="keywordflow">if</span> (!field.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00016.html#a758e254f27a10333b8801eecf7874b15">CalendarDouble::metadata</a>)) <a name="l00389"></a>00389 { <a name="l00390"></a>00390 PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">"resource maximum must be of type calendar_double"</span>); <a name="l00391"></a>00391 <span class="keywordflow">return</span> -1; <a name="l00392"></a>00392 } <a name="l00393"></a>00393 <a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a>* y = <span class="keyword">static_cast<</span><a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a>*<span class="keyword">></span>(<span class="keyword">static_cast<</span>PyObject*<span class="keyword">></span>(field)); <a name="l00394"></a>00394 <a class="code" href="a00156.html#a87a25645d9e8896221820cc5d6a39df0">setMaximum</a>(y); <a name="l00395"></a>00395 } <a name="l00396"></a>00396 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ac016b995f75e5fdb50eefc35924c6503">Tags::tag_hidden</a>)) <a name="l00397"></a>00397 <a class="code" href="a00156.html#a73bd72bc30eafa9c5d7fe59f6d13e19d">setHidden</a>(field.<a class="code" href="a00154.html#a804b478fb76759d334882ee468fc84f9">getBool</a>()); <a name="l00398"></a>00398 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a26ba9b767f074c42558fe812da43c8ab">Tags::tag_cost</a>)) <a name="l00399"></a>00399 <a class="code" href="a00156.html#aa1bc68aa40a950eddbb2e2376487dd41">setCost</a>(field.<a class="code" href="a00154.html#ad292e9b75b65eef65ff8701939ab348a">getDouble</a>()); <a name="l00400"></a>00400 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a0fa5f96fbd30ae0cb40b3d8880ab8730">Tags::tag_maxearly</a>)) <a name="l00401"></a>00401 <a class="code" href="a00156.html#a4d6177c516049594125d8a9912abd7d0">setMaxEarly</a>(field.<a class="code" href="a00154.html#a8add60e92982666a4a13b499d9c74d58">getTimeperiod</a>()); <a name="l00402"></a>00402 <span class="keywordflow">else</span> <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="l00403"></a>00403 <a class="code" href="a00156.html#a7ec55c828d9dbc5f94991f154e1315f7">setSetup</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>()); <a name="l00404"></a>00404 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a6114790dd7f73dde04060d0e3f3e89fb">Tags::tag_setupmatrix</a>)) <a name="l00405"></a>00405 { <a name="l00406"></a>00406 <span class="keywordflow">if</span> (!field.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00165.html#a1d872c221ddb757bd195c43c85ee160b">SetupMatrix::metadata</a>)) <a name="l00407"></a>00407 { <a name="l00408"></a>00408 PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">"resource setup_matrix must be of type setup_matrix"</span>); <a name="l00409"></a>00409 <span class="keywordflow">return</span> -1; <a name="l00410"></a>00410 } <a name="l00411"></a>00411 <a class="code" href="a00165.html" title="This class is used to represent a matrix defining the changeover times between setups...">SetupMatrix</a>* y = <span class="keyword">static_cast<</span><a class="code" href="a00165.html" title="This class is used to represent a matrix defining the changeover times between setups...">SetupMatrix</a>*<span class="keyword">></span>(<span class="keyword">static_cast<</span>PyObject*<span class="keyword">></span>(field)); <a name="l00412"></a>00412 <a class="code" href="a00156.html#a31ff924489e39f5b7198f43260dfc9fc">setSetupMatrix</a>(y); <a name="l00413"></a>00413 } <a name="l00414"></a>00414 <span class="keywordflow">else</span> <a name="l00415"></a>00415 <span class="keywordflow">return</span> -1; <span class="comment">// Error</span> <a name="l00416"></a>00416 <span class="keywordflow">return</span> 0; <span class="comment">// OK</span> <a name="l00417"></a>00417 } <a name="l00418"></a>00418 <a name="l00419"></a>00419 } </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>