00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
#ifndef ACSTIME_EPOCH_HELPER_H
00027
#define ACSTIME_EPOCH_HELPER_H
00028
00029
#ifndef __cplusplus
00030
#error This is a C++ include file and cannot be used from plain C
00031
#endif
00032
00033
#include "acstimeTimeUtil.h"
00034
#include "acstimeDurationHelper.h"
00035
00048 class EpochHelper :
TimeUtil
00049 {
00050
public:
00051
00056
EpochHelper(
const acstime::Epoch &epoch);
00057
00060
EpochHelper();
00061
00066
EpochHelper(
long double MJDSeconds);
00067
00072
EpochHelper(
const ACS::Time &
value);
00073
00076 virtual ~EpochHelper(){};
00077
00085 acstime::Epoch
value();
00086
00094
void value(
const acstime::Epoch &epoch);
00095
00103
void value(
const ACS::Time &epoch);
00104
00112
void value(
long double MJDSeconds);
00113
00121 CORBA::ULong
year();
00122
00130
void year(
const CORBA::ULong&);
00131
00139 CORBA::Long
month();
00140
00148
void month(
const CORBA::Long&);
00149
00157 CORBA::Long
day();
00158
00166
void day(
const CORBA::Long&);
00167
00175 CORBA::Long
dayOfYear();
00176
00184
void dayOfYear(
const CORBA::Long&);
00185
00193 CORBA::ULong
dayOfWeek();
00194
00202 CORBA::Long
hour();
00203
00211
void hour(
const CORBA::Long&);
00212
00220 CORBA::Long
minute();
00221
00229
void minute(
const CORBA::Long&);
00230
00238 CORBA::Long
second();
00239
00247
void second(
const CORBA::Long&);
00248
00256 CORBA::Long
microSecond();
00257
00265
void microSecond(
const CORBA::Long&);
00266
00291 CORBA::Boolean
normalize();
00292
00317
void normalize(
const CORBA::Boolean&);
00318
00326
void reset();
00327
00341 acstime::TimeComparison
00342
compare(
const acstime::Epoch &epoch);
00343
00344 CORBA::Boolean
operator==(
const acstime::Epoch &epoch)
const;
00345 CORBA::Boolean
operator<=(
const acstime::Epoch &epoch)
const;
00346 CORBA::Boolean
operator<(
const acstime::Epoch &epoch)
const;
00347 CORBA::Boolean
operator>=(
const acstime::Epoch &epoch)
const;
00348 CORBA::Boolean
operator>(
const acstime::Epoch &epoch)
const;
00349
00359
void add(
const acstime::Duration&);
00360
00369
EpochHelper&
operator+=(
const acstime::Duration &duration);
00370
00380
void subtract(
const acstime::Duration&);
00381
00390
EpochHelper&
operator-=(
const acstime::Duration &duration);
00391
00407 acstime::Duration
difference(
const acstime::Epoch &subtrahend);
00408
00417
void modulo(
const acstime::Epoch &epoch);
00418
00427
EpochHelper&
operator%=(
const acstime::Epoch &epoch);
00428
00442 CORBA::Double
toUTCdate(CORBA::Long array2TAI, CORBA::Long TAI2UTC);
00443
00458
long double toMJDseconds();
00459
00473 CORBA::Double
toJulianYear(CORBA::Long array2TAI, CORBA::Long TAI2UTC);
00474
00487 std::string
toString(acstime::TimeSystem,
const char*,
const CORBA::Long array2TAI,
const CORBA::Long TAI2UTC);
00488
00499
void fromString(acstime::TimeSystem,
const char*);
00500
00501
friend DurationHelper*
operator% (
const EpochHelper&,
const ACS::TimeInterval &);
00502
friend DurationHelper*
operator% (
const ACS::TimeInterval &,
const EpochHelper&);
00503
00504
private:
00505
00509
void m_toValue(CORBA::Boolean booVal);
00510
00511
void m_toAttributes();
00512
00513
long m_calcLeap();
00514
00515
void m_almostUnix(std::ostringstream&);
00516
void m_iso8601date(std::ostringstream&);
00517
void m_iso8601full(std::ostringstream&);
00518
void m_abbrevMonth(std::ostringstream&);
00519
void m_abbrevWeekday(std::ostringstream&);
00520
void m_microSec(std::ostringstream&,
int);
00521
00522
00523 acstime::Epoch
value_m;
00524 CORBA::ULong
year_m;
00525 CORBA::Long
month_m;
00526 CORBA::Long
day_m;
00527 CORBA::Long
day_mOfYear;
00528 CORBA::ULong
dayOfWeek_m;
00529 CORBA::Long
hour_m;
00530 CORBA::Long
minute_m;
00531 CORBA::Long
second_m;
00532 CORBA::Long
microSecond_m;
00533 CORBA::Boolean
normalize_m;
00534
00537
EpochHelper(
const EpochHelper&);
00538
00541
void operator= (
const EpochHelper&);
00542 };
00543
00552
DurationHelper*
operator% (
const EpochHelper&,
const ACS::TimeInterval &);
00553
00562
DurationHelper*
operator% (
const ACS::TimeInterval &,
const EpochHelper&);
00563
00564
#endif
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574