Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>C++ API frePPLe: calendar.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="../styles.css" rel="stylesheet"  type="text/css">
</head>
<body>
<div id="container">

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

<div id="content">
<br/>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_88117dff2735251a69c8eb9084477714.html">src</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_25032d30b6d615a661c02e2ac1394b01.html">model</a>
  </div>
</div>
<div class="contents">
<h1>calendar.cpp</h1><a href="a00195.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/calendar.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="a00195.html#a342983a479ae7a921be5face83fdb029">00028</a> <span class="preprocessor">#define FREPPLE_CORE</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="a00218.html">frepple/model.h</a>&quot;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">namespace </span>frepple
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Calendar&gt; <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&lt;Calendar&gt;::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="a00013.html#a80be0bca89b0fd95ed0dfefa2f965a6f">Calendar::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="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>* <a class="code" href="a00004.html#ae4b17005ad88cca2acf6cb2b861b8d53">Calendar::Bucket::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="a00024.html#af7865b7cf1b4a9314d150c9906219833">CalendarVoid::metadata</a>,
<a name="l00038"></a>00038   *<a class="code" href="a00016.html#a758e254f27a10333b8801eecf7874b15">CalendarDouble::metadata</a>,
<a name="l00039"></a>00039   *<a class="code" href="a00018.html#ab15c85aa41b4c5dcaa9af899d9eb6f38">CalendarInt::metadata</a>,
<a name="l00040"></a>00040   *<a class="code" href="a00014.html#a4e59f3a471d2e396aaf55dcc1ff4c277">CalendarBool::metadata</a>,
<a name="l00041"></a>00041   *<a class="code" href="a00022.html#a46227f436586ec5c3fc77321a4ebf687">CalendarString::metadata</a>,
<a name="l00042"></a>00042   *<a class="code" href="a00020.html#acb40eff94a33c81335e0707cc9f8df45">CalendarOperation::metadata</a>;
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 
<a name="l00045"></a><a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">00045</a> <span class="keywordtype">int</span> <a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">Calendar::initialize</a>()
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047   <span class="comment">// Initialize the metadata</span>
<a name="l00048"></a>00048   <a class="code" href="a00013.html#a80be0bca89b0fd95ed0dfefa2f965a6f">metadata</a> = <span class="keyword">new</span> <a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendars&quot;</span>, <a class="code" href="a00085.html#ac14340cc8781e6f2b7235d50a1d17914">reader</a>, <a class="code" href="a00085.html#a1071369052edea444a06baa35d7e991e">writer</a>);
<a name="l00049"></a>00049 
<a name="l00050"></a>00050   <span class="comment">// Initialize the Python class</span>
<a name="l00051"></a>00051   <span class="keywordflow">return</span> <a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">Calendar::Bucket::initialize</a>() +
<a name="l00052"></a>00052     <a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">FreppleCategory&lt;Calendar&gt;::initialize</a>() +
<a name="l00053"></a>00053     <a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">CalendarBucketIterator::initialize</a>() +
<a name="l00054"></a>00054     <a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">CalendarEventIterator::initialize</a>();
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 
<a name="l00058"></a><a class="code" href="a00004.html#a6f316ec0ee254598f9579e47da246f54">00058</a> <span class="keywordtype">int</span> <a class="code" href="a00004.html#a6f316ec0ee254598f9579e47da246f54">Calendar::Bucket::initialize</a>()
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060   <span class="comment">// Initialize the metadata</span>
<a name="l00061"></a>00061   <a class="code" href="a00004.html#ae4b17005ad88cca2acf6cb2b861b8d53">metadata</a> = <span class="keyword">new</span> <a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>(<span class="stringliteral">&quot;bucket&quot;</span>, <span class="stringliteral">&quot;buckets&quot;</span>);
<a name="l00062"></a>00062 
<a name="l00063"></a>00063   <span class="comment">// Initialize the Python class</span>
<a name="l00064"></a>00064   <a class="code" href="a00155.html" title="This class is a thin wrapper around the type information in Python.">PythonType</a>&amp; x = <a class="code" href="a00004.html#a315e9b2a148922112da74b3f89241a0e">PythonExtension&lt;Calendar::Bucket&gt;::getType</a>();
<a name="l00065"></a>00065   x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">&quot;calendarBucket&quot;</span>);
<a name="l00066"></a>00066   x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">&quot;frePPLe calendar bucket&quot;</span>);
<a name="l00067"></a>00067   x.<a class="code" href="a00155.html#a8d3f24e0357f41ac3bc0be78bd2ab268">supportgetattro</a>();
<a name="l00068"></a>00068   x.<a class="code" href="a00155.html#a83866bef191c69cf8506426fe38b8d19">supportsetattro</a>();
<a name="l00069"></a>00069   <span class="keyword">const_cast&lt;</span><a class="code" href="a00114.html" title="A MetaCategory instance represents metadata for a category of object.">MetaCategory</a>*<span class="keyword">&gt;</span>(<a class="code" href="a00004.html#ae4b17005ad88cca2acf6cb2b861b8d53">metadata</a>)-&gt;pythonClass = x.<a class="code" href="a00155.html#aed0915f1cc32c0c1e12e209abfedf615">type_object</a>();
<a name="l00070"></a>00070   <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>();
<a name="l00071"></a>00071 }
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 
<a name="l00074"></a><a class="code" href="a00024.html#aeacf6cb28bea6992c82cd4f93adeebc8">00074</a> <span class="keywordtype">int</span> <a class="code" href="a00013.html#a79ca1679ac64cf14386bf72c4baccb7d">CalendarVoid::initialize</a>()
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076   <span class="comment">// Initialize the metadata</span>
<a name="l00077"></a>00077   <a class="code" href="a00024.html#af7865b7cf1b4a9314d150c9906219833">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>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendar_void&quot;</span>,
<a name="l00078"></a>00078     Object::createString&lt;CalendarVoid&gt;);
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   <span class="comment">// Initialize the Python class</span>
<a name="l00081"></a>00081   <a class="code" href="a00024.html#af666efca93461ee8510eab731f569700">FreppleClass&lt;CalendarVoid,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;setValue&quot;</span>, <a class="code" href="a00024.html#a0dcce604e020c88d10d7c0639ce54609">setPythonValue</a>, METH_KEYWORDS, <span class="stringliteral">&quot;update the value in a date range&quot;</span>);
<a name="l00082"></a>00082   <a class="code" href="a00024.html#af666efca93461ee8510eab731f569700">FreppleClass&lt;CalendarVoid,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;events&quot;</span>, <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">getEvents</a>, METH_VARARGS, <span class="stringliteral">&quot;return an event iterator&quot;</span>);
<a name="l00083"></a>00083   <span class="keywordflow">return</span> <a class="code" href="a00024.html#aeacf6cb28bea6992c82cd4f93adeebc8">FreppleClass&lt;CalendarVoid,Calendar&gt;::initialize</a>();
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="a00016.html#a2a00f3279d0767127123701145af1f80">00087</a> <span class="keywordtype">int</span> <a class="code" href="a00016.html#a2a00f3279d0767127123701145af1f80">CalendarDouble::initialize</a>()
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089   <span class="comment">// Initialize the metadata</span>
<a name="l00090"></a>00090   <a class="code" href="a00016.html#a758e254f27a10333b8801eecf7874b15">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>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendar_double&quot;</span>,
<a name="l00091"></a>00091     Object::createString&lt;CalendarDouble&gt;, <span class="keyword">true</span>);
<a name="l00092"></a>00092 
<a name="l00093"></a>00093   <span class="comment">// Initialize the Python class</span>
<a name="l00094"></a>00094   <a class="code" href="a00016.html#acec9529c83ad07d47d62391b1102f39b">FreppleClass&lt;CalendarDouble,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;setValue&quot;</span>, <a class="code" href="a00016.html#adfcd29e7ad961cdcec5fea5d00920c7e">setPythonValue</a>, METH_KEYWORDS, <span class="stringliteral">&quot;update the value in a date range&quot;</span>);
<a name="l00095"></a>00095   <a class="code" href="a00016.html#acec9529c83ad07d47d62391b1102f39b">FreppleClass&lt;CalendarDouble,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;events&quot;</span>, <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">getEvents</a>, METH_VARARGS, <span class="stringliteral">&quot;return an event iterator&quot;</span>);
<a name="l00096"></a>00096   <span class="keywordflow">return</span> <a class="code" href="a00016.html#a2a00f3279d0767127123701145af1f80">FreppleClass&lt;CalendarDouble,Calendar&gt;::initialize</a>();
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 
<a name="l00100"></a><a class="code" href="a00018.html#a822798ad4ec1b3c210af630253ecc596">00100</a> <span class="keywordtype">int</span> <a class="code" href="a00018.html#a822798ad4ec1b3c210af630253ecc596">CalendarInt::initialize</a>()
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102   <span class="comment">// Initialize the metadata</span>
<a name="l00103"></a>00103   <a class="code" href="a00018.html#ab15c85aa41b4c5dcaa9af899d9eb6f38">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>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendar_integer&quot;</span>,
<a name="l00104"></a>00104     Object::createString&lt;CalendarInt&gt;);
<a name="l00105"></a>00105 
<a name="l00106"></a>00106   <span class="comment">// Initialize the Python class</span>
<a name="l00107"></a>00107   <a class="code" href="a00018.html#adf37d97b30a70c6fb63d2b1d13492f9f">FreppleClass&lt;CalendarInt,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;setValue&quot;</span>, <a class="code" href="a00018.html#ae7546325682c29ab2aa9eaa7cb2c4fa5">setPythonValue</a>, METH_KEYWORDS, <span class="stringliteral">&quot;update the value in a date range&quot;</span>);
<a name="l00108"></a>00108   <a class="code" href="a00018.html#adf37d97b30a70c6fb63d2b1d13492f9f">FreppleClass&lt;CalendarInt,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;events&quot;</span>, <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">getEvents</a>, METH_VARARGS, <span class="stringliteral">&quot;return an event iterator&quot;</span>);
<a name="l00109"></a>00109   <span class="keywordflow">return</span> <a class="code" href="a00018.html#a822798ad4ec1b3c210af630253ecc596">FreppleClass&lt;CalendarInt,Calendar&gt;::initialize</a>();
<a name="l00110"></a>00110 }
<a name="l00111"></a>00111 
<a name="l00112"></a>00112 
<a name="l00113"></a><a class="code" href="a00014.html#aeb04ada740e2a98133fd13527da4502a">00113</a> <span class="keywordtype">int</span> <a class="code" href="a00014.html#aeb04ada740e2a98133fd13527da4502a">CalendarBool::initialize</a>()
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115   <span class="comment">// Initialize the metadata</span>
<a name="l00116"></a>00116   <a class="code" href="a00014.html#a4e59f3a471d2e396aaf55dcc1ff4c277">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>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendar_boolean&quot;</span>,
<a name="l00117"></a>00117     Object::createString&lt;CalendarBool&gt;);
<a name="l00118"></a>00118 
<a name="l00119"></a>00119   <span class="comment">// Initialize the Python class</span>
<a name="l00120"></a>00120   <a class="code" href="a00014.html#a6a2231a9fceb06aa01dad35b7f335c36">FreppleClass&lt;CalendarBool,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;setValue&quot;</span>, <a class="code" href="a00014.html#a1dc21c5b566db261f95528ae94bd536e">setPythonValue</a>, METH_KEYWORDS, <span class="stringliteral">&quot;update the value in a date range&quot;</span>);
<a name="l00121"></a>00121   <a class="code" href="a00014.html#a6a2231a9fceb06aa01dad35b7f335c36">FreppleClass&lt;CalendarBool,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;events&quot;</span>, <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">getEvents</a>, METH_VARARGS, <span class="stringliteral">&quot;return an event iterator&quot;</span>);
<a name="l00122"></a>00122   <span class="keywordflow">return</span> <a class="code" href="a00014.html#aeb04ada740e2a98133fd13527da4502a">FreppleClass&lt;CalendarBool,Calendar&gt;::initialize</a>();
<a name="l00123"></a>00123 }
<a name="l00124"></a>00124 
<a name="l00125"></a>00125 
<a name="l00126"></a><a class="code" href="a00022.html#a3706da193d35320b43af8da1b70a4b3e">00126</a> <span class="keywordtype">int</span> <a class="code" href="a00022.html#a3706da193d35320b43af8da1b70a4b3e">CalendarString::initialize</a>()
<a name="l00127"></a>00127 {
<a name="l00128"></a>00128   <span class="comment">// Initialize the metadata</span>
<a name="l00129"></a>00129   <a class="code" href="a00022.html#a46227f436586ec5c3fc77321a4ebf687">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>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendar_string&quot;</span>,
<a name="l00130"></a>00130     Object::createString&lt;CalendarString&gt;);
<a name="l00131"></a>00131 
<a name="l00132"></a>00132   <span class="comment">// Initialize the Python class</span>
<a name="l00133"></a>00133   <a class="code" href="a00022.html#ad0ec94a79fc61d85ac9fa065f7a0980c">FreppleClass&lt;CalendarString,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;setValue&quot;</span>, <a class="code" href="a00022.html#a463eb38c1faa273ba99170f9ff1ccf32">setPythonValue</a>, METH_KEYWORDS, <span class="stringliteral">&quot;update the value in a date range&quot;</span>);
<a name="l00134"></a>00134   <a class="code" href="a00022.html#ad0ec94a79fc61d85ac9fa065f7a0980c">FreppleClass&lt;CalendarString,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;events&quot;</span>, <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">getEvents</a>, METH_VARARGS, <span class="stringliteral">&quot;return an event iterator&quot;</span>);
<a name="l00135"></a>00135   <span class="keywordflow">return</span> <a class="code" href="a00022.html#a3706da193d35320b43af8da1b70a4b3e">FreppleClass&lt;CalendarString,Calendar&gt;::initialize</a>();
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 
<a name="l00139"></a><a class="code" href="a00020.html#aa50d05aa2608fe76bba68f2d77eb7cb4">00139</a> <span class="keywordtype">int</span> <a class="code" href="a00020.html#aa50d05aa2608fe76bba68f2d77eb7cb4">CalendarOperation::initialize</a>()
<a name="l00140"></a>00140 {
<a name="l00141"></a>00141   <span class="comment">// Initialize the metadata</span>
<a name="l00142"></a>00142   <a class="code" href="a00020.html#acb40eff94a33c81335e0707cc9f8df45">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>(<span class="stringliteral">&quot;calendar&quot;</span>, <span class="stringliteral">&quot;calendar_operation&quot;</span>,
<a name="l00143"></a>00143     Object::createString&lt;CalendarOperation&gt;);
<a name="l00144"></a>00144 
<a name="l00145"></a>00145   <span class="comment">// Initialize the Python class</span>
<a name="l00146"></a>00146   <a class="code" href="a00020.html#a0d16add1d6ab72b3402899dc3f718af5">FreppleClass&lt;CalendarOperation,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;setValue&quot;</span>, <a class="code" href="a00020.html#a7226ded7b997b89e2bf0011efa6013dc">setPythonValue</a>, METH_KEYWORDS, <span class="stringliteral">&quot;update the value in a date range&quot;</span>);
<a name="l00147"></a>00147   <a class="code" href="a00020.html#a0d16add1d6ab72b3402899dc3f718af5">FreppleClass&lt;CalendarOperation,Calendar&gt;::getType</a>().addMethod(<span class="stringliteral">&quot;events&quot;</span>, <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">getEvents</a>, METH_VARARGS, <span class="stringliteral">&quot;return an event iterator&quot;</span>);
<a name="l00148"></a>00148   <span class="keywordflow">return</span> <a class="code" href="a00020.html#aa50d05aa2608fe76bba68f2d77eb7cb4">FreppleClass&lt;CalendarOperation,Calendar&gt;::initialize</a>();
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 <span class="comment">// Specialised template functions</span>
<a name="l00153"></a><a class="code" href="a00023.html#a9be7284aa0fab42d4a384fc2e9fef6d8">00153</a> <span class="keyword">template</span> &lt;&gt; <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">bool</span> <a class="code" href="a00023.html#a82e1b9aa3591374f0e66e583477fc579">CalendarValue&lt;string&gt;::getBool</a>()<span class="keyword"> const</span>
<a name="l00154"></a>00154 <span class="keyword">  </span>{<span class="keywordflow">return</span> defaultValue.empty();}
<a name="l00155"></a><a class="code" href="a00007.html#a4ad5dabd9aaaba93f17e5ed9269a7f0a">00155</a> <span class="keyword">template</span> &lt;&gt; <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">bool</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;string&gt;::BucketValue::getBool</a>()<span class="keyword"> const</span>
<a name="l00156"></a>00156 <span class="keyword">  </span>{<span class="keywordflow">return</span> val.empty();}
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 
<a name="l00159"></a><a class="code" href="a00013.html#ab97c4bc8ef0355b10c2092f731943eb3">00159</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00013.html#ab97c4bc8ef0355b10c2092f731943eb3">Calendar::~Calendar</a>()
<a name="l00160"></a>00160 {
<a name="l00161"></a>00161   <span class="comment">// De-allocate all the dynamic memory used for the bucket objects</span>
<a name="l00162"></a>00162   <span class="keywordflow">while</span> (firstBucket)
<a name="l00163"></a>00163   {
<a name="l00164"></a>00164     <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Bucket</a>* tmp = firstBucket;
<a name="l00165"></a>00165     firstBucket = firstBucket-&gt;nextBucket;
<a name="l00166"></a>00166     <span class="keyword">delete</span> tmp;
<a name="l00167"></a>00167   }
<a name="l00168"></a>00168 }
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 
<a name="l00171"></a><a class="code" href="a00016.html#a4898ed7954bfc01f4d074dc1196ed4ab">00171</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00016.html#a4898ed7954bfc01f4d074dc1196ed4ab">CalendarDouble::~CalendarDouble</a>()
<a name="l00172"></a>00172 {
<a name="l00173"></a>00173   <span class="comment">// Remove all references from buffers</span>
<a name="l00174"></a>00174   <span class="keywordflow">for</span> (Buffer::iterator b = <a class="code" href="a00085.html#a1926a798edd9c04bc37e596936003cd6">Buffer::begin</a>(); b != <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">Buffer::end</a>(); ++b)
<a name="l00175"></a>00175   {
<a name="l00176"></a>00176     <span class="keywordflow">if</span> (b-&gt;getMinimum()==<span class="keyword">this</span>) b-&gt;setMinimum(NULL);
<a name="l00177"></a>00177     <span class="keywordflow">if</span> (b-&gt;getMaximum()==<span class="keyword">this</span>) b-&gt;setMaximum(NULL);
<a name="l00178"></a>00178   }
<a name="l00179"></a>00179 
<a name="l00180"></a>00180   <span class="comment">// Remove all references from resources</span>
<a name="l00181"></a>00181   <span class="keywordflow">for</span> (Resource::iterator r = <a class="code" href="a00085.html#a1926a798edd9c04bc37e596936003cd6">Resource::begin</a>(); r != <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">Resource::end</a>(); ++r)
<a name="l00182"></a>00182     <span class="keywordflow">if</span> (r-&gt;getMaximum()==<span class="keyword">this</span>) r-&gt;setMaximum(NULL);
<a name="l00183"></a>00183 }
<a name="l00184"></a>00184 
<a name="l00185"></a>00185 
<a name="l00186"></a><a class="code" href="a00014.html#a7d8cac5071f6eaa5cad7a207cf0e66c3">00186</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00014.html#a7d8cac5071f6eaa5cad7a207cf0e66c3">CalendarBool::~CalendarBool</a>()
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188   <span class="comment">// Remove all references from locations</span>
<a name="l00189"></a>00189   <span class="keywordflow">for</span> (Location::iterator l = <a class="code" href="a00085.html#a1926a798edd9c04bc37e596936003cd6">Location::begin</a>(); l != <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">Location::end</a>(); ++l)
<a name="l00190"></a>00190   {
<a name="l00191"></a>00191     <span class="keywordflow">if</span> (l-&gt;getAvailable() == <span class="keyword">this</span>)
<a name="l00192"></a>00192       l-&gt;setAvailable(NULL);
<a name="l00193"></a>00193   }
<a name="l00194"></a>00194 }
<a name="l00195"></a>00195 
<a name="l00196"></a>00196 
<a name="l00197"></a>00197 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a>* <a class="code" href="a00013.html#a3661606a1b8cbb5cc45c61ba20dd5cfd">Calendar::addBucket</a>
<a name="l00198"></a><a class="code" href="a00013.html#a3661606a1b8cbb5cc45c61ba20dd5cfd">00198</a>   (<a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> start, <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> end, <span class="keywordtype">string</span> name)
<a name="l00199"></a>00199 {
<a name="l00200"></a>00200   <span class="comment">// Assure the start is before the end.</span>
<a name="l00201"></a>00201   <span class="keywordflow">if</span> (start &gt; end)
<a name="l00202"></a>00202   {
<a name="l00203"></a>00203     <span class="comment">// Switch arguments</span>
<a name="l00204"></a>00204     <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> tmp = end;
<a name="l00205"></a>00205     end = start;
<a name="l00206"></a>00206     start = end;
<a name="l00207"></a>00207   }
<a name="l00208"></a>00208 
<a name="l00209"></a>00209   <span class="comment">// Create new bucket and insert in the list</span>
<a name="l00210"></a>00210   <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Bucket</a> *next = firstBucket, *prev = NULL;
<a name="l00211"></a>00211   <span class="keywordflow">while</span> (next &amp;&amp; next-&gt;startdate &lt; start)
<a name="l00212"></a>00212   {
<a name="l00213"></a>00213     prev = next;
<a name="l00214"></a>00214     next = next-&gt;nextBucket;
<a name="l00215"></a>00215   }
<a name="l00216"></a>00216 
<a name="l00217"></a>00217   <span class="comment">// Create the new bucket</span>
<a name="l00218"></a>00218   <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Bucket</a> *c = createNewBucket(start,end,name);
<a name="l00219"></a>00219   c-&gt;nextBucket = next;
<a name="l00220"></a>00220   c-&gt;prevBucket = prev;
<a name="l00221"></a>00221 
<a name="l00222"></a>00222   <span class="comment">// Maintain linked list</span>
<a name="l00223"></a>00223   <span class="keywordflow">if</span> (prev) prev-&gt;nextBucket = c;
<a name="l00224"></a>00224   <span class="keywordflow">else</span> firstBucket = c;
<a name="l00225"></a>00225   <span class="keywordflow">if</span> (next) next-&gt;prevBucket = c;
<a name="l00226"></a>00226 
<a name="l00227"></a>00227   <span class="comment">// Return the new bucket</span>
<a name="l00228"></a>00228   <span class="keywordflow">return</span> c;
<a name="l00229"></a>00229 }
<a name="l00230"></a>00230 
<a name="l00231"></a>00231 
<a name="l00232"></a><a class="code" href="a00013.html#a8065a4f5707d533b4d85e0b0beb86227">00232</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00013.html#a8065a4f5707d533b4d85e0b0beb86227">Calendar::removeBucket</a>(<a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a>* bkt)
<a name="l00233"></a>00233 {
<a name="l00234"></a>00234   <span class="comment">// Verify the bucket is on this calendar indeed</span>
<a name="l00235"></a>00235   <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Bucket</a> *b = firstBucket;
<a name="l00236"></a>00236   <span class="keywordflow">while</span> (b &amp;&amp; b != bkt) b = b-&gt;nextBucket;
<a name="l00237"></a>00237 
<a name="l00238"></a>00238   <span class="comment">// Error</span>
<a name="l00239"></a>00239   <span class="keywordflow">if</span> (!b)
<a name="l00240"></a>00240     <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">&quot;Trying to remove unavailable bucket from calendar &apos;&quot;</span>
<a name="l00241"></a>00241         + <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>() + <span class="stringliteral">&quot;&apos;&quot;</span>);
<a name="l00242"></a>00242 
<a name="l00243"></a>00243   <span class="comment">// Update the list</span>
<a name="l00244"></a>00244   <span class="keywordflow">if</span> (bkt-&gt;prevBucket)
<a name="l00245"></a>00245     <span class="comment">// Previous bucket links to a new next bucket</span>
<a name="l00246"></a>00246     bkt-&gt;prevBucket-&gt;nextBucket = bkt-&gt;nextBucket;
<a name="l00247"></a>00247   <span class="keywordflow">else</span>
<a name="l00248"></a>00248     <span class="comment">// New head for the bucket list</span>
<a name="l00249"></a>00249     firstBucket = bkt-&gt;nextBucket;
<a name="l00250"></a>00250   <span class="keywordflow">if</span> (bkt-&gt;nextBucket)
<a name="l00251"></a>00251     <span class="comment">// Update the reference prevBucket of the next bucket</span>
<a name="l00252"></a>00252     bkt-&gt;nextBucket-&gt;prevBucket = bkt-&gt;prevBucket;
<a name="l00253"></a>00253 
<a name="l00254"></a>00254   <span class="comment">// Delete the bucket</span>
<a name="l00255"></a>00255   <span class="keyword">delete</span> bkt;
<a name="l00256"></a>00256 }
<a name="l00257"></a>00257 
<a name="l00258"></a>00258 
<a name="l00259"></a><a class="code" href="a00013.html#a684447a848cfeb0aee605c158ca9a170">00259</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a>* <a class="code" href="a00013.html#a684447a848cfeb0aee605c158ca9a170">Calendar::findBucket</a>(<a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> d, <span class="keywordtype">bool</span> fwd)<span class="keyword"> const</span>
<a name="l00260"></a>00260 <span class="keyword"></span>{
<a name="l00261"></a>00261   <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a> *curBucket = NULL;
<a name="l00262"></a>00262   <span class="keywordtype">double</span> curPriority = DBL_MAX;
<a name="l00263"></a>00263   <span class="keywordflow">for</span> (<a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Bucket</a> *b = firstBucket; b; b = b-&gt;nextBucket)
<a name="l00264"></a>00264   {
<a name="l00265"></a>00265     <span class="keywordflow">if</span> (b-&gt;getStart() &gt; d)
<a name="l00266"></a>00266       <span class="comment">// Buckets are sorted by the start date. Other entries definately</span>
<a name="l00267"></a>00267       <span class="comment">// won&apos;t be effective.</span>
<a name="l00268"></a>00268       <span class="keywordflow">break</span>;
<a name="l00269"></a>00269     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (curPriority &gt; b-&gt;getPriority() &amp;&amp; b-&gt;checkValid(d)
<a name="l00270"></a>00270       &amp;&amp; ( (fwd &amp;&amp; d &gt;= b-&gt;getStart() &amp;&amp; d &lt; b-&gt;getEnd()) ||
<a name="l00271"></a>00271            (!fwd &amp;&amp; d &gt; b-&gt;getStart() &amp;&amp; d &lt;= b-&gt;getEnd())
<a name="l00272"></a>00272       ))
<a name="l00273"></a>00273     {
<a name="l00274"></a>00274       <span class="comment">// Bucket is effective and has lower priority than other effective ones.</span>
<a name="l00275"></a>00275       curPriority = b-&gt;<a class="code" href="a00004.html#a1ee4f2d13a569d57455010bc07e87e8f">getPriority</a>();
<a name="l00276"></a>00276       curBucket = &amp;*b;
<a name="l00277"></a>00277     }
<a name="l00278"></a>00278   }
<a name="l00279"></a>00279   <span class="keywordflow">return</span> curBucket;
<a name="l00280"></a>00280 }
<a name="l00281"></a>00281 
<a name="l00282"></a>00282 
<a name="l00283"></a><a class="code" href="a00013.html#a950b40f3be265d4b28eeffa0f3917ab8">00283</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a>* <a class="code" href="a00013.html#a684447a848cfeb0aee605c158ca9a170">Calendar::findBucket</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; d)<span class="keyword"> const</span>
<a name="l00284"></a>00284 <span class="keyword"></span>{
<a name="l00285"></a>00285   <span class="keywordflow">for</span> (<a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Bucket</a> *b = firstBucket; b; b = b-&gt;nextBucket)
<a name="l00286"></a>00286     <span class="keywordflow">if</span> (b-&gt;getName() == d) <span class="keywordflow">return</span> b;
<a name="l00287"></a>00287   <span class="keywordflow">return</span> NULL;
<a name="l00288"></a>00288 }
<a name="l00289"></a>00289 
<a name="l00290"></a>00290 
<a name="l00291"></a><a class="code" href="a00013.html#aada6ba5b57ed15d5b9f639d3fb54955c">00291</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00013.html#aada6ba5b57ed15d5b9f639d3fb54955c">Calendar::writeElement</a>(<a class="code" href="a00189.html" title="Base class for writing XML formatted data to an output stream.">XMLOutput</a> *o, <span class="keyword">const</span> <a class="code" href="a00096.html" title="This class defines a keyword for the frePPLe data model.">Keyword</a>&amp; tag, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398">mode</a> m)<span class="keyword"> const</span>
<a name="l00292"></a>00292 <span class="keyword"></span>{
<a name="l00293"></a>00293   <span class="comment">// Writing a reference</span>
<a name="l00294"></a>00294   <span class="keywordflow">if</span> (m == <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a874240ada53cc5b608466064d86d91ae">REFERENCE</a>)
<a name="l00295"></a>00295   {
<a name="l00296"></a>00296     o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>
<a name="l00297"></a>00297       (tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>(), <a class="code" href="a00177.html#a6745112e0237e378e2b0cbe41aa5926a">Tags::tag_type</a>, <a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>().<a class="code" href="a00013.html" title="This is the class used to represent variables that are varying over time.">type</a>);
<a name="l00298"></a>00298     <span class="keywordflow">return</span>;
<a name="l00299"></a>00299   }
<a name="l00300"></a>00300 
<a name="l00301"></a>00301   <span class="comment">// Write the complete object</span>
<a name="l00302"></a>00302   <span class="keywordflow">if</span> (m != <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a2ad5e75fe119e297630882d182832243">NOHEADER</a>) o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>
<a name="l00303"></a>00303     (tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>(), <a class="code" href="a00177.html#a6745112e0237e378e2b0cbe41aa5926a">Tags::tag_type</a>, <a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>().<a class="code" href="a00013.html" title="This is the class used to represent variables that are varying over time.">type</a>);
<a name="l00304"></a>00304 
<a name="l00305"></a>00305   <span class="comment">// Write all buckets</span>
<a name="l00306"></a>00306   o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a> (<a class="code" href="a00177.html#a30dbb2b364e7933ce57f1ba25e01d8a6">Tags::tag_buckets</a>);
<a name="l00307"></a>00307   <span class="keywordflow">for</span> (<a class="code" href="a00005.html" title="An iterator class to go through all buckets of the calendar.">BucketIterator</a> i = <a class="code" href="a00013.html#aea707a1a3065d4b9d35ca980b30d955c">beginBuckets</a>(); i != <a class="code" href="a00013.html#a40f84571543ad88f9626c118857757a1">endBuckets</a>(); ++i)
<a name="l00308"></a>00308     <span class="comment">// We use the FULL mode, to force the buckets being written regardless</span>
<a name="l00309"></a>00309     <span class="comment">// of the depth in the XML tree.</span>
<a name="l00310"></a>00310     o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#abf195fcbb64c846ed9c187eabbb45c94">Tags::tag_bucket</a>, *i, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398ae6f8960699e19b8d77b093b7e2c48619">FULL</a>);
<a name="l00311"></a>00311   o-&gt;<a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(<a class="code" href="a00177.html#a30dbb2b364e7933ce57f1ba25e01d8a6">Tags::tag_buckets</a>);
<a name="l00312"></a>00312 
<a name="l00313"></a>00313   o-&gt;<a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(tag);
<a name="l00314"></a>00314 }
<a name="l00315"></a>00315 
<a name="l00316"></a>00316 
<a name="l00317"></a><a class="code" href="a00013.html#a7cb853956999f789bed34ecdd19e3709">00317</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a>* <a class="code" href="a00013.html#a7cb853956999f789bed34ecdd19e3709">Calendar::createBucket</a>(<span class="keyword">const</span> <a class="code" href="a00003.html" title="This class represents a dictionary of keyword + value pairs.">AttributeList</a>&amp; atts)
<a name="l00318"></a>00318 {
<a name="l00319"></a>00319   <span class="comment">// Pick up the start, end and name attributes</span>
<a name="l00320"></a>00320   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> startdate = atts.<a class="code" href="a00003.html#afc79347bc21694cedfe218f8d023235f">get</a>(<a class="code" href="a00177.html#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>)-&gt;<a class="code" href="a00047.html#abe8c2019e5f79328a6a1fa1f3bb4bbae">getDate</a>();
<a name="l00321"></a>00321   <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>* d = atts.<a class="code" href="a00003.html#afc79347bc21694cedfe218f8d023235f">get</a>(<a class="code" href="a00177.html#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>);
<a name="l00322"></a>00322   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> enddate = *d ? d-&gt;<a class="code" href="a00047.html#abe8c2019e5f79328a6a1fa1f3bb4bbae">getDate</a>() : Date::infiniteFuture;
<a name="l00323"></a>00323   <span class="keywordtype">string</span> name = atts.<a class="code" href="a00003.html#afc79347bc21694cedfe218f8d023235f">get</a>(<a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>)-&gt;<a class="code" href="a00047.html#a053aa4cde35b21a399f26bca0132ab3f">getString</a>();
<a name="l00324"></a>00324 
<a name="l00325"></a>00325   <span class="comment">// Check for existence of the bucket: same name, start date and end date</span>
<a name="l00326"></a>00326   <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a>* result = NULL;
<a name="l00327"></a>00327   <span class="keywordflow">for</span> (<a class="code" href="a00005.html" title="An iterator class to go through all buckets of the calendar.">BucketIterator</a> x = <a class="code" href="a00013.html#aea707a1a3065d4b9d35ca980b30d955c">beginBuckets</a>(); x!=<a class="code" href="a00013.html#a40f84571543ad88f9626c118857757a1">endBuckets</a>(); ++x)
<a name="l00328"></a>00328   {
<a name="l00329"></a>00329     <span class="keywordflow">if</span> ((!name.empty() &amp;&amp; x-&gt;nm==name)
<a name="l00330"></a>00330       || (name.empty() &amp;&amp; x-&gt;startdate==startdate &amp;&amp; x-&gt;enddate==enddate))
<a name="l00331"></a>00331     {
<a name="l00332"></a>00332       <span class="comment">// Found!</span>
<a name="l00333"></a>00333       result = &amp;*x;
<a name="l00334"></a>00334       <span class="keywordflow">break</span>;
<a name="l00335"></a>00335     }
<a name="l00336"></a>00336   }
<a name="l00337"></a>00337 
<a name="l00338"></a>00338   <span class="comment">// Pick up the action attribute and update the bucket accordingly</span>
<a name="l00339"></a>00339   <span class="keywordflow">switch</span> (MetaClass::decodeAction(atts))
<a name="l00340"></a>00340   {
<a name="l00341"></a>00341     <span class="keywordflow">case</span> <a class="code" href="a00257.html#a07f97ddf3e649a4d2aa13cb900b5dcf4a8f6183fcf54ca6985ff2b5ef80673a25">ADD</a>:
<a name="l00342"></a>00342       <span class="comment">// Only additions are allowed</span>
<a name="l00343"></a>00343       <span class="keywordflow">if</span> (result)
<a name="l00344"></a>00344         <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">&quot;Bucket &quot;</span> + <span class="keywordtype">string</span>(startdate) + <span class="stringliteral">&quot; &quot;</span>
<a name="l00345"></a>00345             + <span class="keywordtype">string</span>(enddate) + <span class="stringliteral">&quot; &quot;</span> + name
<a name="l00346"></a>00346             + <span class="stringliteral">&quot; already exists in calendar &apos;&quot;</span> + <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>() + <span class="stringliteral">&quot;&apos;&quot;</span>);
<a name="l00347"></a>00347       result = <a class="code" href="a00013.html#a3661606a1b8cbb5cc45c61ba20dd5cfd">addBucket</a>(startdate, enddate, name);
<a name="l00348"></a>00348       <span class="keywordflow">return</span> result;
<a name="l00349"></a>00349     <span class="keywordflow">case</span> <a class="code" href="a00257.html#a07f97ddf3e649a4d2aa13cb900b5dcf4a1b9888c025bb8f78e322471fd5e14423">CHANGE</a>:
<a name="l00350"></a>00350       <span class="comment">// Only changes are allowed</span>
<a name="l00351"></a>00351       <span class="keywordflow">if</span> (!result)
<a name="l00352"></a>00352         <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">&quot;Bucket &quot;</span> + <span class="keywordtype">string</span>(startdate) + <span class="stringliteral">&quot; &quot;</span> + <span class="keywordtype">string</span>(enddate)
<a name="l00353"></a>00353             + <span class="stringliteral">&quot; &quot;</span> + name + <span class="stringliteral">&quot; doesn&apos;t exist in calendar &apos;&quot;</span> + <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>() + <span class="stringliteral">&quot;&apos;&quot;</span>);
<a name="l00354"></a>00354       <span class="keywordflow">return</span> result;
<a name="l00355"></a>00355     <span class="keywordflow">case</span> <a class="code" href="a00257.html#a07f97ddf3e649a4d2aa13cb900b5dcf4a6b9fb19e9a6595385dec31b63e0054e1">REMOVE</a>:
<a name="l00356"></a>00356       <span class="comment">// Delete the entity</span>
<a name="l00357"></a>00357       <span class="keywordflow">if</span> (!result)
<a name="l00358"></a>00358         <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">&quot;Bucket &quot;</span> + <span class="keywordtype">string</span>(startdate) + <span class="stringliteral">&quot; &quot;</span> + <span class="keywordtype">string</span>(enddate)
<a name="l00359"></a>00359             + <span class="stringliteral">&quot; &quot;</span> + name + <span class="stringliteral">&quot; doesn&apos;t exist in calendar &apos;&quot;</span> + <a class="code" href="a00182.html#a7416ca220c55147bc1276becc5b9de01">getName</a>() + <span class="stringliteral">&quot;&apos;&quot;</span>);
<a name="l00360"></a>00360       <span class="keywordflow">else</span>
<a name="l00361"></a>00361       {
<a name="l00362"></a>00362         <span class="comment">// Delete it</span>
<a name="l00363"></a>00363         <a class="code" href="a00013.html#a8065a4f5707d533b4d85e0b0beb86227">removeBucket</a>(result);
<a name="l00364"></a>00364         <span class="keywordflow">return</span> NULL;
<a name="l00365"></a>00365       }
<a name="l00366"></a>00366     <span class="keywordflow">case</span> <a class="code" href="a00257.html#a07f97ddf3e649a4d2aa13cb900b5dcf4a75b4aab762127e8083e16661b4021a00">ADD_CHANGE</a>:
<a name="l00367"></a>00367       <span class="keywordflow">if</span> (!result)
<a name="l00368"></a>00368         <span class="comment">// Adding a new bucket</span>
<a name="l00369"></a>00369         result = <a class="code" href="a00013.html#a3661606a1b8cbb5cc45c61ba20dd5cfd">addBucket</a>(startdate, enddate, name);
<a name="l00370"></a>00370       <span class="keywordflow">return</span> result;
<a name="l00371"></a>00371   }
<a name="l00372"></a>00372 
<a name="l00373"></a>00373   <span class="comment">// This part of the code isn&apos;t expected not be reached</span>
<a name="l00374"></a>00374   <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Unreachable code reached&quot;</span>);
<a name="l00375"></a>00375 }
<a name="l00376"></a>00376 
<a name="l00377"></a>00377 
<a name="l00378"></a><a class="code" href="a00013.html#a80f455f9b3862553366c29adb4dd8e7e">00378</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00013.html#a80f455f9b3862553366c29adb4dd8e7e">Calendar::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>&amp; pIn, <span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; pAttr)
<a name="l00379"></a>00379 {
<a name="l00380"></a>00380   <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a> (<a class="code" href="a00177.html#abf195fcbb64c846ed9c187eabbb45c94">Tags::tag_bucket</a>)
<a name="l00381"></a>00381       &amp;&amp; pIn.<a class="code" href="a00186.html#a407522e9d0dde7f7eebfafe182d050cf">getParentElement</a>().first.isA(<a class="code" href="a00177.html#a30dbb2b364e7933ce57f1ba25e01d8a6">Tags::tag_buckets</a>))
<a name="l00382"></a>00382     <span class="comment">// A new bucket</span>
<a name="l00383"></a>00383     pIn.<a class="code" href="a00186.html#a88dd6be5af6fc605d2d420fbcb397b18">readto</a>(<a class="code" href="a00013.html#a7cb853956999f789bed34ecdd19e3709">createBucket</a>(pIn.<a class="code" href="a00186.html#adcc4751961526c0103536acd194d32a0">getAttributes</a>()));
<a name="l00384"></a>00384 }
<a name="l00385"></a>00385 
<a name="l00386"></a>00386 
<a name="l00387"></a><a class="code" href="a00004.html#a0d175c88908e7789f03a44c694c0e5bd">00387</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00004.html#a0d175c88908e7789f03a44c694c0e5bd">Calendar::Bucket::writeHeader</a>(<a class="code" href="a00189.html" title="Base class for writing XML formatted data to an output stream.">XMLOutput</a> *o, <span class="keyword">const</span> <a class="code" href="a00096.html" title="This class defines a keyword for the frePPLe data model.">Keyword</a>&amp; tag)<span class="keyword"> const</span>
<a name="l00388"></a>00388 <span class="keyword"></span>{
<a name="l00389"></a>00389   <span class="comment">// The header line has a variable number of attributes: start, end and/or name</span>
<a name="l00390"></a>00390   <span class="keywordflow">if</span> (startdate != Date::infinitePast)
<a name="l00391"></a>00391   {
<a name="l00392"></a>00392     <span class="keywordflow">if</span> (enddate != Date::infiniteFuture)
<a name="l00393"></a>00393     {
<a name="l00394"></a>00394       <span class="keywordflow">if</span> (!nm.empty())
<a name="l00395"></a>00395         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>, <span class="keywordtype">string</span>(startdate), <a class="code" href="a00177.html#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>, <span class="keywordtype">string</span>(enddate), <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, nm);
<a name="l00396"></a>00396       <span class="keywordflow">else</span>
<a name="l00397"></a>00397         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>, <span class="keywordtype">string</span>(startdate), <a class="code" href="a00177.html#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>, <span class="keywordtype">string</span>(enddate));
<a name="l00398"></a>00398     }
<a name="l00399"></a>00399     <span class="keywordflow">else</span>
<a name="l00400"></a>00400     {
<a name="l00401"></a>00401       <span class="keywordflow">if</span> (!nm.empty())
<a name="l00402"></a>00402         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>, <span class="keywordtype">string</span>(startdate), <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, nm);
<a name="l00403"></a>00403       <span class="keywordflow">else</span>
<a name="l00404"></a>00404         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>, <span class="keywordtype">string</span>(startdate));
<a name="l00405"></a>00405     }
<a name="l00406"></a>00406   }
<a name="l00407"></a>00407   <span class="keywordflow">else</span>
<a name="l00408"></a>00408   {
<a name="l00409"></a>00409     <span class="keywordflow">if</span> (enddate != Date::infiniteFuture)
<a name="l00410"></a>00410     {
<a name="l00411"></a>00411       <span class="keywordflow">if</span> (!nm.empty())
<a name="l00412"></a>00412         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>, <span class="keywordtype">string</span>(enddate), <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, nm);
<a name="l00413"></a>00413       <span class="keywordflow">else</span>
<a name="l00414"></a>00414         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>, <span class="keywordtype">string</span>(enddate));
<a name="l00415"></a>00415     }
<a name="l00416"></a>00416     <span class="keywordflow">else</span>
<a name="l00417"></a>00417     {
<a name="l00418"></a>00418       <span class="keywordflow">if</span> (!nm.empty())
<a name="l00419"></a>00419         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag, <a class="code" href="a00177.html#aeb3841a93774dfc303e3df16304b5af2">Tags::tag_name</a>, nm);
<a name="l00420"></a>00420       <span class="keywordflow">else</span>
<a name="l00421"></a>00421         o-&gt;<a class="code" href="a00189.html#a5c1811dae2e3eae344ad366f6441a8a5">BeginObject</a>(tag);
<a name="l00422"></a>00422     }
<a name="l00423"></a>00423   }
<a name="l00424"></a>00424 }
<a name="l00425"></a>00425 
<a name="l00426"></a>00426 
<a name="l00427"></a>00427 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00013.html#aada6ba5b57ed15d5b9f639d3fb54955c">Calendar::Bucket::writeElement</a>
<a name="l00428"></a><a class="code" href="a00004.html#aa057a70100e1be8898bc616144641b81">00428</a> (<a class="code" href="a00189.html" title="Base class for writing XML formatted data to an output stream.">XMLOutput</a> *o, <span class="keyword">const</span> <a class="code" href="a00096.html" title="This class defines a keyword for the frePPLe data model.">Keyword</a>&amp; tag, <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398">mode</a> m) <span class="keyword">const</span>
<a name="l00429"></a>00429 {
<a name="l00430"></a>00430   assert(m == <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398a976ad2abb9fd10ca7e48fdff6bef2341">DEFAULT</a> || m == <a class="code" href="a00257.html#a20c2c7e4c6b668e71c154ae3eb18f398ae6f8960699e19b8d77b093b7e2c48619">FULL</a>);
<a name="l00431"></a>00431   writeHeader(o,tag);
<a name="l00432"></a>00432   <span class="keywordflow">if</span> (priority) o-&gt;<a class="code" href="a00189.html#a711922eea4cfe3c33b97e4188dacc7d2">writeElement</a>(<a class="code" href="a00177.html#af594a7455ab0f7ee255eab14acb44229">Tags::tag_priority</a>, priority);
<a name="l00433"></a>00433   o-&gt;<a class="code" href="a00189.html#a05375aa593bb0514020b035411c8983c">EndObject</a>(tag);
<a name="l00434"></a>00434 }
<a name="l00435"></a>00435 
<a name="l00436"></a>00436 
<a name="l00437"></a><a class="code" href="a00004.html#a986c72ca5eb5ea42663f09fc8b5533f6">00437</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> <a class="code" href="a00013.html#af329023a8f1fc62b562fd360c3a95140">Calendar::Bucket::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>&amp; pIn, <span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; pElement)
<a name="l00438"></a>00438 {
<a name="l00439"></a>00439   <span class="keywordflow">if</span> (pAttr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#af594a7455ab0f7ee255eab14acb44229">Tags::tag_priority</a>))
<a name="l00440"></a>00440     pElement &gt;&gt; priority;
<a name="l00441"></a>00441 }
<a name="l00442"></a>00442 
<a name="l00443"></a>00443 
<a name="l00444"></a><a class="code" href="a00061.html#a3ad86d4277f7e365b45b84749a0b3f3a">00444</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00061.html" title="An iterator class to go through all dates where the calendar value changes.">Calendar::EventIterator</a>&amp; <a class="code" href="a00061.html#a3ad86d4277f7e365b45b84749a0b3f3a">Calendar::EventIterator::operator++</a>()
<a name="l00445"></a>00445 {
<a name="l00446"></a>00446   <span class="comment">// Go over all entries and ask them to update the iterator</span>
<a name="l00447"></a>00447   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> d = <a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a>;
<a name="l00448"></a>00448   <a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a> = Date::infiniteFuture;  <span class="comment">// Cause end date is not included</span>
<a name="l00449"></a>00449   <a class="code" href="a00061.html#a23d29c08ee8a28039740fd93f41f5b8b">curBucket</a> = NULL;
<a name="l00450"></a>00450   <a class="code" href="a00061.html#a297a21ab7b7d3b67c9de70b2a90e7d80">curPriority</a> = DBL_MAX;
<a name="l00451"></a>00451   <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a> *b = <a class="code" href="a00061.html#a62df3a271883d04f42d10afe3ce4c406">theCalendar</a>-&gt;firstBucket; b; b = b-&gt;nextBucket)
<a name="l00452"></a>00452     b-&gt;nextEvent(<span class="keyword">this</span>, d);
<a name="l00453"></a>00453   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00454"></a>00454 }
<a name="l00455"></a>00455 
<a name="l00456"></a>00456 
<a name="l00457"></a><a class="code" href="a00061.html#af77357c87e0a8ccb42e45b1d523a0a56">00457</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <a class="code" href="a00061.html" title="An iterator class to go through all dates where the calendar value changes.">Calendar::EventIterator</a>&amp; <a class="code" href="a00061.html#af77357c87e0a8ccb42e45b1d523a0a56">Calendar::EventIterator::operator--</a>()
<a name="l00458"></a>00458 {
<a name="l00459"></a>00459   <span class="comment">// Go over all entries and ask them to update the iterator</span>
<a name="l00460"></a>00460   <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> d = <a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a>;
<a name="l00461"></a>00461   <a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a> = Date::infinitePast;
<a name="l00462"></a>00462   <a class="code" href="a00061.html#a23d29c08ee8a28039740fd93f41f5b8b">curBucket</a> = NULL;
<a name="l00463"></a>00463   <a class="code" href="a00061.html#a297a21ab7b7d3b67c9de70b2a90e7d80">curPriority</a> = DBL_MAX;
<a name="l00464"></a>00464   <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="a00004.html" title="This class represents a time bucket as a part of a calendar.">Calendar::Bucket</a> *b = <a class="code" href="a00061.html#a62df3a271883d04f42d10afe3ce4c406">theCalendar</a>-&gt;firstBucket; b; b = b-&gt;nextBucket)
<a name="l00465"></a>00465     b-&gt;prevEvent(<span class="keyword">this</span>, d);
<a name="l00466"></a>00466   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00467"></a>00467 }
<a name="l00468"></a>00468 
<a name="l00469"></a>00469 
<a name="l00470"></a>00470 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> Calendar::Bucket::nextEvent(<a class="code" href="a00061.html" title="An iterator class to go through all dates where the calendar value changes.">EventIterator</a>* iter, <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> refDate)<span class="keyword"> const</span>
<a name="l00471"></a>00471 <span class="keyword"></span>{
<a name="l00472"></a>00472   <span class="keywordflow">if</span> (iter-&gt;<a class="code" href="a00061.html#a297a21ab7b7d3b67c9de70b2a90e7d80">curPriority</a> &lt; priority)
<a name="l00473"></a>00473     <span class="comment">// Priority isn&apos;t low enough to overrule current date</span>
<a name="l00474"></a>00474     <span class="keywordflow">return</span>;
<a name="l00475"></a>00475 
<a name="l00476"></a>00476   <span class="keywordflow">if</span> (refDate &lt; startdate &amp;&amp; startdate &lt;= iter-&gt;<a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a>)
<a name="l00477"></a>00477   {
<a name="l00478"></a>00478     <span class="comment">// Next event is the start date of the bucket</span>
<a name="l00479"></a>00479     iter-&gt;<a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a> = startdate;
<a name="l00480"></a>00480     iter-&gt;<a class="code" href="a00061.html#a23d29c08ee8a28039740fd93f41f5b8b">curBucket</a> = <span class="keyword">this</span>;
<a name="l00481"></a>00481     iter-&gt;<a class="code" href="a00061.html#a297a21ab7b7d3b67c9de70b2a90e7d80">curPriority</a> = priority;
<a name="l00482"></a>00482     <span class="keywordflow">return</span>;
<a name="l00483"></a>00483   }
<a name="l00484"></a>00484 
<a name="l00485"></a>00485   <span class="keywordflow">if</span> (refDate &lt; enddate &amp;&amp; enddate &lt; iter-&gt;curDate)
<a name="l00486"></a>00486   {
<a name="l00487"></a>00487     <span class="comment">// Next event is the end date of the bucket</span>
<a name="l00488"></a>00488     iter-&gt;<a class="code" href="a00061.html#acab8e8a2aa626126d7cc1c28adc38c14">curDate</a> = enddate;
<a name="l00489"></a>00489     iter-&gt;<a class="code" href="a00061.html#a23d29c08ee8a28039740fd93f41f5b8b">curBucket</a> = iter-&gt;<a class="code" href="a00061.html#a62df3a271883d04f42d10afe3ce4c406">theCalendar</a>-&gt;<a class="code" href="a00013.html#a684447a848cfeb0aee605c158ca9a170">findBucket</a>(enddate);
<a name="l00490"></a>00490     iter-&gt;<a class="code" href="a00061.html#a297a21ab7b7d3b67c9de70b2a90e7d80">curPriority</a> = priority;
<a name="l00491"></a>00491     <span class="keywordflow">return</span>;
<a name="l00492"></a>00492   }
<a name="l00493"></a>00493 }
<a name="l00494"></a>00494 
<a name="l00495"></a>00495 
<a name="l00496"></a>00496 <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">void</span> Calendar::Bucket::prevEvent(EventIterator* iter, <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> refDate)<span class="keyword"> const</span>
<a name="l00497"></a>00497 <span class="keyword"></span>{
<a name="l00498"></a>00498   <span class="keywordflow">if</span> (iter-&gt;curPriority &lt; priority)
<a name="l00499"></a>00499     <span class="comment">// Priority isn&apos;t low enough to overrule current date</span>
<a name="l00500"></a>00500     <span class="keywordflow">return</span>;
<a name="l00501"></a>00501 
<a name="l00502"></a>00502   <span class="keywordflow">if</span> (refDate &gt; enddate &amp;&amp; enddate &gt;= iter-&gt;curDate)
<a name="l00503"></a>00503   {
<a name="l00504"></a>00504     <span class="comment">// Previous event is the end date of the bucket</span>
<a name="l00505"></a>00505     iter-&gt;curDate = enddate;
<a name="l00506"></a>00506     iter-&gt;curBucket = <span class="keyword">this</span>;
<a name="l00507"></a>00507     iter-&gt;curPriority = priority;
<a name="l00508"></a>00508     <span class="keywordflow">return</span>;
<a name="l00509"></a>00509   }
<a name="l00510"></a>00510 
<a name="l00511"></a>00511   <span class="keywordflow">if</span> (refDate &gt; startdate &amp;&amp; startdate &gt; iter-&gt;curDate)
<a name="l00512"></a>00512   {
<a name="l00513"></a>00513     <span class="comment">// Previous event is the start date of the bucket</span>
<a name="l00514"></a>00514     iter-&gt;curDate = startdate;
<a name="l00515"></a>00515     iter-&gt;curBucket = iter-&gt;theCalendar-&gt;findBucket(startdate,<span class="keyword">false</span>);
<a name="l00516"></a>00516     iter-&gt;curPriority = priority;
<a name="l00517"></a>00517     <span class="keywordflow">return</span>;
<a name="l00518"></a>00518   }
<a name="l00519"></a>00519 
<a name="l00520"></a>00520 }
<a name="l00521"></a>00521 
<a name="l00522"></a>00522 
<a name="l00523"></a><a class="code" href="a00013.html#a6442a6ddc64df28e310a8ed23eee53ad">00523</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00013.html#a6442a6ddc64df28e310a8ed23eee53ad">Calendar::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00524"></a>00524 {
<a name="l00525"></a>00525   <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="l00526"></a>00526     <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="l00527"></a>00527   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#a30dbb2b364e7933ce57f1ba25e01d8a6">Tags::tag_buckets</a>))
<a name="l00528"></a>00528     <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="a00015.html">CalendarBucketIterator</a>(<span class="keyword">this</span>);
<a name="l00529"></a>00529   <span class="keywordflow">return</span> NULL;
<a name="l00530"></a>00530 }
<a name="l00531"></a>00531 
<a name="l00532"></a>00532 
<a name="l00533"></a><a class="code" href="a00013.html#a4de02e90183c800fa2adf3d12dfc88f3">00533</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00013.html#a4de02e90183c800fa2adf3d12dfc88f3">Calendar::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00534"></a>00534 {
<a name="l00535"></a>00535   <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="l00536"></a>00536     <a class="code" href="a00085.html#a97d855d8c9bc9774da9cd8905e242dde">setName</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>());
<a name="l00537"></a>00537   <span class="keywordflow">else</span>
<a name="l00538"></a>00538     <span class="keywordflow">return</span> -1;  <span class="comment">// Error</span>
<a name="l00539"></a>00539   <span class="keywordflow">return</span> 0;  <span class="comment">// OK</span>
<a name="l00540"></a>00540 }
<a name="l00541"></a>00541 
<a name="l00542"></a>00542 
<a name="l00543"></a><a class="code" href="a00024.html#a0dcce604e020c88d10d7c0639ce54609">00543</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00024.html#a0dcce604e020c88d10d7c0639ce54609">CalendarVoid::setPythonValue</a>(PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict)
<a name="l00544"></a>00544 {
<a name="l00545"></a>00545   <span class="keywordflow">try</span>
<a name="l00546"></a>00546   {
<a name="l00547"></a>00547     <span class="comment">// Pick up the calendar</span>
<a name="l00548"></a>00548     <a class="code" href="a00024.html" title="A calendar only defining time buckets and not storing any data fields.">CalendarVoid</a> *cal = <span class="keyword">static_cast&lt;</span><a class="code" href="a00024.html" title="A calendar only defining time buckets and not storing any data fields.">CalendarVoid</a>*<span class="keyword">&gt;</span>(<span class="keyword">self</span>);
<a name="l00549"></a>00549     <span class="keywordflow">if</span> (!cal) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t set value of a NULL calendar&quot;</span>);
<a name="l00550"></a>00550 
<a name="l00551"></a>00551     <span class="comment">// Parse the arguments</span>
<a name="l00552"></a>00552     PyObject *pystart, *pyend, *pyval = NULL;
<a name="l00553"></a>00553     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;OO|O:setValue&quot;</span>, &amp;pystart, &amp;pyend, &amp;pyval))
<a name="l00554"></a>00554       <span class="keywordflow">return</span> NULL;
<a name="l00555"></a>00555 
<a name="l00556"></a>00556     <span class="comment">// Update the calendar</span>
<a name="l00557"></a>00557     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> start(pystart), <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">end</a>(pyend);
<a name="l00558"></a>00558     cal-&gt;<a class="code" href="a00013.html#a3661606a1b8cbb5cc45c61ba20dd5cfd">addBucket</a>(start.getDate(), end.<a class="code" href="a00154.html#aa72c83cab5f89f71aff63f0bfad26bd1">getDate</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l00559"></a>00559   }
<a name="l00560"></a>00560   <span class="keywordflow">catch</span>(...)
<a name="l00561"></a>00561   {
<a name="l00562"></a>00562     PythonType::evalException();
<a name="l00563"></a>00563     <span class="keywordflow">return</span> NULL;
<a name="l00564"></a>00564   }
<a name="l00565"></a>00565   <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00566"></a>00566 }
<a name="l00567"></a>00567 
<a name="l00568"></a>00568 
<a name="l00569"></a><a class="code" href="a00014.html#a46a0799cf04a4f95cfd313c65bea577d">00569</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00014.html#a46a0799cf04a4f95cfd313c65bea577d">CalendarBool::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00570"></a>00570 {
<a name="l00571"></a>00571   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00572"></a>00572     <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="a00023.html#a156309370ee8f10385d95e586670152a">getDefault</a>());
<a name="l00573"></a>00573   <span class="keywordflow">return</span> <a class="code" href="a00014.html#a46a0799cf04a4f95cfd313c65bea577d">Calendar::getattro</a>(attr);
<a name="l00574"></a>00574 }
<a name="l00575"></a>00575 
<a name="l00576"></a>00576 
<a name="l00577"></a><a class="code" href="a00014.html#aa7f58a34fede66c8807adc645f406813">00577</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00014.html#aa7f58a34fede66c8807adc645f406813">CalendarBool::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00578"></a>00578 {
<a name="l00579"></a>00579   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00580"></a>00580     <a class="code" href="a00023.html#abbe5b906c2087c141d60400801bb0b1d">setDefault</a>(field.<a class="code" href="a00154.html#a804b478fb76759d334882ee468fc84f9">getBool</a>());
<a name="l00581"></a>00581   <span class="keywordflow">else</span>
<a name="l00582"></a>00582     <span class="keywordflow">return</span> <a class="code" href="a00014.html#aa7f58a34fede66c8807adc645f406813">Calendar::setattro</a>(attr, field);
<a name="l00583"></a>00583   <span class="keywordflow">return</span> 0;
<a name="l00584"></a>00584 }
<a name="l00585"></a>00585 
<a name="l00586"></a>00586 
<a name="l00587"></a><a class="code" href="a00014.html#a1dc21c5b566db261f95528ae94bd536e">00587</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00014.html#a1dc21c5b566db261f95528ae94bd536e">CalendarBool::setPythonValue</a>(PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict)
<a name="l00588"></a>00588 {
<a name="l00589"></a>00589   <span class="keywordflow">try</span>
<a name="l00590"></a>00590   {
<a name="l00591"></a>00591     <span class="comment">// Pick up the calendar</span>
<a name="l00592"></a>00592     <a class="code" href="a00014.html" title="A calendar storing boolean values in its buckets.">CalendarBool</a> *cal = <span class="keyword">static_cast&lt;</span><a class="code" href="a00014.html" title="A calendar storing boolean values in its buckets.">CalendarBool</a>*<span class="keyword">&gt;</span>(<span class="keyword">self</span>);
<a name="l00593"></a>00593     <span class="keywordflow">if</span> (!cal) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t set value of a NULL calendar&quot;</span>);
<a name="l00594"></a>00594 
<a name="l00595"></a>00595     <span class="comment">// Parse the arguments</span>
<a name="l00596"></a>00596     PyObject *pystart, *pyend, *pyval;
<a name="l00597"></a>00597     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;OOO:setValue&quot;</span>, &amp;pystart, &amp;pyend, &amp;pyval))
<a name="l00598"></a>00598       <span class="keywordflow">return</span> NULL;
<a name="l00599"></a>00599 
<a name="l00600"></a>00600     <span class="comment">// Update the calendar</span>
<a name="l00601"></a>00601     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> start(pystart), <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">end</a>(pyend), val(pyval);
<a name="l00602"></a>00602     cal-&gt;<a class="code" href="a00023.html#a5888afe15ac98205aff226fa224b2962">setValue</a>(start.getDate(), end.getDate(), val.<a class="code" href="a00154.html#a804b478fb76759d334882ee468fc84f9">getBool</a>());
<a name="l00603"></a>00603   }
<a name="l00604"></a>00604   <span class="keywordflow">catch</span>(...)
<a name="l00605"></a>00605   {
<a name="l00606"></a>00606     PythonType::evalException();
<a name="l00607"></a>00607     <span class="keywordflow">return</span> NULL;
<a name="l00608"></a>00608   }
<a name="l00609"></a>00609   <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00610"></a>00610 }
<a name="l00611"></a>00611 
<a name="l00612"></a>00612 
<a name="l00613"></a><a class="code" href="a00016.html#ac3d3a78412cbb6d7fba4dfc8bd75c4e2">00613</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00016.html#ac3d3a78412cbb6d7fba4dfc8bd75c4e2">CalendarDouble::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00614"></a>00614 {
<a name="l00615"></a>00615   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00616"></a>00616     <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="a00023.html#a156309370ee8f10385d95e586670152a">getDefault</a>());
<a name="l00617"></a>00617   <span class="keywordflow">return</span> <a class="code" href="a00016.html#ac3d3a78412cbb6d7fba4dfc8bd75c4e2">Calendar::getattro</a>(attr);
<a name="l00618"></a>00618 }
<a name="l00619"></a>00619 
<a name="l00620"></a>00620 
<a name="l00621"></a><a class="code" href="a00016.html#ad2e6773d2dff5537d63bd47b7b68881f">00621</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00016.html#ad2e6773d2dff5537d63bd47b7b68881f">CalendarDouble::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00622"></a>00622 {
<a name="l00623"></a>00623   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00624"></a>00624     <a class="code" href="a00023.html#abbe5b906c2087c141d60400801bb0b1d">setDefault</a>(field.<a class="code" href="a00154.html#ad292e9b75b65eef65ff8701939ab348a">getDouble</a>());
<a name="l00625"></a>00625   <span class="keywordflow">else</span>
<a name="l00626"></a>00626     <span class="keywordflow">return</span> <a class="code" href="a00016.html#ad2e6773d2dff5537d63bd47b7b68881f">Calendar::setattro</a>(attr, field);
<a name="l00627"></a>00627   <span class="keywordflow">return</span> 0;
<a name="l00628"></a>00628 }
<a name="l00629"></a>00629 
<a name="l00630"></a>00630 
<a name="l00631"></a><a class="code" href="a00016.html#adfcd29e7ad961cdcec5fea5d00920c7e">00631</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00016.html#adfcd29e7ad961cdcec5fea5d00920c7e">CalendarDouble::setPythonValue</a>(PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict)
<a name="l00632"></a>00632 {
<a name="l00633"></a>00633   <span class="keywordflow">try</span>
<a name="l00634"></a>00634   {
<a name="l00635"></a>00635     <span class="comment">// Pick up the calendar</span>
<a name="l00636"></a>00636     <a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a> *cal = <span class="keyword">static_cast&lt;</span><a class="code" href="a00016.html" title="A calendar storing double values in its buckets.">CalendarDouble</a>*<span class="keyword">&gt;</span>(<span class="keyword">self</span>);
<a name="l00637"></a>00637     <span class="keywordflow">if</span> (!cal) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t set value of a NULL calendar&quot;</span>);
<a name="l00638"></a>00638 
<a name="l00639"></a>00639     <span class="comment">// Parse the arguments</span>
<a name="l00640"></a>00640     PyObject *pystart, *pyend, *pyval;
<a name="l00641"></a>00641     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;OOO:setValue&quot;</span>, &amp;pystart, &amp;pyend, &amp;pyval))
<a name="l00642"></a>00642       <span class="keywordflow">return</span> NULL;
<a name="l00643"></a>00643 
<a name="l00644"></a>00644     <span class="comment">// Update the calendar</span>
<a name="l00645"></a>00645     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> start(pystart), <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">end</a>(pyend), val(pyval);
<a name="l00646"></a>00646     cal-&gt;<a class="code" href="a00023.html#a5888afe15ac98205aff226fa224b2962">setValue</a>(start.getDate(), end.getDate(), val.<a class="code" href="a00154.html#ad292e9b75b65eef65ff8701939ab348a">getDouble</a>());
<a name="l00647"></a>00647   }
<a name="l00648"></a>00648   <span class="keywordflow">catch</span>(...)
<a name="l00649"></a>00649   {
<a name="l00650"></a>00650     PythonType::evalException();
<a name="l00651"></a>00651     <span class="keywordflow">return</span> NULL;
<a name="l00652"></a>00652   }
<a name="l00653"></a>00653   <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00654"></a>00654 }
<a name="l00655"></a>00655 
<a name="l00656"></a>00656 
<a name="l00657"></a><a class="code" href="a00022.html#af64080a52d06472941bb0bc448d2744b">00657</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00022.html#af64080a52d06472941bb0bc448d2744b">CalendarString::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00658"></a>00658 {
<a name="l00659"></a>00659   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00660"></a>00660     <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="a00023.html#a156309370ee8f10385d95e586670152a">getDefault</a>());
<a name="l00661"></a>00661   <span class="keywordflow">return</span> <a class="code" href="a00022.html#af64080a52d06472941bb0bc448d2744b">Calendar::getattro</a>(attr);
<a name="l00662"></a>00662 }
<a name="l00663"></a>00663 
<a name="l00664"></a>00664 
<a name="l00665"></a><a class="code" href="a00022.html#a31b8b92061fd8874785b07356080b93e">00665</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00022.html#a31b8b92061fd8874785b07356080b93e">CalendarString::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00666"></a>00666 {
<a name="l00667"></a>00667   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00668"></a>00668     <a class="code" href="a00023.html#abbe5b906c2087c141d60400801bb0b1d">setDefault</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>());
<a name="l00669"></a>00669   <span class="keywordflow">else</span>
<a name="l00670"></a>00670     <span class="keywordflow">return</span> <a class="code" href="a00022.html#a31b8b92061fd8874785b07356080b93e">Calendar::setattro</a>(attr, field);
<a name="l00671"></a>00671   <span class="keywordflow">return</span> 0;
<a name="l00672"></a>00672 }
<a name="l00673"></a>00673 
<a name="l00674"></a>00674 
<a name="l00675"></a><a class="code" href="a00022.html#a463eb38c1faa273ba99170f9ff1ccf32">00675</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00022.html#a463eb38c1faa273ba99170f9ff1ccf32">CalendarString::setPythonValue</a>(PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict)
<a name="l00676"></a>00676 {
<a name="l00677"></a>00677   <span class="keywordflow">try</span>
<a name="l00678"></a>00678   {
<a name="l00679"></a>00679     <span class="comment">// Pick up the calendar</span>
<a name="l00680"></a>00680     <a class="code" href="a00022.html" title="A calendar storing strings in its buckets.">CalendarString</a> *cal = <span class="keyword">static_cast&lt;</span><a class="code" href="a00022.html" title="A calendar storing strings in its buckets.">CalendarString</a>*<span class="keyword">&gt;</span>(<span class="keyword">self</span>);
<a name="l00681"></a>00681     <span class="keywordflow">if</span> (!cal) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t set value of a NULL calendar&quot;</span>);
<a name="l00682"></a>00682 
<a name="l00683"></a>00683     <span class="comment">// Parse the arguments</span>
<a name="l00684"></a>00684     PyObject *pystart, *pyend, *pyval;
<a name="l00685"></a>00685     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;OOO:setValue&quot;</span>, &amp;pystart, &amp;pyend, &amp;pyval))
<a name="l00686"></a>00686       <span class="keywordflow">return</span> NULL;
<a name="l00687"></a>00687 
<a name="l00688"></a>00688     <span class="comment">// Update the calendar</span>
<a name="l00689"></a>00689     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> start(pystart), <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">end</a>(pyend), val(pyval);
<a name="l00690"></a>00690     cal-&gt;<a class="code" href="a00023.html#a5888afe15ac98205aff226fa224b2962">setValue</a>(start.getDate(), end.getDate(), val.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>());
<a name="l00691"></a>00691   }
<a name="l00692"></a>00692   <span class="keywordflow">catch</span>(...)
<a name="l00693"></a>00693   {
<a name="l00694"></a>00694     PythonType::evalException();
<a name="l00695"></a>00695     <span class="keywordflow">return</span> NULL;
<a name="l00696"></a>00696   }
<a name="l00697"></a>00697   <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00698"></a>00698 }
<a name="l00699"></a>00699 
<a name="l00700"></a>00700 
<a name="l00701"></a><a class="code" href="a00018.html#a9b7480fd3fde9bbd3223724dc4cccbce">00701</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00018.html#a9b7480fd3fde9bbd3223724dc4cccbce">CalendarInt::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00702"></a>00702 {
<a name="l00703"></a>00703   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00704"></a>00704     <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="a00023.html#a156309370ee8f10385d95e586670152a">getDefault</a>());
<a name="l00705"></a>00705   <span class="keywordflow">return</span> <a class="code" href="a00018.html#a9b7480fd3fde9bbd3223724dc4cccbce">Calendar::getattro</a>(attr);
<a name="l00706"></a>00706 }
<a name="l00707"></a>00707 
<a name="l00708"></a>00708 
<a name="l00709"></a><a class="code" href="a00018.html#adc2a7dcf7eafdf8e600e82978587f836">00709</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00018.html#adc2a7dcf7eafdf8e600e82978587f836">CalendarInt::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00710"></a>00710 {
<a name="l00711"></a>00711   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00712"></a>00712     <a class="code" href="a00023.html#abbe5b906c2087c141d60400801bb0b1d">setDefault</a>(field.<a class="code" href="a00154.html#a783ec10f02cad37886df55bc3f08ba5e">getInt</a>());
<a name="l00713"></a>00713   <span class="keywordflow">else</span>
<a name="l00714"></a>00714     <span class="keywordflow">return</span> <a class="code" href="a00018.html#adc2a7dcf7eafdf8e600e82978587f836">Calendar::setattro</a>(attr, field);
<a name="l00715"></a>00715   <span class="keywordflow">return</span> 0;
<a name="l00716"></a>00716 }
<a name="l00717"></a>00717 
<a name="l00718"></a>00718 
<a name="l00719"></a><a class="code" href="a00018.html#ae7546325682c29ab2aa9eaa7cb2c4fa5">00719</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00018.html#ae7546325682c29ab2aa9eaa7cb2c4fa5">CalendarInt::setPythonValue</a>(PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict)
<a name="l00720"></a>00720 {
<a name="l00721"></a>00721   <span class="keywordflow">try</span>
<a name="l00722"></a>00722   {
<a name="l00723"></a>00723     <span class="comment">// Pick up the calendar</span>
<a name="l00724"></a>00724     <a class="code" href="a00018.html" title="A calendar storing integer values in its buckets.">CalendarInt</a> *cal = <span class="keyword">static_cast&lt;</span><a class="code" href="a00018.html" title="A calendar storing integer values in its buckets.">CalendarInt</a>*<span class="keyword">&gt;</span>(<span class="keyword">self</span>);
<a name="l00725"></a>00725     <span class="keywordflow">if</span> (!cal) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t set value of a NULL calendar&quot;</span>);
<a name="l00726"></a>00726 
<a name="l00727"></a>00727     <span class="comment">// Parse the arguments</span>
<a name="l00728"></a>00728     PyObject *pystart, *pyend, *pyval;
<a name="l00729"></a>00729     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;OOO:setValue&quot;</span>, &amp;pystart, &amp;pyend, &amp;pyval))
<a name="l00730"></a>00730       <span class="keywordflow">return</span> NULL;
<a name="l00731"></a>00731 
<a name="l00732"></a>00732     <span class="comment">// Update the calendar</span>
<a name="l00733"></a>00733     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> start(pystart), <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">end</a>(pyend), val(pyval);
<a name="l00734"></a>00734     cal-&gt;<a class="code" href="a00023.html#a5888afe15ac98205aff226fa224b2962">setValue</a>(start.getDate(), end.getDate(), val.<a class="code" href="a00154.html#a783ec10f02cad37886df55bc3f08ba5e">getInt</a>());
<a name="l00735"></a>00735   }
<a name="l00736"></a>00736   <span class="keywordflow">catch</span>(...)
<a name="l00737"></a>00737   {
<a name="l00738"></a>00738     PythonType::evalException();
<a name="l00739"></a>00739     <span class="keywordflow">return</span> NULL;
<a name="l00740"></a>00740   }
<a name="l00741"></a>00741   <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00742"></a>00742 }
<a name="l00743"></a>00743 
<a name="l00744"></a>00744 
<a name="l00745"></a><a class="code" href="a00020.html#a9db7563f67b7ed94af7d513e1607d4b1">00745</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00020.html#a9db7563f67b7ed94af7d513e1607d4b1">CalendarOperation::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00746"></a>00746 {
<a name="l00747"></a>00747   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00748"></a>00748     <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="a00021.html#a60c1fdbc52120933fac6113f8b1b24b9">getDefault</a>());
<a name="l00749"></a>00749   <span class="keywordflow">return</span> <a class="code" href="a00020.html#a9db7563f67b7ed94af7d513e1607d4b1">Calendar::getattro</a>(attr);
<a name="l00750"></a>00750 }
<a name="l00751"></a>00751 
<a name="l00752"></a>00752 
<a name="l00753"></a><a class="code" href="a00020.html#a0d49b6951511edf6574a258ecb943120">00753</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00020.html#a0d49b6951511edf6574a258ecb943120">CalendarOperation::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00754"></a>00754 {
<a name="l00755"></a>00755   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#acefc08086c99e96cd99d28ca3a98847b">Tags::tag_default</a>))
<a name="l00756"></a>00756   {
<a name="l00757"></a>00757     <span class="keywordflow">if</span> (!field.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00121.html#afcc9adf1a9c37fd168af778368601978">Operation::metadata</a>))
<a name="l00758"></a>00758     {
<a name="l00759"></a>00759       PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">&quot;calendar_operation stores values of type operation&quot;</span>);
<a name="l00760"></a>00760       <span class="keywordflow">return</span> -1;
<a name="l00761"></a>00761     }
<a name="l00762"></a>00762     <a class="code" href="a00121.html" title="An operation represents an activity: these consume and produce material, take time...">Operation</a>* y = <span class="keyword">static_cast&lt;</span><a class="code" href="a00121.html" title="An operation represents an activity: these consume and produce material, take time...">Operation</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span>PyObject*<span class="keyword">&gt;</span>(field));
<a name="l00763"></a>00763     <a class="code" href="a00021.html#a7023ddbc437b13ae381d8e651351ea4f">setDefault</a>(y);
<a name="l00764"></a>00764   }
<a name="l00765"></a>00765   <span class="keywordflow">else</span>
<a name="l00766"></a>00766     <span class="keywordflow">return</span> <a class="code" href="a00020.html#a0d49b6951511edf6574a258ecb943120">Calendar::setattro</a>(attr, field);
<a name="l00767"></a>00767   <span class="keywordflow">return</span> 0;
<a name="l00768"></a>00768 }
<a name="l00769"></a>00769 
<a name="l00770"></a>00770 
<a name="l00771"></a><a class="code" href="a00020.html#a7226ded7b997b89e2bf0011efa6013dc">00771</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00020.html#a7226ded7b997b89e2bf0011efa6013dc">CalendarOperation::setPythonValue</a>(PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict)
<a name="l00772"></a>00772 {
<a name="l00773"></a>00773   <span class="keywordflow">try</span>
<a name="l00774"></a>00774   {
<a name="l00775"></a>00775     <span class="comment">// Pick up the calendar</span>
<a name="l00776"></a>00776     <a class="code" href="a00020.html" title="A calendar storing pointers to operations in its buckets.">CalendarOperation</a> *cal = <span class="keyword">static_cast&lt;</span><a class="code" href="a00020.html" title="A calendar storing pointers to operations in its buckets.">CalendarOperation</a>*<span class="keyword">&gt;</span>(<span class="keyword">self</span>);
<a name="l00777"></a>00777     <span class="keywordflow">if</span> (!cal) <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Can&apos;t set value of a NULL calendar&quot;</span>);
<a name="l00778"></a>00778 
<a name="l00779"></a>00779     <span class="comment">// Parse the arguments</span>
<a name="l00780"></a>00780     PyObject *pystart, *pyend, *pyval;
<a name="l00781"></a>00781     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;OOO:setValue&quot;</span>, &amp;pystart, &amp;pyend, &amp;pyval))
<a name="l00782"></a>00782       <span class="keywordflow">return</span> NULL;
<a name="l00783"></a>00783 
<a name="l00784"></a>00784     <span class="comment">// Update the calendar</span>
<a name="l00785"></a>00785     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> start(pystart), <a class="code" href="a00085.html#abb9d04973550ac71037718511358f2ff">end</a>(pyend), val(pyval);
<a name="l00786"></a>00786     <span class="keywordflow">if</span> (!val.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00121.html#afcc9adf1a9c37fd168af778368601978">Operation::metadata</a>))
<a name="l00787"></a>00787     {
<a name="l00788"></a>00788       PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">&quot;calendar_operation stores values of type operation&quot;</span>);
<a name="l00789"></a>00789       <span class="keywordflow">return</span> NULL;
<a name="l00790"></a>00790     }
<a name="l00791"></a>00791     <a class="code" href="a00121.html" title="An operation represents an activity: these consume and produce material, take time...">Operation</a>* y = <span class="keyword">static_cast&lt;</span><a class="code" href="a00121.html" title="An operation represents an activity: these consume and produce material, take time...">Operation</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span>PyObject*<span class="keyword">&gt;</span>(val));
<a name="l00792"></a>00792     cal-&gt;<a class="code" href="a00021.html#ac5d8ec5afdebe9a2d51160b9b737915b">setValue</a>(start.getDate(), end.getDate(), y);
<a name="l00793"></a>00793   }
<a name="l00794"></a>00794   <span class="keywordflow">catch</span>(...)
<a name="l00795"></a>00795   {
<a name="l00796"></a>00796     PythonType::evalException();
<a name="l00797"></a>00797     <span class="keywordflow">return</span> NULL;
<a name="l00798"></a>00798   }
<a name="l00799"></a>00799   <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00800"></a>00800 }
<a name="l00801"></a>00801 
<a name="l00802"></a>00802 
<a name="l00803"></a><a class="code" href="a00015.html#aa7b2c156354d5cbba65ee32ef96de976">00803</a> <span class="keywordtype">int</span> <a class="code" href="a00015.html#aa7b2c156354d5cbba65ee32ef96de976">CalendarBucketIterator::initialize</a>()
<a name="l00804"></a>00804 {
<a name="l00805"></a>00805   <span class="comment">// Initialize the type</span>
<a name="l00806"></a>00806   <a class="code" href="a00155.html" title="This class is a thin wrapper around the type information in Python.">PythonType</a>&amp; x = <a class="code" href="a00150.html#aec65c2cd811051918027ae6dc00fcfaf">PythonExtension&lt;CalendarBucketIterator&gt;::getType</a>();
<a name="l00807"></a>00807   x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">&quot;calendarBucketIterator&quot;</span>);
<a name="l00808"></a>00808   x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">&quot;frePPLe iterator for calendar buckets&quot;</span>);
<a name="l00809"></a>00809   x.<a class="code" href="a00155.html#a5bacf8ad021ab55b1056440880cf8760">supportiter</a>();
<a name="l00810"></a>00810   <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>();
<a name="l00811"></a>00811 }
<a name="l00812"></a>00812 
<a name="l00813"></a>00813 
<a name="l00814"></a>00814 PyObject* CalendarBucketIterator::iternext()
<a name="l00815"></a>00815 {
<a name="l00816"></a>00816   <span class="keywordflow">if</span> (i == cal-&gt;<a class="code" href="a00013.html#a40f84571543ad88f9626c118857757a1">endBuckets</a>()) <span class="keywordflow">return</span> NULL;
<a name="l00817"></a>00817   PyObject *result = &amp;*(i++);
<a name="l00818"></a>00818   Py_INCREF(result);
<a name="l00819"></a>00819   <span class="keywordflow">return</span> result;
<a name="l00820"></a>00820 }
<a name="l00821"></a>00821 
<a name="l00822"></a>00822 
<a name="l00823"></a><a class="code" href="a00004.html#a05cd3bbccc162fb0b2f1f3b8b455fa20">00823</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00004.html#a05cd3bbccc162fb0b2f1f3b8b455fa20">Calendar::Bucket::getattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; attr)
<a name="l00824"></a>00824 {
<a name="l00825"></a>00825   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>))
<a name="l00826"></a>00826     <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="a00004.html#a6fee57da0b402d5a8274aa2236ae0fa7">getStart</a>());
<a name="l00827"></a>00827   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>))
<a name="l00828"></a>00828     <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="a00004.html#abe0d506c6f5f9784b026fa7058cb582b">getEnd</a>());
<a name="l00829"></a>00829   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#aeb7c7e625dd632e74ed1d9ca30120e91">Tags::tag_value</a>))
<a name="l00830"></a>00830   {
<a name="l00831"></a>00831     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00016.html#a758e254f27a10333b8801eecf7874b15">CalendarDouble::metadata</a>)
<a name="l00832"></a>00832       <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>(<span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;double&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;getValue());
<a name="l00833"></a>00833     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00014.html#a4e59f3a471d2e396aaf55dcc1ff4c277">CalendarBool::metadata</a>)
<a name="l00834"></a>00834       <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>(<span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;bool&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;getValue());
<a name="l00835"></a>00835     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00018.html#ab15c85aa41b4c5dcaa9af899d9eb6f38">CalendarInt::metadata</a>)
<a name="l00836"></a>00836       <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>(<span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;int&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;getValue());
<a name="l00837"></a>00837     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00022.html#a46227f436586ec5c3fc77321a4ebf687">CalendarString::metadata</a>)
<a name="l00838"></a>00838       <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>(<span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;string&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;getValue());
<a name="l00839"></a>00839     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00020.html#acb40eff94a33c81335e0707cc9f8df45">CalendarOperation::metadata</a>)
<a name="l00840"></a>00840       <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>(<span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00021.html" title="This calendar type is used to store object pointers in its buckets.">CalendarPointer&lt;Operation&gt;::BucketPointer</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;getValue());
<a name="l00841"></a>00841     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00024.html#af7865b7cf1b4a9314d150c9906219833">CalendarVoid::metadata</a>)
<a name="l00842"></a>00842       <span class="keywordflow">return</span> Py_BuildValue(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00843"></a>00843     PyErr_SetString(<a class="code" href="a00257.html#a5e53a387c0e6c65a18ee76396f03d1d0" title="Python exception class matching with frepple::LogicException.">PythonLogicException</a>, <span class="stringliteral">&quot;calendar type not recognized&quot;</span>);
<a name="l00844"></a>00844     <span class="keywordflow">return</span> NULL;
<a name="l00845"></a>00845   }
<a name="l00846"></a>00846   <span class="keywordflow">if</span> (attr.<a class="code" href="a00002.html#aebffce6c4fcf1696ca34f63f2b6ee091">isA</a>(<a class="code" href="a00177.html#af594a7455ab0f7ee255eab14acb44229">Tags::tag_priority</a>))
<a name="l00847"></a>00847     <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="a00004.html#a1ee4f2d13a569d57455010bc07e87e8f">getPriority</a>());
<a name="l00848"></a>00848   <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="l00849"></a>00849     <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="a00004.html#abb2dfd16fa97bc9a11b3d57a7422c010">getName</a>());
<a name="l00850"></a>00850   <span class="keywordflow">return</span> NULL;
<a name="l00851"></a>00851 }
<a name="l00852"></a>00852 
<a name="l00853"></a>00853 
<a name="l00854"></a><a class="code" href="a00004.html#a970aa8fef3b7045bec049267f319a534">00854</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> <span class="keywordtype">int</span> <a class="code" href="a00013.html#a4de02e90183c800fa2adf3d12dfc88f3">Calendar::Bucket::setattro</a>(<span class="keyword">const</span> <a class="code" href="a00002.html" title="A class to model keyword instances.">Attribute</a>&amp; 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>&amp; field)
<a name="l00855"></a>00855 {
<a name="l00856"></a>00856   <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="l00857"></a>00857     <a class="code" href="a00004.html#a3557885f7f93cf0d7c37ed6d07d729f0">setName</a>(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>());
<a name="l00858"></a>00858   <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#ae9fda65e25c8720724e21b35138deec0">Tags::tag_start</a>))
<a name="l00859"></a>00859     <a class="code" href="a00004.html#ae3255059e42e08ad87f8ba5680825138">setStart</a>(field.<a class="code" href="a00154.html#aa72c83cab5f89f71aff63f0bfad26bd1">getDate</a>());
<a name="l00860"></a>00860   <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#ae7b833aedeada2860688b90cb947cdb2">Tags::tag_end</a>))
<a name="l00861"></a>00861     <a class="code" href="a00004.html#a69afab48556134260c898f2a0a9d1cc0">setEnd</a>(field.<a class="code" href="a00154.html#aa72c83cab5f89f71aff63f0bfad26bd1">getDate</a>());
<a name="l00862"></a>00862   <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#af594a7455ab0f7ee255eab14acb44229">Tags::tag_priority</a>))
<a name="l00863"></a>00863     <a class="code" href="a00004.html#a3938b2e4e2a5791f8afd2bd8db8a72c6">setPriority</a>(field.<a class="code" href="a00154.html#a783ec10f02cad37886df55bc3f08ba5e">getInt</a>());
<a name="l00864"></a>00864   <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#aeb7c7e625dd632e74ed1d9ca30120e91">Tags::tag_value</a>))
<a name="l00865"></a>00865   {
<a name="l00866"></a>00866     <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00016.html#a758e254f27a10333b8801eecf7874b15">CalendarDouble::metadata</a>)
<a name="l00867"></a>00867       <span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;double&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;setValue(field.<a class="code" href="a00154.html#ad292e9b75b65eef65ff8701939ab348a">getDouble</a>());
<a name="l00868"></a>00868     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00014.html#a4e59f3a471d2e396aaf55dcc1ff4c277">CalendarBool::metadata</a>)
<a name="l00869"></a>00869       <span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;bool&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;setValue(field.<a class="code" href="a00154.html#a804b478fb76759d334882ee468fc84f9">getBool</a>());
<a name="l00870"></a>00870     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00018.html#ab15c85aa41b4c5dcaa9af899d9eb6f38">CalendarInt::metadata</a>)
<a name="l00871"></a>00871       <span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;int&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;setValue(field.<a class="code" href="a00154.html#a783ec10f02cad37886df55bc3f08ba5e">getInt</a>());
<a name="l00872"></a>00872     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00022.html#a46227f436586ec5c3fc77321a4ebf687">CalendarString::metadata</a>)
<a name="l00873"></a>00873       <span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00023.html" title="This calendar type is used to store values in its buckets.">CalendarValue&lt;string&gt;::BucketValue</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;setValue(field.<a class="code" href="a00154.html#a471bd4797fe735e12a1f485e05fc5940">getString</a>());
<a name="l00874"></a>00874     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00020.html#acb40eff94a33c81335e0707cc9f8df45">CalendarOperation::metadata</a>)
<a name="l00875"></a>00875     {
<a name="l00876"></a>00876       <span class="keywordflow">if</span> (!field.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00121.html#afcc9adf1a9c37fd168af778368601978">Operation::metadata</a>))
<a name="l00877"></a>00877       {
<a name="l00878"></a>00878         PyErr_SetString(<a class="code" href="a00257.html#a75c689d2dca4282e2ca0dad79dab1063" title="Python exception class matching with frepple::DataException.">PythonDataException</a>, <span class="stringliteral">&quot;calendar_operation stores values of type operation&quot;</span>);
<a name="l00879"></a>00879         <span class="keywordflow">return</span> -1;
<a name="l00880"></a>00880       }
<a name="l00881"></a>00881       <a class="code" href="a00121.html" title="An operation represents an activity: these consume and produce material, take time...">Operation</a>* y = <span class="keyword">static_cast&lt;</span><a class="code" href="a00121.html" title="An operation represents an activity: these consume and produce material, take time...">Operation</a>*<span class="keyword">&gt;</span>(<span class="keyword">static_cast&lt;</span>PyObject*<span class="keyword">&gt;</span>(field));
<a name="l00882"></a>00882       <span class="keyword">dynamic_cast&lt;</span> <a class="code" href="a00021.html" title="This calendar type is used to store object pointers in its buckets.">CalendarPointer&lt;Operation&gt;::BucketPointer</a>* <span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;<a class="code" href="a00004.html#a8e7f830189481b4101c6aa841f4d8a8b">setValue</a>(y);
<a name="l00883"></a>00883     }
<a name="l00884"></a>00884     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cal-&gt;<a class="code" href="a00013.html#a4ee612ef7997c99d1c1539cfd1137a19">getType</a>() == *<a class="code" href="a00024.html#af7865b7cf1b4a9314d150c9906219833">CalendarVoid::metadata</a>)
<a name="l00885"></a>00885       <span class="keywordflow">return</span> -1;
<a name="l00886"></a>00886     <span class="keywordflow">else</span>
<a name="l00887"></a>00887     {
<a name="l00888"></a>00888       PyErr_SetString(<a class="code" href="a00257.html#a5e53a387c0e6c65a18ee76396f03d1d0" title="Python exception class matching with frepple::LogicException.">PythonLogicException</a>, <span class="stringliteral">&quot;calendar type not recognized&quot;</span>);
<a name="l00889"></a>00889       <span class="keywordflow">return</span> -1;
<a name="l00890"></a>00890     }
<a name="l00891"></a>00891   }
<a name="l00892"></a>00892   <span class="keywordflow">else</span>
<a name="l00893"></a>00893     <span class="keywordflow">return</span> -1;
<a name="l00894"></a>00894   <span class="keywordflow">return</span> 0;
<a name="l00895"></a>00895 }
<a name="l00896"></a>00896 
<a name="l00897"></a>00897 
<a name="l00898"></a><a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">00898</a> <a class="code" href="a00252.html#a99b94ab8c2f2a32277559c7b2b0a054c">DECLARE_EXPORT</a> PyObject* <a class="code" href="a00013.html#a8bfd50c5c37eaaca7c7ca98e904fa4a7">Calendar::getEvents</a>(
<a name="l00899"></a>00899   PyObject* <span class="keyword">self</span>, PyObject* args, PyObject* kwdict
<a name="l00900"></a>00900   )
<a name="l00901"></a>00901 {
<a name="l00902"></a>00902   <span class="keywordflow">try</span>
<a name="l00903"></a>00903   {
<a name="l00904"></a>00904     <span class="comment">// Pick up the calendar</span>
<a name="l00905"></a>00905     <a class="code" href="a00013.html" title="This is the class used to represent variables that are varying over time.">Calendar</a> *cal = NULL;
<a name="l00906"></a>00906     <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> c(<span class="keyword">self</span>);
<a name="l00907"></a>00907     <span class="keywordflow">if</span> (c.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00014.html#a4e59f3a471d2e396aaf55dcc1ff4c277">CalendarBool::metadata</a>))
<a name="l00908"></a>00908       cal = static_cast&lt;CalendarBool*&gt;(<span class="keyword">self</span>);
<a name="l00909"></a>00909     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00016.html#a758e254f27a10333b8801eecf7874b15">CalendarDouble::metadata</a>))
<a name="l00910"></a>00910       cal = static_cast&lt;CalendarDouble*&gt;(<span class="keyword">self</span>);
<a name="l00911"></a>00911     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00018.html#ab15c85aa41b4c5dcaa9af899d9eb6f38">CalendarInt::metadata</a>))
<a name="l00912"></a>00912       cal = static_cast&lt;CalendarInt*&gt;(<span class="keyword">self</span>);
<a name="l00913"></a>00913     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00020.html#acb40eff94a33c81335e0707cc9f8df45">CalendarOperation::metadata</a>))
<a name="l00914"></a>00914       cal = static_cast&lt;CalendarOperation*&gt;(<span class="keyword">self</span>);
<a name="l00915"></a>00915     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00022.html#a46227f436586ec5c3fc77321a4ebf687">CalendarString::metadata</a>))
<a name="l00916"></a>00916       cal = static_cast&lt;CalendarString*&gt;(<span class="keyword">self</span>);
<a name="l00917"></a>00917     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c.<a class="code" href="a00154.html#aa5f7a25056671e8df629cd42b0061b28">check</a>(<a class="code" href="a00024.html#af7865b7cf1b4a9314d150c9906219833">CalendarVoid::metadata</a>))
<a name="l00918"></a>00918       cal = static_cast&lt;CalendarVoid*&gt;(<span class="keyword">self</span>);
<a name="l00919"></a>00919     <span class="keywordflow">else</span>
<a name="l00920"></a>00920       <span class="keywordflow">throw</span> <a class="code" href="a00111.html" title="An exception of this type is thrown when the library gets in an inconsistent state...">LogicException</a>(<span class="stringliteral">&quot;Invalid calendar type&quot;</span>);
<a name="l00921"></a>00921 
<a name="l00922"></a>00922     <span class="comment">// Parse the arguments</span>
<a name="l00923"></a>00923     PyObject* pystart = NULL;
<a name="l00924"></a>00924     PyObject* pydirection = NULL;
<a name="l00925"></a>00925     <span class="keywordflow">if</span> (!PyArg_ParseTuple(args, <span class="stringliteral">&quot;|OO:setvalue&quot;</span>, &amp;pystart, &amp;pydirection))
<a name="l00926"></a>00926       <span class="keywordflow">return</span> NULL;
<a name="l00927"></a>00927     <a class="code" href="a00049.html" title="This class represents a date and time with an accuracy of one second.">Date</a> startdate = pystart ? <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(pystart).getDate() : Date::infinitePast;
<a name="l00928"></a>00928     <span class="keywordtype">bool</span> forward = pydirection ? <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(pydirection).getBool() : <span class="keyword">true</span>;
<a name="l00929"></a>00929 
<a name="l00930"></a>00930     <span class="comment">// Return the iterator</span>
<a name="l00931"></a>00931     <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="a00017.html">CalendarEventIterator</a>(cal, startdate, forward);
<a name="l00932"></a>00932   }
<a name="l00933"></a>00933   <span class="keywordflow">catch</span>(...)
<a name="l00934"></a>00934   {
<a name="l00935"></a>00935     PythonType::evalException();
<a name="l00936"></a>00936     <span class="keywordflow">return</span> NULL;
<a name="l00937"></a>00937   }
<a name="l00938"></a>00938 }
<a name="l00939"></a>00939 
<a name="l00940"></a>00940 
<a name="l00941"></a><a class="code" href="a00017.html#a01e25c861d30bf2c678c1fa9768f112f">00941</a> <span class="keywordtype">int</span> <a class="code" href="a00017.html#a01e25c861d30bf2c678c1fa9768f112f">CalendarEventIterator::initialize</a>()
<a name="l00942"></a>00942 {
<a name="l00943"></a>00943   <span class="comment">// Initialize the type</span>
<a name="l00944"></a>00944   <a class="code" href="a00155.html" title="This class is a thin wrapper around the type information in Python.">PythonType</a>&amp; x = <a class="code" href="a00150.html#aec65c2cd811051918027ae6dc00fcfaf">PythonExtension&lt;CalendarEventIterator&gt;::getType</a>();
<a name="l00945"></a>00945   x.<a class="code" href="a00155.html#af9217b67c7c60e8e87c703066d6970d5">setName</a>(<span class="stringliteral">&quot;calendarEventIterator&quot;</span>);
<a name="l00946"></a>00946   x.<a class="code" href="a00155.html#aaafe003660694b2cf497a89815d7fe49">setDoc</a>(<span class="stringliteral">&quot;frePPLe iterator for calendar events&quot;</span>);
<a name="l00947"></a>00947   x.<a class="code" href="a00155.html#a5bacf8ad021ab55b1056440880cf8760">supportiter</a>();
<a name="l00948"></a>00948   <span class="keywordflow">return</span> x.<a class="code" href="a00155.html#a5b2be5d75982b077b2d694c269d43778">typeReady</a>();
<a name="l00949"></a>00949 }
<a name="l00950"></a>00950 
<a name="l00951"></a>00951 
<a name="l00952"></a>00952 PyObject* CalendarEventIterator::iternext()
<a name="l00953"></a>00953 {
<a name="l00954"></a>00954   <span class="keywordflow">if</span> ((forward &amp;&amp; eventiter.<a class="code" href="a00061.html#af62bd8787c04691a811c18d9958161f8">getDate</a>() == Date::infiniteFuture)
<a name="l00955"></a>00955    || (!forward &amp;&amp; eventiter.<a class="code" href="a00061.html#af62bd8787c04691a811c18d9958161f8">getDate</a>() == Date::infinitePast))
<a name="l00956"></a>00956    <span class="keywordflow">return</span> NULL;
<a name="l00957"></a>00957   <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a> x;
<a name="l00958"></a>00958   <span class="keywordflow">if</span> (dynamic_cast&lt;CalendarBool*&gt;(cal))
<a name="l00959"></a>00959   {
<a name="l00960"></a>00960     <span class="keywordflow">if</span> (eventiter.<a class="code" href="a00061.html#a32d10061d1e0447d6850cf073d6dccce">getBucket</a>())
<a name="l00961"></a>00961       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;const CalendarBool::BucketValue*&gt;(eventiter.<a class="code" href="a00061.html#a32d10061d1e0447d6850cf073d6dccce">getBucket</a>())-&gt;getValue());
<a name="l00962"></a>00962     <span class="keywordflow">else</span>
<a name="l00963"></a>00963       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;CalendarBool*&gt;(cal)-&gt;getDefault());
<a name="l00964"></a>00964   }
<a name="l00965"></a>00965   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;CalendarDouble*&gt;(cal))
<a name="l00966"></a>00966   {
<a name="l00967"></a>00967     <span class="keywordflow">if</span> (eventiter.getBucket())
<a name="l00968"></a>00968       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;const CalendarDouble::BucketValue*&gt;(eventiter.getBucket())-&gt;getValue());
<a name="l00969"></a>00969     <span class="keywordflow">else</span>
<a name="l00970"></a>00970       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;CalendarDouble*&gt;(cal)-&gt;getDefault());
<a name="l00971"></a>00971   }
<a name="l00972"></a>00972   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;CalendarInt*&gt;(cal))
<a name="l00973"></a>00973   {
<a name="l00974"></a>00974     <span class="keywordflow">if</span> (eventiter.getBucket())
<a name="l00975"></a>00975       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;const CalendarInt::BucketValue*&gt;(eventiter.getBucket())-&gt;getValue());
<a name="l00976"></a>00976     <span class="keywordflow">else</span>
<a name="l00977"></a>00977       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;CalendarInt*&gt;(cal)-&gt;getDefault());
<a name="l00978"></a>00978   }
<a name="l00979"></a>00979   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;CalendarOperation*&gt;(cal))
<a name="l00980"></a>00980   {
<a name="l00981"></a>00981     <span class="keywordflow">if</span> (eventiter.getBucket())
<a name="l00982"></a>00982       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;const CalendarOperation::BucketPointer*&gt;(eventiter.getBucket())-&gt;getValue());
<a name="l00983"></a>00983     <span class="keywordflow">else</span>
<a name="l00984"></a>00984       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;CalendarOperation*&gt;(cal)-&gt;getDefault());
<a name="l00985"></a>00985   }
<a name="l00986"></a>00986   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dynamic_cast&lt;CalendarString*&gt;(cal))
<a name="l00987"></a>00987   {
<a name="l00988"></a>00988     <span class="keywordflow">if</span> (eventiter.getBucket())
<a name="l00989"></a>00989       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;const CalendarString::BucketValue*&gt;(eventiter.getBucket())-&gt;getValue());
<a name="l00990"></a>00990     <span class="keywordflow">else</span>
<a name="l00991"></a>00991       x = <a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(dynamic_cast&lt;CalendarString*&gt;(cal)-&gt;getDefault());
<a name="l00992"></a>00992   }
<a name="l00993"></a>00993   PyObject* result = Py_BuildValue(<span class="stringliteral">&quot;(N,N)&quot;</span>,
<a name="l00994"></a>00994     static_cast&lt;PyObject*&gt;(<a class="code" href="a00154.html" title="This class handles two-way translation between the data types in C++ and Python.">PythonObject</a>(eventiter.getDate())),
<a name="l00995"></a>00995     <span class="keyword">static_cast&lt;</span>PyObject*<span class="keyword">&gt;</span>(x)
<a name="l00996"></a>00996     );
<a name="l00997"></a>00997   <span class="keywordflow">if</span> (forward)
<a name="l00998"></a>00998     ++eventiter;
<a name="l00999"></a>00999   <span class="keywordflow">else</span>
<a name="l01000"></a>01000     --eventiter;
<a name="l01001"></a>01001   <span class="keywordflow">return</span> result;
<a name="l01002"></a>01002 }
<a name="l01003"></a>01003 
<a name="l01004"></a>01004 } <span class="comment">// end namespace</span>
</pre></div></div>
<hr size="1"/><address style="align: right;"><small>Documentation generated for frePPLe by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"/></a></small></address>
</div>
</div>
</body>
</html>