Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 0551a44115f6e0f4237e274e52a253d8 > files > 23

stdair-doc-1.00.1-4.fc18.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"/>
	<meta name="robots" content="index,follow"/>
	<title>Command-Line Utility to Demonstrate Typical StdAir Usage</title>
	<link rel="shortcut icon" href="favicon.ico">
	<link href="tabs.css" rel="stylesheet" type="text/css"/>
	<link href="stdair.css" rel="stylesheet" type="text/css"/>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
	<script type="text/javascript">
	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-24867310-1']);
	  _gaq.push(['_setDomainName', 'none']);
	  _gaq.push(['_setAllowLinker', true]);
	  _gaq.push(['_trackPageview']);
	  (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	</script>
	<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
  </head>
  <body>
	<div id="top"><!-- do not remove this div! -->
	  <div id="titlearea">
		<table width="100%">
		  <tbody>
			<tr style="height: 56px;">
			  <td style="padding-left: 0.5em;">
				<div id="projectname"><a href="http://stdair.sourceforge.net"><img height="45px" alt="StdAir Logo" src="stdair_logo.png"></a>
				  &#160;<span id="projectnumber">1.00.1</span>
				</div>
				<div id="projectbrief">C++ Standard Airline IT Object Library</div>
			  </td>
			  <!-- begin SOURCEFORGE_CUSTOM-->
			  <td>
				<div id="sflogo"><a href="http://stdair.sourceforge.net"><img height="45px" alt="SourceForge Logo" src="sfx_logo.png"></a></div>
			  </td>
			  <!-- end SOURCEFORGE_CUSTOM-->
			</tr>
		  </tbody>
		</table>
	  </div>
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;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><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('a00020.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(11)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Command-Line Utility to Demonstrate Typical StdAir Usage </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><div class="fragment"><div class="line"> */</div>
<div class="line"><span class="comment">// STL</span></div>
<div class="line"><span class="preprocessor">#include &lt;cassert&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="comment">// Boost (Extended STL)</span></div>
<div class="line"><span class="preprocessor">#include &lt;boost/date_time/posix_time/posix_time.hpp&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;boost/date_time/gregorian/gregorian.hpp&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;boost/program_options.hpp&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;boost/tokenizer.hpp&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;boost/lexical_cast.hpp&gt;</span></div>
<div class="line"><span class="comment">// StdAir</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00520.html">stdair/stdair_types.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00291.html">stdair/bom/BomArchive.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00320.html">stdair/bom/BookingRequestStruct.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00454.html">stdair/bom/TravelSolutionStruct.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00499.html">stdair/service/Logger.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00518.html">stdair/STDAIR_Service.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="a00479.html">stdair/config/stdair-paths.hpp</a>&gt;</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// //////// Constants //////</span></div>
<div class="line"><span class="comment"></span><span class="keyword">const</span> std::string K_STDAIR_DEFAULT_LOG_FILENAME (<span class="stringliteral">&quot;stdair.log&quot;</span>);</div>
<div class="line"></div>
<div class="line"><span class="keyword">const</span> std::string K_STDAIR_DEFAULT_INPUT_FILENAME (<a class="code" href="a00479.html#af06cd429ada6c5a061032f4278de45d1">STDAIR_SAMPLE_DIR</a></div>
<div class="line">                                                   <span class="stringliteral">&quot;/schedule01.csv&quot;</span>);</div>
<div class="line"></div>
<div class="line"><span class="keyword">const</span> <span class="keywordtype">bool</span> K_STDAIR_DEFAULT_BUILT_IN_INPUT = <span class="keyword">false</span>;</div>
<div class="line"></div>
<div class="line"><span class="keyword">const</span> <span class="keywordtype">bool</span> K_STDAIR_DEFAULT_BUILT_FOR_RMOL = <span class="keyword">false</span>;</div>
<div class="line"></div>
<div class="line"><span class="keyword">const</span> <span class="keywordtype">bool</span> K_STDAIR_DEFAULT_BUILT_FOR_CRS = <span class="keyword">false</span>;</div>
<div class="line"></div>
<div class="line"><span class="keyword">const</span> <span class="keywordtype">int</span> K_STDAIR_EARLY_RETURN_STATUS = 99;</div>
<div class="line"></div>
<div class="line"><span class="comment">// ///////// Parsing of Options &amp; Configuration /////////</span></div>
<div class="line"><span class="comment">// A helper function to simplify the main part.</span></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">class</span> T&gt; std::ostream&amp; <a class="code" href="a00267.html#a22cf274233e8d7e58c887daeb9103ef6">operator&lt;&lt; </a>(std::ostream&amp; os,</div>
<div class="line">                                            <span class="keyword">const</span> std::vector&lt;T&gt;&amp; v) {</div>
<div class="line">  std::copy (v.begin(), v.end(), std::ostream_iterator&lt;T&gt; (std::cout, <span class="stringliteral">&quot; &quot;</span>)); </div>
<div class="line">  <span class="keywordflow">return</span> os;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> readConfiguration (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[], <span class="keywordtype">bool</span>&amp; ioIsBuiltin,</div>
<div class="line">                       <span class="keywordtype">bool</span>&amp; ioIsForRMOL, <span class="keywordtype">bool</span>&amp; ioIsForCRS,</div>
<div class="line">                       <a class="code" href="a00535.html#a79a6f56285b817edc02d72eb1f437dfb">stdair::Filename_T</a>&amp; ioInputFilename,</div>
<div class="line">                       std::string&amp; ioLogFilename) {</div>
<div class="line">  <span class="comment">// Default for the built-in input</span></div>
<div class="line">  ioIsBuiltin = K_STDAIR_DEFAULT_BUILT_IN_INPUT;</div>
<div class="line"></div>
<div class="line">  <span class="comment">// Default for the RMOL input</span></div>
<div class="line">  ioIsForRMOL = K_STDAIR_DEFAULT_BUILT_FOR_RMOL;</div>
<div class="line">  </div>
<div class="line">  <span class="comment">// Default for the CRS input</span></div>
<div class="line">  ioIsForCRS = K_STDAIR_DEFAULT_BUILT_FOR_CRS;</div>
<div class="line">  </div>
<div class="line">  <span class="comment">// Declare a group of options that will be allowed only on command line</span></div>
<div class="line">  boost::program_options::options_description <span class="keyword">generic</span> (<span class="stringliteral">&quot;Generic options&quot;</span>);</div>
<div class="line">  <span class="keyword">generic</span>.add_options()</div>
<div class="line">    (<span class="stringliteral">&quot;prefix&quot;</span>, <span class="stringliteral">&quot;print installation prefix&quot;</span>)</div>
<div class="line">    (<span class="stringliteral">&quot;version,v&quot;</span>, <span class="stringliteral">&quot;print version string&quot;</span>)</div>
<div class="line">    (<span class="stringliteral">&quot;help,h&quot;</span>, <span class="stringliteral">&quot;produce help message&quot;</span>);</div>
<div class="line">    </div>
<div class="line">  <span class="comment">// Declare a group of options that will be allowed both on command</span></div>
<div class="line">  <span class="comment">// line and in config file</span></div>
<div class="line"></div>
<div class="line">  boost::program_options::options_description config (<span class="stringliteral">&quot;Configuration&quot;</span>);</div>
<div class="line">  config.add_options()</div>
<div class="line">    (<span class="stringliteral">&quot;builtin,b&quot;</span>,</div>
<div class="line">     <span class="stringliteral">&quot;The sample BOM tree can be either built-in or parsed from an input file. That latter must then be given with the -i/--input option&quot;</span>)</div>
<div class="line">    (<span class="stringliteral">&quot;rmol,r&quot;</span>,</div>
<div class="line">     <span class="stringliteral">&quot;Build a sample BOM tree for RMOL (i.e., a dummy flight-date with a single leg-cabin)&quot;</span>)</div>
<div class="line">    (<span class="stringliteral">&quot;crs,c&quot;</span>,</div>
<div class="line">     <span class="stringliteral">&quot;Build a sample BOM tree for CRS&quot;</span>)</div>
<div class="line">    (<span class="stringliteral">&quot;input,i&quot;</span>,</div>
<div class="line">     boost::program_options::value&lt; std::string &gt;(&amp;ioInputFilename)-&gt;default_value(K_STDAIR_DEFAULT_INPUT_FILENAME),</div>
<div class="line">     <span class="stringliteral">&quot;(CVS) input file for the demand distributions&quot;</span>)</div>
<div class="line">    (<span class="stringliteral">&quot;log,l&quot;</span>,</div>
<div class="line">     boost::program_options::value&lt; std::string &gt;(&amp;ioLogFilename)-&gt;default_value(K_STDAIR_DEFAULT_LOG_FILENAME),</div>
<div class="line">     <span class="stringliteral">&quot;Filename for the logs&quot;</span>)</div>
<div class="line">    ;</div>
<div class="line"></div>
<div class="line">  <span class="comment">// Hidden options, will be allowed both on command line and</span></div>
<div class="line">  <span class="comment">// in config file, but will not be shown to the user.</span></div>
<div class="line">  boost::program_options::options_description hidden (<span class="stringliteral">&quot;Hidden options&quot;</span>);</div>
<div class="line">  hidden.add_options()</div>
<div class="line">    (<span class="stringliteral">&quot;copyright&quot;</span>,</div>
<div class="line">     boost::program_options::value&lt; std::vector&lt;std::string&gt; &gt;(),</div>
<div class="line">     <span class="stringliteral">&quot;Show the copyright (license)&quot;</span>);</div>
<div class="line">        </div>
<div class="line">  boost::program_options::options_description cmdline_options;</div>
<div class="line">  cmdline_options.add(<span class="keyword">generic</span>).add(config).add(hidden);</div>
<div class="line"></div>
<div class="line">  boost::program_options::options_description config_file_options;</div>
<div class="line">  config_file_options.add(config).add(hidden);</div>
<div class="line">  boost::program_options::options_description visible (<span class="stringliteral">&quot;Allowed options&quot;</span>);</div>
<div class="line">  visible.add(<span class="keyword">generic</span>).add(config);</div>
<div class="line">        </div>
<div class="line">  boost::program_options::positional_options_description p;</div>
<div class="line">  p.add (<span class="stringliteral">&quot;copyright&quot;</span>, -1);</div>
<div class="line">        </div>
<div class="line">  boost::program_options::variables_map vm;</div>
<div class="line">  boost::program_options::</div>
<div class="line">    store (boost::program_options::command_line_parser (argc, argv).</div>
<div class="line">           options (cmdline_options).positional(p).run(), vm);</div>
<div class="line"></div>
<div class="line">  std::ifstream ifs (<span class="stringliteral">&quot;stdair.cfg&quot;</span>);</div>
<div class="line">  boost::program_options::store (parse_config_file (ifs, config_file_options),</div>
<div class="line">                                 vm);</div>
<div class="line">  boost::program_options::notify (vm);</div>
<div class="line">    </div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;help&quot;</span>)) {</div>
<div class="line">    std::cout &lt;&lt; visible &lt;&lt; std::endl;</div>
<div class="line">    <span class="keywordflow">return</span> K_STDAIR_EARLY_RETURN_STATUS;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;version&quot;</span>)) {</div>
<div class="line">    std::cout &lt;&lt; <a class="code" href="a00479.html#a1c0439e4355794c09b64274849eb0279">PACKAGE_NAME</a> &lt;&lt; <span class="stringliteral">&quot;, version &quot;</span> &lt;&lt; <a class="code" href="a00479.html#aa326a05d5e30f9e9a4bb0b4469d5d0c0">PACKAGE_VERSION</a> &lt;&lt; std::endl;</div>
<div class="line">    <span class="keywordflow">return</span> K_STDAIR_EARLY_RETURN_STATUS;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;prefix&quot;</span>)) {</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Installation prefix: &quot;</span> &lt;&lt; <a class="code" href="a00479.html#a975e6c1856ccc7ae7d04f02d6ee5616a">PREFIXDIR</a> &lt;&lt; std::endl;</div>
<div class="line">    <span class="keywordflow">return</span> K_STDAIR_EARLY_RETURN_STATUS;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;builtin&quot;</span>)) {</div>
<div class="line">    ioIsBuiltin = <span class="keyword">true</span>;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;rmol&quot;</span>)) {</div>
<div class="line">    ioIsForRMOL = <span class="keyword">true</span>;</div>
<div class="line"></div>
<div class="line">    <span class="comment">// The RMOL sample tree takes precedence over the default built-in BOM tree</span></div>
<div class="line">    ioIsBuiltin = <span class="keyword">false</span>;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;crs&quot;</span>)) {</div>
<div class="line">    ioIsForCRS = <span class="keyword">true</span>;</div>
<div class="line"></div>
<div class="line">    <span class="comment">// The RMOL sample tree takes precedence over the default built-in BOM tree</span></div>
<div class="line">    ioIsBuiltin = <span class="keyword">false</span>;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keyword">const</span> std::string isBuiltinStr = (ioIsBuiltin == <span class="keyword">true</span>)?<span class="stringliteral">&quot;yes&quot;</span>:<span class="stringliteral">&quot;no&quot;</span>;</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;The BOM should be built-in? &quot;</span> &lt;&lt; isBuiltinStr &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line">  <span class="keyword">const</span> std::string isForRMOLStr = (ioIsForRMOL == <span class="keyword">true</span>)?<span class="stringliteral">&quot;yes&quot;</span>:<span class="stringliteral">&quot;no&quot;</span>;</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;The BOM should be built-in for RMOL? &quot;</span> &lt;&lt; isForRMOLStr</div>
<div class="line">            &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line">  <span class="keyword">const</span> std::string isForCRSStr = (ioIsForCRS == <span class="keyword">true</span>)?<span class="stringliteral">&quot;yes&quot;</span>:<span class="stringliteral">&quot;no&quot;</span>;</div>
<div class="line">  std::cout &lt;&lt; <span class="stringliteral">&quot;The BOM should be built-in for CRS? &quot;</span> &lt;&lt; isForCRSStr</div>
<div class="line">            &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (ioIsBuiltin == <span class="keyword">false</span> &amp;&amp; ioIsForRMOL == <span class="keyword">false</span> &amp;&amp; ioIsForCRS == <span class="keyword">false</span>) {</div>
<div class="line">    <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;input&quot;</span>)) {</div>
<div class="line">      ioInputFilename = vm[<span class="stringliteral">&quot;input&quot;</span>].as&lt; std::string &gt;();</div>
<div class="line">      std::cout &lt;&lt; <span class="stringliteral">&quot;Input filename is: &quot;</span> &lt;&lt; ioInputFilename &lt;&lt; std::endl;</div>
<div class="line"></div>
<div class="line">    } <span class="keywordflow">else</span> {</div>
<div class="line">      std::cerr &lt;&lt; <span class="stringliteral">&quot;Either one among the -b/--builtin, -r/--rmol, -c/--crs &quot;</span></div>
<div class="line">                &lt;&lt; <span class="stringliteral">&quot;or -i/--input options must be specified&quot;</span> &lt;&lt; std::endl;</div>
<div class="line">    }</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (vm.count (<span class="stringliteral">&quot;log&quot;</span>)) {</div>
<div class="line">    ioLogFilename = vm[<span class="stringliteral">&quot;log&quot;</span>].as&lt; std::string &gt;();</div>
<div class="line">    std::cout &lt;&lt; <span class="stringliteral">&quot;Log filename is: &quot;</span> &lt;&lt; ioLogFilename &lt;&lt; std::endl;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="comment">// ///////////////// M A I N ////////////////////</span></div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[]) {</div>
<div class="line"></div>
<div class="line">  <span class="comment">// State whether the BOM tree should be built-in or parsed from an</span></div>
<div class="line">  <span class="comment">// input file</span></div>
<div class="line">  <span class="keywordtype">bool</span> isBuiltin;</div>
<div class="line"></div>
<div class="line">  <span class="comment">// State whether a sample BOM tree should be built for RMOL.</span></div>
<div class="line">  <span class="keywordtype">bool</span> isForRMOL;</div>
<div class="line">    </div>
<div class="line">  <span class="comment">// State whether a sample BOM tree should be built for the CRS.</span></div>
<div class="line">  <span class="keywordtype">bool</span> isForCRS;</div>
<div class="line">    </div>
<div class="line">  <span class="comment">// Input file name</span></div>
<div class="line">  <a class="code" href="a00535.html#a79a6f56285b817edc02d72eb1f437dfb">stdair::Filename_T</a> lInputFilename;</div>
<div class="line"></div>
<div class="line">  <span class="comment">// Output log File</span></div>
<div class="line">  std::string lLogFilename;</div>
<div class="line">    </div>
<div class="line">  <span class="comment">// Call the command-line option parser</span></div>
<div class="line">  <span class="keyword">const</span> <span class="keywordtype">int</span> lOptionParserStatus =</div>
<div class="line">    readConfiguration (argc, argv, isBuiltin, isForRMOL, isForCRS,</div>
<div class="line">                       lInputFilename, lLogFilename);</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> (lOptionParserStatus == K_STDAIR_EARLY_RETURN_STATUS) {</div>
<div class="line">    <span class="keywordflow">return</span> 0;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="comment">// Set the log parameters</span></div>
<div class="line">  std::ofstream logOutputFile;</div>
<div class="line">  <span class="comment">// Open and clean the log outputfile</span></div>
<div class="line">  logOutputFile.open (lLogFilename.c_str());</div>
<div class="line">  logOutputFile.clear();</div>
<div class="line"></div>
<div class="line">  <span class="keyword">const</span> <a class="code" href="a00036.html" title="Structure holding parameters for logging.">stdair::BasLogParams</a> lLogParams (<a class="code" href="a00536.html#a0e942800c20ab8c1dc913408f555112daf8480a95ba3662dd03cd956546bf951b">stdair::LOG::DEBUG</a>, logOutputFile);</div>
<div class="line">  <a class="code" href="a00179.html" title="Interface for the STDAIR Services.">stdair::STDAIR_Service</a> stdairService (lLogParams);</div>
<div class="line"></div>
<div class="line">  <span class="comment">// DEBUG</span></div>
<div class="line">  <a class="code" href="a00499.html#a24f87ac1961418818b267ed4d02ff487">STDAIR_LOG_DEBUG</a> (<span class="stringliteral">&quot;Welcome to stdair&quot;</span>);</div>
<div class="line"></div>
<div class="line">  <span class="comment">// Check wether or not a (CSV) input file should be read</span></div>
<div class="line">  <span class="keywordflow">if</span> (isBuiltin == <span class="keyword">true</span> || isForRMOL == <span class="keyword">true</span> || isForCRS == <span class="keyword">true</span>) {</div>
<div class="line"></div>
<div class="line">    <span class="keywordflow">if</span> (isForRMOL == <span class="keyword">true</span>) {</div>
<div class="line">      <span class="comment">// Build the sample BOM tree for RMOL</span></div>
<div class="line">      stdairService.buildDummyInventory (300);</div>
<div class="line"></div>
<div class="line">    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (isForCRS == <span class="keyword">true</span>) {</div>
<div class="line">      <span class="comment">//</span></div>
<div class="line">      <a class="code" href="a00535.html#a7044bfd349753c09860d25bdba03144a">stdair::TravelSolutionList_T</a> lTravelSolutionList;</div>
<div class="line">      stdairService.buildSampleTravelSolutions (lTravelSolutionList);</div>
<div class="line"></div>
<div class="line">      <span class="comment">// Build the sample BOM tree for CRS</span></div>
<div class="line">      <span class="keyword">const</span> <a class="code" href="a00055.html" title="Structure holding the elements of a booking request.">stdair::BookingRequestStruct</a>&amp; lBookingRequest =</div>
<div class="line">        stdairService.buildSampleBookingRequest();</div>
<div class="line"></div>
<div class="line">      <span class="comment">// DEBUG: Display the travel solution and booking request</span></div>
<div class="line">      <a class="code" href="a00499.html#a24f87ac1961418818b267ed4d02ff487">STDAIR_LOG_DEBUG</a> (<span class="stringliteral">&quot;Booking request: &quot;</span> &lt;&lt; lBookingRequest.<a class="code" href="a00055.html#a25b9474dbf992a0ed617f3edf50caf2b">display</a>());</div>
<div class="line"></div>
<div class="line">      <span class="keyword">const</span> std::string&amp; lCSVDump =</div>
<div class="line">        stdairService.csvDisplay (lTravelSolutionList);</div>
<div class="line">      <a class="code" href="a00499.html#a24f87ac1961418818b267ed4d02ff487">STDAIR_LOG_DEBUG</a> (lCSVDump);</div>
<div class="line"></div>
<div class="line">    } <span class="keywordflow">else</span> {</div>
<div class="line">      assert (isBuiltin == <span class="keyword">true</span>);</div>
<div class="line"></div>
<div class="line">      <span class="comment">// Build a sample BOM tree</span></div>
<div class="line">      stdairService.buildSampleBom();</div>
<div class="line">    }</div>
<div class="line">      </div>
<div class="line">  } <span class="keywordflow">else</span> {</div>
<div class="line">    <span class="comment">// Read the input file</span></div>
<div class="line">    <span class="comment">//stdairService.readFromInputFile (lInputFilename);</span></div>
<div class="line"></div>
<div class="line">    <span class="comment">// DEBUG</span></div>
<div class="line">    <a class="code" href="a00499.html#a24f87ac1961418818b267ed4d02ff487">STDAIR_LOG_DEBUG</a> (<span class="stringliteral">&quot;StdAir will parse &quot;</span> &lt;&lt; lInputFilename</div>
<div class="line">                      &lt;&lt; <span class="stringliteral">&quot; and build the corresponding BOM tree.&quot;</span>);</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="comment">// DEBUG: Display the whole persistent BOM tree</span></div>
<div class="line">  <span class="keyword">const</span> std::string&amp; lCSVDump = stdairService.csvDisplay ();</div>
<div class="line">  <a class="code" href="a00499.html#a24f87ac1961418818b267ed4d02ff487">STDAIR_LOG_DEBUG</a> (lCSVDump);</div>
<div class="line"></div>
<div class="line">  <span class="comment">// Close the Log outputFile</span></div>
<div class="line">  logOutputFile.close();</div>
<div class="line"></div>
<div class="line">  <span class="comment">/*</span></div>
<div class="line"><span class="comment">    Note: as that program is not intended to be run on a server in</span></div>
<div class="line"><span class="comment">    production, it is better not to catch the exceptions. When it</span></div>
<div class="line"><span class="comment">    happens (that an exception is throwned), that way we get the</span></div>
<div class="line"><span class="comment">    call stack.</span></div>
<div class="line"><span class="comment">  */</span></div>
<div class="line">    </div>
<div class="line">  <span class="keywordflow">return</span> 0;     </div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">/*!</span></div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
		
		<li class="footer">Generated on Wed May 22 2013 10:52:00 for StdAir by
		  <a href="http://www.doxygen.org/index.html">
			<img class="footer" src="doxygen.png" alt="doxygen"/></a> 
		  1.8.3.1
		</li>
		<li class="footer">
		  <a href="http://sourceforge.net/projects/stdair"><img class="footer" src="http://sflogo.sourceforge.net/sflogo.php?group_id=267760&type=12&format=.png" alt="SourceForge Logo"></a>
		</li>
	  </ul>
	</div>
  </body>
</html>