0.45.1
C++ Standard Airline IT Object Library
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
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
assert (
false
);
25
}
26
27
// ////////////////////////////////////////////////////////////////////
28
TimePeriod::TimePeriod (
const
Key_T
& iKey)
29
: _key (iKey), _parent (NULL) {
30
}
31
32
// ////////////////////////////////////////////////////////////////////
33
TimePeriod::~TimePeriod
() {
34
}
35
36
// ////////////////////////////////////////////////////////////////////
37
std::string
TimePeriod::toString
()
const
{
38
std::ostringstream oStr;
39
oStr <<
describeKey
();
40
return
oStr.str();
41
}
42
43
// ////////////////////////////////////////////////////////////////////
44
bool
TimePeriod::
45
isDepartureTimeValid
(
const
Time_T
& iFlightTime)
const
{
46
47
const
Time_T
& lTimeRangeStart =
getTimeRangeStart
();
48
const
Time_T
& lTimeRangeEnd =
getTimeRangeEnd
();
49
50
// Check if the departure time is within the time range.
51
if
(lTimeRangeStart >= iFlightTime) {
52
// DEBUG
53
STDAIR_LOG_DEBUG
(
"Time range begin: "
<< lTimeRangeStart <<
", "
54
<<
"time: "
<< iFlightTime);
55
return
false
;
56
}
57
if
(lTimeRangeEnd <= iFlightTime) {
58
// DEBUG
59
STDAIR_LOG_DEBUG
(
"Time range end: "
<< lTimeRangeEnd <<
", "
60
<<
"time: "
<< iFlightTime);
61
return
false
;
62
}
63
64
return
true
;
65
}
66
67
}
68
Generated on Thu Aug 16 2012 03:18:49 for StdAir by
1.8.1.2