8 #include <boost/multi_array.hpp>
10 #include <boost/archive/text_iarchive.hpp>
11 #include <boost/archive/text_oarchive.hpp>
12 #include <boost/serialization/access.hpp>
21 SegmentSnapshotTable::SegmentSnapshotTable()
27 SegmentSnapshotTable::SegmentSnapshotTable (
const SegmentSnapshotTable&)
33 SegmentSnapshotTable::
34 SegmentSnapshotTable (
const Key_T& iKey) : _key (iKey), _parent (NULL) {
43 std::ostringstream oStr;
63 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
66 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
69 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
72 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
75 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
78 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
81 resize (boost::extents[lNumberOfSegmentCabins*lNumberOfClasses]
89 ClassIndexMap_T::const_iterator itVTIdx =
92 return itVTIdx->second;
98 SegmentCabinIndexMap_T::const_iterator itSCIdx =
101 return itSCIdx->second;
108 const DTD_T iDTD)
const {
110 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
111 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
120 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
121 const unsigned int lNbOfClasses = _classIndexMap.size();
122 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
123 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
134 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
135 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
144 const DTD_T iDTDBegin,
145 const DTD_T iDTDEnd) {
147 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
148 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
157 const DTD_T iDTD)
const {
159 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
160 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
169 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
170 const unsigned int lNbOfClasses = _classIndexMap.size();
171 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
172 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
183 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
184 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
193 const DTD_T iDTDBegin,
194 const DTD_T iDTDEnd) {
196 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
197 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
206 const DTD_T iDTD)
const {
208 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
209 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
218 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
219 const unsigned int lNbOfClasses = _classIndexMap.size();
220 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
221 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
232 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
233 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
242 const DTD_T iDTDBegin,
243 const DTD_T iDTDEnd) {
245 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
246 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
256 const DTD_T iDTD)
const {
258 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
259 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
268 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
269 const unsigned int lNbOfClasses = _classIndexMap.size();
270 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
271 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
282 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
283 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
292 const DTD_T iDTDBegin,
293 const DTD_T iDTDEnd) {
295 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
296 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
305 const DTD_T iDTD)
const {
307 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
308 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
317 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
318 const unsigned int lNbOfClasses = _classIndexMap.size();
319 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
320 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
331 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
332 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
341 const DTD_T iDTDBegin,
342 const DTD_T iDTDEnd) {
344 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
345 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
355 const DTD_T iDTD)
const {
357 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
358 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
367 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
368 const unsigned int lNbOfClasses = _classIndexMap.size();
369 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
370 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
380 const unsigned int lNbOfClasses = _classIndexMap.size();
381 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
382 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
384 return _priceOrientedGrossBookingSnapshotBlock [ boost::indices[
SnapshotBlockRange_T(lClassIdxBegin, lClassIdxEnd)][iDTD] ];
392 const unsigned int lNbOfClasses = _classIndexMap.size();
393 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
394 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
403 const DTD_T iDTD)
const {
404 const unsigned int lNbOfClasses = _classIndexMap.size();
405 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
406 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
408 return _availabilitySnapshotBlock [ boost::indices[
SnapshotBlockRange_T(lClassIdxBegin, lClassIdxEnd)][iDTD] ];
415 const DTD_T iDTDBegin,
const DTD_T iDTDEnd)
const {
416 const unsigned int lNbOfClasses = _classIndexMap.size();
417 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
418 const unsigned int lClassIdxEnd = (iSCIdxEnd +1) * lNbOfClasses;
429 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
430 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
439 const DTD_T iDTDBegin,
440 const DTD_T iDTDEnd) {
442 const unsigned int lClassIdxBegin = iSCIdxBegin * lNbOfClasses;
443 const unsigned int lClassIdxEnd = (iSCIdxEnd + 1) * lNbOfClasses;
449 void SegmentSnapshotTable::serialisationImplementationExport()
const {
450 std::ostringstream oStr;
451 boost::archive::text_oarchive oa (oStr);
456 void SegmentSnapshotTable::serialisationImplementationImport() {
457 std::istringstream iStr;
458 boost::archive::text_iarchive ia (iStr);
463 template<
class Archive>
465 const unsigned int iFileVersion) {
SnapshotBlock_T::index_range SnapshotBlockRange_T
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDCancellationSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
SnapshotBlock_T::const_array_view< 1 >::type ConstSegmentCabinDTDSnapshotView_T
Key of a given guillotine block, made of a guillotine number.
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDProductOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
const std::string describeKey() const
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangeProductOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
void initSnapshotBlocks(const SegmentCabinIndexMap_T &, const ClassIndexMap_T &)
SnapshotBlock_T _priceOrientedGrossBookingSnapshotBlock
ClassIndexMap_T _classIndexMap
SnapshotBlock_T::array_view< 2 >::type SegmentCabinDTDRangeSnapshotView_T
SnapshotBlock_T _productOrientedGrossBookingSnapshotBlock
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDProductOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDCancellationSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
Handle on the StdAir library context.
SnapshotBlock_T::array_view< 1 >::type SegmentCabinDTDSnapshotView_T
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangeBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDAvailabilitySnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
SegmentCabinIndexMap_T _segmentCabinIndexMap
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDPriceOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDPriceOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangeAvailabilitySnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDAvailabilitySnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDProductOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangeCancellationSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangeCancellationSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
std::map< const MapKey_T, ClassIndex_T > ClassIndexMap_T
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangePriceOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangeProductOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
unsigned short SegmentDataID_T
SnapshotBlock_T::const_array_view< 2 >::type ConstSegmentCabinDTDRangeSnapshotView_T
virtual ~SegmentSnapshotTable()
SnapshotBlock_T _priceOrientedNetBookingSnapshotBlock
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangeAvailabilitySnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
void serialize(Archive &ar, const unsigned int iFileVersion)
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangeBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDPriceOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
const TableID_T DEFAULT_TABLE_ID
const int DEFAULT_MAX_DTD
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangePriceOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangeProductOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
SnapshotBlock_T _availabilitySnapshotBlock
Class representing the actual attributes for an airline segment-cabin.
SegmentCabinDTDSnapshotView_T getSegmentCabinDTDPriceOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T)
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangePriceOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
std::map< const SegmentCabin *, SegmentDataID_T > SegmentCabinIndexMap_T
SegmentCabinDTDRangeSnapshotView_T getSegmentCabinDTDRangePriceOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T)
ConstSegmentCabinDTDRangeSnapshotView_T getConstSegmentCabinDTDRangeProductOrientedNetBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T, const DTD_T) const
const SegmentDataID_T & getSegmentDataID(const SegmentCabin &) const
SnapshotBlock_T _cancellationSnapshotBlock
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDProductOrientedGrossBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
SnapshotBlock_T _bookingSnapshotBlock
std::string toString() const
unsigned short ClassIndex_T
const ClassIndex_T & getClassIndex(const MapKey_T &) const
ConstSegmentCabinDTDSnapshotView_T getConstSegmentCabinDTDBookingSnapshotView(const SegmentDataID_T, const SegmentDataID_T, const DTD_T) const
SnapshotBlock_T _productOrientedNetBookingSnapshotBlock