AirRAC Logo  1.00.0
C++ Simulated Revenue Accounting (RAC) System Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
Tutorials

Table of Contents

Introduction

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).

Preparing the AirRAC Project for Development

The source code for these examples can be found in the batches and test/airrac directories. They are compiled along with the rest of the AirRAC project. See the User Guide (Users Guide) for more details on how to build the AirRAC project.

Build a Predefined BOM Tree

A few steps:

Instanciate the BOM Root Object

First, a BOM root object (i.e., a root for all the classes in the project) is instantiated by the airrac::AIRRAC_ServiceContext context object, when the airrac::AIRRAC_Service is itself instantiated. The corresponding AirRAC type (class) is airrac::BomRoot.

In the following sample, that object is named ioBomRoot, and is given as input/output parameter of the airrac::CmdBomManager::buildSampleBom() method:

Instanciate the (Airline) Inventory Object

An airline inventory object can then be instantiated. Let us give it the "BA" airline code (corresponding to British Airways) as the object key. That is, an object (let us name it lBAKey) of type (class) airrac::InventoryKey has first to be instantiated.

Thanks to that key, an airline inventory object, i.e. of type (class) airrac::Inventory, can be instantiated. Let us name that airline inventory object lBAInv.

Link the Inventory Object with the BOM Root

Then, both objects have to be linked: the airline inventory object (airrac::Inventory) has to be linked with the root of the BOM tree (airrac::BomRoot). That operation is as simple as using the airrac::FacBomManager::addToListAndMap() method:

Build Another Airline Inventory

Another airline inventory object, corresponding to the Air France (Air France) company, is instantiated the same way:

See the corresponding full program (cmd_bom_manager_cpp) for more details.

Dump The BOM Tree Content

From the BomRoot (of type airrac::BomRoot) object instance, the list of airline inventories (of type airrac::Inventory) can then be retrieved...

... and browsed:

See the corresponding full program (bom_display_cpp) for more details.

Result of the Tutorial Program

When the airrac.cpp program is run (with the -b option), the output should look like:

[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

See the corresponding full program (batch_airrac_cpp) for more details.