<!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>AirRAC: Tutorials</title> <link rel="shortcut icon" href="favicon.ico"> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="airrac.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </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-24983440-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://airrac.sourceforge.net"><img height="45px" alt="AirRAC Logo" src="airrac_logo.png"></a>  <span id="projectnumber">0.2.1</span> </div> <div id="projectbrief">C++ Simulated Revenue Accounting (RAC) System Library</div> </td> <!-- begin SOURCEFORGE_CUSTOM--> <td> <div id="sflogo"><a href="http://airrac.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.7.4 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <script type="text/javascript"> function hasClass(ele,cls) { return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); } function addClass(ele,cls) { if (!this.hasClass(ele,cls)) ele.className += " "+cls; } function removeClass(ele,cls) { if (hasClass(ele,cls)) { var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)'); ele.className=ele.className.replace(reg,' '); } } function toggleVisibility(linkObj) { var base = linkObj.getAttribute('id'); var summary = document.getElementById(base + '-summary'); var content = document.getElementById(base + '-content'); var trigger = document.getElementById(base + '-trigger'); if ( hasClass(linkObj,'closed') ) { summary.style.display = 'none'; content.style.display = 'block'; trigger.src = 'open.png'; removeClass(linkObj,'closed'); addClass(linkObj,'opened'); } else if ( hasClass(linkObj,'opened') ) { summary.style.display = 'block'; content.style.display = 'none'; trigger.src = 'closed.png'; removeClass(linkObj,'opened'); addClass(linkObj,'closed'); } return false; } </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li id="searchli"> <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> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('tutorials.html',''); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <div class="title">Tutorials </div> </div> </div> <div class="contents"> <div class="textblock"><h2><a class="anchor" id="tut_toc"></a> Table of Contents</h2> <ul> <li><a class="el" href="tutorials.html#tut_introduction">Introduction</a><ul> <li><a class="el" href="tutorials.html#tut_intro_configuration">Preparing the AirRAC Project for Development</a></li> </ul> </li> <li><a class="el" href="tutorials.html#tut_build_bom_tree">Build a Predefined BOM Tree</a><ul> <li><a class="el" href="tutorials.html#tut_build_bom_root">Instanciate the BOM Root Object</a></li> <li><a class="el" href="tutorials.html#tut_build_inventory">Instanciate the (Airline) Inventory Object</a></li> <li><a class="el" href="tutorials.html#tut_build_link">Link the Inventory Object with the BOM Root</a></li> <li><a class="el" href="tutorials.html#tut_build_inventory_another">Build Another Airline Inventory</a></li> <li><a class="el" href="tutorials.html#tut_dump_bom_tree">Dump The BOM Tree Content</a></li> <li><a class="el" href="tutorials.html#tut_result_output">Result of the Tutorial Program</a></li> </ul> </li> </ul> <h2><a class="anchor" id="tut_introduction"></a> Introduction</h2> <p>This page contains some tutorial examples that will help you getting started using AirRAC. Most examples show how to construct some simple business objects, i.e., instances of the so-named Business Object Model (BOM).</p> <h3><a class="anchor" id="tut_intro_configuration"></a> Preparing the AirRAC Project for Development</h3> <p>The source code for these examples can be found in the <code>batches</code> and <code>test/airrac</code> directories. They are compiled along with the rest of the <code>AirRAC</code> project. See the User Guide (<a class="el" href="users_guide.html">Users Guide</a>) for more details on how to build the <code>AirRAC</code> project.</p> <h2><a class="anchor" id="tut_build_bom_tree"></a> Build a Predefined BOM Tree</h2> <p>A few steps:</p> <ul> <li><a class="el" href="tutorials.html#tut_build_bom_root">Instanciate the BOM Root Object</a></li> <li><a class="el" href="tutorials.html#tut_build_inventory">Instanciate the (Airline) Inventory Object</a></li> <li><a class="el" href="tutorials.html#tut_build_link">Link the Inventory Object with the BOM Root</a></li> </ul> <h3><a class="anchor" id="tut_build_bom_root"></a> Instanciate the BOM Root Object</h3> <p>First, a BOM root object (i.e., a root for all the classes in the project) is instantiated by the <code>airrac::AIRRAC_ServiceContext</code> context object, when the <code>airrac::AIRRAC_Service</code> is itself instantiated. The corresponding <code>AirRAC</code> type (class) is <code>airrac::BomRoot</code>.</p> <p>In the following sample, that object is named <code>ioBomRoot</code>, and is given as input/output parameter of the <code>airrac::CmdBomManager::buildSampleBom()</code> method:</p> <p><div class="fragment"><pre class="fragment"></pre></div></p> <h3><a class="anchor" id="tut_build_inventory"></a> Instanciate the (Airline) Inventory Object</h3> <p>An airline inventory object can then be instantiated. Let us give it the "BA" airline code (corresponding to <a href="http://www.ba.com">British Airways</a>) as the object key. That is, an object (let us name it <code>lBAKey</code>) of type (class) <code>airrac::InventoryKey</code> has first to be instantiated.</p> <p><div class="fragment"><pre class="fragment"></pre></div></p> <p>Thanks to that key, an airline inventory object, i.e. of type (class) <code>airrac::Inventory</code>, can be instantiated. Let us name that airline inventory object <code>lBAInv</code>.</p> <p><div class="fragment"><pre class="fragment"></pre></div></p> <h3><a class="anchor" id="tut_build_link"></a> Link the Inventory Object with the BOM Root</h3> <p>Then, both objects have to be linked: the airline inventory object (<code>airrac::Inventory</code>) has to be linked with the root of the BOM tree (<code>airrac::BomRoot</code>). That operation is as simple as using the <code>airrac::FacBomManager::addToListAndMap()</code> method:</p> <p><div class="fragment"><pre class="fragment"></pre></div></p> <h3><a class="anchor" id="tut_build_inventory_another"></a> Build Another Airline Inventory</h3> <p>Another airline inventory object, corresponding to the Air France (<a href="http://www.airfrance.com">Air France</a>) company, is instantiated the same way:</p> <p><div class="fragment"><pre class="fragment"></pre></div></p> <p>See the corresponding full program (cmd_bom_manager_cpp) for more details.</p> <h3><a class="anchor" id="tut_dump_bom_tree"></a> Dump The BOM Tree Content</h3> <p>From the <code>BomRoot</code> (of type <code>airrac::BomRoot</code>) object instance, the list of airline inventories (of type <code>airrac::Inventory</code>) can then be retrieved...</p> <p><div class="fragment"><pre class="fragment"></pre></div></p> <p>... and browsed: <div class="fragment"><pre class="fragment"></pre></div></p> <p>See the corresponding full program (bom_display_cpp) for more details.</p> <h3><a class="anchor" id="tut_result_output"></a> Result of the Tutorial Program</h3> <p>When the <code><a class="el" href="airrac_8cpp.html">airrac.cpp</a></code> program is run (with the <code>-b</code> option), the output should look like:</p> <div class="fragment"><pre class="fragment">[D]/home/user/dev/sim/airrac/airracgithub/airrac/batches/airrac.cpp:184: Welcome to AirRAC [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:493: Parsing yield input file: /home/user/dev/deliveries/stdair-0.36.2/share/stdair/samples/yieldstore01.csv [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:326: YieldRule: 1, SIN-BKK (ALL), DC, [2010-Jan-15/2011-Jan-01] - [00:00:00/23:59:00], Y, 200 EUR, SQ / Y [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:326: YieldRule: 2, SIN-HND (ALL), DC, [2010-Jan-15/2011-Jan-01] - [00:00:00/23:59:00], Y, 200 EUR, SQ / Y [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:326: YieldRule: 3, SIN-NCE (ALL), DC, [2010-Jan-15/2011-Jan-01] - [00:00:00/23:59:00], Y, 1200 EUR, SQ / Y - AF / YLMN [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:326: YieldRule: 4, SIN-BKK (ALL), DC, [2010-Jan-15/2011-Jan-01] - [00:00:00/23:59:00], Y, 300 EUR, SQ / Y [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:326: YieldRule: 5, SIN-HND (ALL), DC, [2010-Jan-15/2011-Jan-01] - [00:00:00/23:59:00], Y, 300 EUR, SQ / Y [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:326: YieldRule: 6, SIN-NCE (ALL), DC, [2010-Jan-15/2011-Jan-01] - [00:00:00/23:59:00], Y, 1500 EUR, SQ / Y - AF / YLMN [D]/home/user/dev/sim/airrac/airracgithub/airrac/command/YieldParserHelper.cpp:541: Parsing of yield input file: /home/user/dev/deliveries/stdair-0.36.2/share/stdair/samples/yieldstore01.csv succeeded [D]/home/user/dev/sim/airrac/airracgithub/airrac/batches/airrac.cpp:205: BOM tree: =============================================================== BomRoot: -- ROOT -- =============================================================== +++++++++++++++++++++++++++++++++++++++++++++++++ AirportPair: SIN, BKK +++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------------ DatePeriod: [2010-Jan-15/2011-Jan-01] ------------------------------------------ ****************************************** PosChannel: ALL, DC ****************************************** ---------------------------------------- TimePeriod: 00:00:00-23:59:00 ---------------------------------------- -------------------------------------- Fare/yield-Features: OW -- Y -------------------------------------- ------------------------------------ AirlineClassList: SQ Y ------------------------------------ -------------------------------------- Fare/yield-Features: RT -- Y -------------------------------------- ------------------------------------ AirlineClassList: SQ Y ------------------------------------ +++++++++++++++++++++++++++++++++++++++++++++++++ AirportPair: SIN, HND +++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------------ DatePeriod: [2010-Jan-15/2011-Jan-01] ------------------------------------------ ****************************************** PosChannel: ALL, DC ****************************************** ---------------------------------------- TimePeriod: 00:00:00-23:59:00 ---------------------------------------- -------------------------------------- Fare/yield-Features: OW -- Y -------------------------------------- ------------------------------------ AirlineClassList: SQ Y ------------------------------------ -------------------------------------- Fare/yield-Features: RT -- Y -------------------------------------- ------------------------------------ AirlineClassList: SQ Y ------------------------------------ +++++++++++++++++++++++++++++++++++++++++++++++++ AirportPair: SIN, NCE +++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------------ DatePeriod: [2010-Jan-15/2011-Jan-01] ------------------------------------------ ****************************************** PosChannel: ALL, DC ****************************************** ---------------------------------------- TimePeriod: 00:00:00-23:59:00 ---------------------------------------- -------------------------------------- Fare/yield-Features: OW -- Y -------------------------------------- ------------------------------------ AirlineClassList: SQ Y, AF YLMN ------------------------------------ -------------------------------------- Fare/yield-Features: RT -- Y -------------------------------------- ------------------------------------ AirlineClassList: SQ Y, AF YLMN ------------------------------------ [D]/home/user/dev/sim/airrac/airracgithub/airrac/batches/airrac.cpp:210: Travel solutions: [0] [0] BA, 9, 2011-06-10, LHR, SYD, 21:45 --- Q, 900, 1 1 1 --- [0] Q:8 </pre></div><p>See the corresponding full program (batch_airrac_cpp) for more details. </p> </div></div> </div> <div id="nav-path" class="navpath"> <ul> <!-- 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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Defines</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> <li class="footer">Generated on Wed Nov 2 2011 23:02:19 for AirRAC by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li> <li class="footer"> <a href="http://sourceforge.net/projects/airrac"><img class="footer" src="http://sflogo.sourceforge.net/sflogo.php?group_id=317250&type=12&format=.png" alt="SourceForge Logo"></a> </li> </ul> </div> </body> </html>