1.00.0
C++ Standard Airline IT Object Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
TimePeriod.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_General.hpp
>
9
#include <
stdair/service/Logger.hpp
>
10
#include <
stdair/bom/TimePeriod.hpp
>
11
12
namespace
stdair {
13
14
// ////////////////////////////////////////////////////////////////////
15
TimePeriod::TimePeriod()
16
: _key (
DEFAULT_EPSILON_DURATION
,
DEFAULT_EPSILON_DURATION
),
17
_parent (NULL) {
18
// That constructor is used by the serialisation process
19
}
20
21
// ////////////////////////////////////////////////////////////////////
22
TimePeriod::TimePeriod (
const
TimePeriod& iTimePeriod)
23
: _key (iTimePeriod.getKey()), _parent (NULL) {
24
}
25
26
// ////////////////////////////////////////////////////////////////////
27
TimePeriod::TimePeriod (
const
Key_T
& iKey)
28
: _key (iKey), _parent (NULL) {
29
}
30
31
// ////////////////////////////////////////////////////////////////////
32
TimePeriod::~TimePeriod
() {
33
}
34
35
// ////////////////////////////////////////////////////////////////////
36
std::string
TimePeriod::toString
()
const
{
37
std::ostringstream oStr;
38
oStr <<
describeKey
();
39
return
oStr.str();
40
}
41
42
// ////////////////////////////////////////////////////////////////////
43
bool
TimePeriod::
44
isDepartureTimeValid
(
const
Time_T
& iFlightTime)
const
{
45
46
const
Time_T
& lTimeRangeStart =
getTimeRangeStart
();
47
const
Time_T
& lTimeRangeEnd =
getTimeRangeEnd
();
48
49
// Check if the departure time is within the time range.
50
if
(lTimeRangeStart >= iFlightTime) {
51
// DEBUG
52
STDAIR_LOG_DEBUG
(
"Time range begin: "
<< lTimeRangeStart <<
", "
53
<<
"time: "
<< iFlightTime);
54
return
false
;
55
}
56
if
(lTimeRangeEnd <= iFlightTime) {
57
// DEBUG
58
STDAIR_LOG_DEBUG
(
"Time range end: "
<< lTimeRangeEnd <<
", "
59
<<
"time: "
<< iFlightTime);
60
return
false
;
61
}
62
63
return
true
;
64
}
65
66
}
67
Generated on Sat Dec 22 2012 16:51:54 for StdAir by
1.8.1.1