1.00.8
C++ Standard Airline IT Object Library
DatePeriod.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// StdAir
8
#include <
stdair/basic/BasConst_Period_BOM.hpp
>
9
#include <
stdair/service/Logger.hpp
>
10
#include <
stdair/bom/DatePeriod.hpp
>
11
12
namespace
stdair
{
13
14
// ////////////////////////////////////////////////////////////////////
15
DatePeriod::DatePeriod()
16
: _key (
BOOST_DEFAULT_DATE_PERIOD
),
17
_parent (NULL) {
18
// That constructor is used by the serialisation process
19
}
20
21
// ////////////////////////////////////////////////////////////////////
22
DatePeriod::DatePeriod (
const
DatePeriod& iDatePeriod)
23
: _key (iDatePeriod.getKey()), _parent (NULL) {
24
}
25
26
// ////////////////////////////////////////////////////////////////////
27
DatePeriod::DatePeriod (
const
Key_T
& iKey)
28
: _key (iKey), _parent (NULL) {
29
}
30
31
// ////////////////////////////////////////////////////////////////////
32
DatePeriod::~DatePeriod
() {
33
}
34
35
// ////////////////////////////////////////////////////////////////////
36
std::string
DatePeriod::toString
()
const
{
37
std::ostringstream oStr;
38
oStr <<
describeKey
();
39
return
oStr.str();
40
}
41
42
// ////////////////////////////////////////////////////////////////////
43
bool
DatePeriod::
44
isDepartureDateValid
(
const
Date_T
& iFlightDate)
const
{
45
46
// Check if the departure date is within the date range.
47
const
DatePeriod_T
& lPeriod =
getDatePeriod
();
48
if
(lPeriod.contains (iFlightDate) ==
false
) {
49
return
false
;
50
}
51
52
return
true
;
53
}
54
55
}
56
BasConst_Period_BOM.hpp
Logger.hpp
stdair::DatePeriod::describeKey
const std::string describeKey() const
Definition:
DatePeriod.hpp:57
stdair
Handle on the StdAir library context.
Definition:
BasChronometer.cpp:9
stdair::DatePeriod::toString
std::string toString() const
Definition:
DatePeriod.cpp:36
stdair::DatePeriod::~DatePeriod
virtual ~DatePeriod()
Definition:
DatePeriod.cpp:32
DatePeriod.hpp
stdair::BOOST_DEFAULT_DATE_PERIOD
const DatePeriod_T BOOST_DEFAULT_DATE_PERIOD
stdair::DatePeriod::isDepartureDateValid
bool isDepartureDateValid(const Date_T &) const
Definition:
DatePeriod.cpp:44
stdair::DatePeriod_T
boost::gregorian::date_period DatePeriod_T
Definition:
stdair_date_time_types.hpp:29
stdair::DatePeriodKey
Key of date-period.
Definition:
DatePeriodKey.hpp:14
stdair::DatePeriod::getDatePeriod
const DatePeriod_T & getDatePeriod() const
Definition:
DatePeriod.hpp:87
stdair::Date_T
boost::gregorian::date Date_T
Definition:
stdair_date_time_types.hpp:20
Generated for StdAir by
1.8.17