00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIX_SESSIONTIME_H
00023 #define FIX_SESSIONTIME_H
00024
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028
00029 #include "FieldTypes.h"
00030
00031 namespace FIX
00032 {
00034 class SessionTime
00035 {
00036 public:
00037 SessionTime( const UtcTimeOnly& startTime, const UtcTimeOnly &endTime,
00038 int startDay = -1, int endDay = -1 );
00039
00040 static bool isSessionTime( const UtcTimeOnly& start,
00041 const UtcTimeOnly& end,
00042 const UtcTimeStamp& time );
00043
00044 static bool isSessionTime( const UtcTimeOnly& startTime,
00045 const UtcTimeOnly& endTime,
00046 int startDay,
00047 int endDay,
00048 const UtcTimeStamp& time );
00049
00050 static bool isSameSession( const UtcTimeOnly& start,
00051 const UtcTimeOnly& end,
00052 const UtcTimeStamp& time1,
00053 const UtcTimeStamp& time2 );
00054
00055 static bool isSameSession( const UtcTimeOnly& startTime,
00056 const UtcTimeOnly& endTime,
00057 int startDay,
00058 int endDay,
00059 const UtcTimeStamp& time1,
00060 const UtcTimeStamp& time2 );
00061
00062 bool isSessionTime()
00063 {
00064 if( m_startDay < 0 && m_endDay < 0 )
00065 return isSessionTime( m_startTime, m_endTime, UtcTimeStamp() );
00066 else
00067 return isSessionTime
00068 ( m_startTime, m_endTime, m_startDay, m_endDay, UtcTimeStamp() );
00069 }
00070
00071 bool isSameSession( const UtcTimeStamp& time1, const UtcTimeStamp& time2 )
00072 {
00073 if( m_startDay < 0 && m_endDay < 0 )
00074 return isSameSession( m_startTime, m_endTime, time1, time2 );
00075 else
00076 return isSameSession
00077 ( m_startTime, m_endTime, m_startDay, m_endDay, time1, time2 );
00078 }
00079
00080 private:
00081 UtcTimeOnly m_startTime;
00082 UtcTimeOnly m_endTime;
00083 int m_startDay;
00084 int m_endDay;
00085 };
00086 }
00087
00088 #endif