• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

acstimeEpochHelper.h

Go to the documentation of this file.
00001 #ifndef ACSTIME_EPOCH_HELPER_H
00002 #define ACSTIME_EPOCH_HELPER_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * Copyright (c) European Southern Observatory, 2011
00006 *
00007 * This library is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU Lesser General Public
00009 * License as published by the Free Software Foundation; either
00010 * version 2.1 of the License, or (at your option) any later version.
00011 *
00012 * This library is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 * Lesser General Public License for more details.
00016 *
00017 * You should have received a copy of the GNU Lesser General Public
00018 * License along with this library; if not, write to the Free Software
00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: acstimeEpochHelper.h,v 1.19 2011/10/28 15:12:04 hsommer Exp $"
00022 */
00023 /* ----------------------------------------------------------------*/
00024 #ifndef __cplusplus
00025 #error This is a C++ include file and cannot be used from plain C
00026 #endif
00027 /* ----------------------------------------------------------------*/
00028 #include "acstimeTimeUtil.h"
00029 #include "acstimeDurationHelper.h"
00030 /* ----------------------------------------------------------------*/
00043 class EpochHelper : TimeUtil
00044 {
00045   public:
00046     /* ----------------------------------------------------------------*/
00051     EpochHelper(const acstime::Epoch &epoch);
00052     
00055     EpochHelper();
00056 
00061     EpochHelper(long double MJDSeconds);
00062 
00067     EpochHelper(const ACS::Time &value);
00068 
00071     virtual ~EpochHelper(){};
00072     /* ----------------------------------------------------------------*/
00080     acstime::Epoch value();
00081 
00089     void value(const acstime::Epoch &epoch);
00090 
00098     void value(const ACS::Time &epoch);
00099 
00107     void value(long double MJDSeconds);
00108     /* ----------------------------------------------------------------*/
00116     CORBA::ULong year();
00117 
00125     void year(const CORBA::ULong&);
00126     /* ----------------------------------------------------------------*/
00134     CORBA::Long month();
00135 
00143     void month(const CORBA::Long&);
00144     /* ----------------------------------------------------------------*/
00152     CORBA::Long day();
00153 
00161     void day(const CORBA::Long&);
00162     /* ----------------------------------------------------------------*/
00170     CORBA::Long dayOfYear();
00171 
00179     void dayOfYear(const CORBA::Long&);
00180     /* ----------------------------------------------------------------*/
00188     CORBA::ULong dayOfWeek();
00189     /* ----------------------------------------------------------------*/
00197     CORBA::Long hour();
00198 
00206     void hour(const CORBA::Long&);
00207     /* ----------------------------------------------------------------*/
00215     CORBA::Long minute();
00216 
00224     void minute(const CORBA::Long&);
00225     /* ----------------------------------------------------------------*/
00233     CORBA::Long second();
00234 
00242     void second(const CORBA::Long&);
00243     /* ----------------------------------------------------------------*/
00251     CORBA::Long microSecond();
00252 
00260     void microSecond(const CORBA::Long&);
00261     /* ----------------------------------------------------------------*/
00286     CORBA::Boolean normalize();
00287 
00312     void normalize(const CORBA::Boolean&);
00313     /* ----------------------------------------------------------------*/
00321     void reset();
00322     /* ----------------------------------------------------------------*/
00336     acstime::TimeComparison 
00337     compare(const acstime::Epoch &epoch);
00338     //These are the equivalent of the compare method()
00339     CORBA::Boolean operator==(const acstime::Epoch &epoch) const;
00340     CORBA::Boolean operator<=(const acstime::Epoch &epoch) const;
00341     CORBA::Boolean operator<(const acstime::Epoch &epoch) const;
00342     CORBA::Boolean operator>=(const acstime::Epoch &epoch) const;
00343     CORBA::Boolean operator>(const acstime::Epoch &epoch) const;
00344 
00354     void add(const acstime::Duration&);
00355     
00364     EpochHelper& operator+=(const acstime::Duration &duration);
00365 
00375     void subtract(const acstime::Duration&);
00376     
00385     EpochHelper& operator-=(const acstime::Duration &duration);
00386 
00402     acstime::Duration difference(const acstime::Epoch &subtrahend);
00403 
00412     void modulo(const acstime::Epoch &epoch);
00413 
00422     EpochHelper& operator%=(const acstime::Epoch &epoch);
00423     
00437     CORBA::Double toUTCdate(CORBA::Long array2TAI, CORBA::Long TAI2UTC);
00438 
00453     long double toMJDseconds();
00454     
00468     CORBA::Double toJulianYear(CORBA::Long array2TAI, CORBA::Long TAI2UTC);
00469     /* ----------------------------------------------------------------*/
00482     std::string toString(acstime::TimeSystem, const char*, const CORBA::Long array2TAI, const CORBA::Long TAI2UTC);
00483 
00494     void fromString(acstime::TimeSystem, const char*);
00495 
00496     friend DurationHelper* operator% (const EpochHelper&, const ACS::TimeInterval &);
00497     friend DurationHelper* operator% (const ACS::TimeInterval &, const EpochHelper&);
00498 
00499   private:
00500     /* ----------------------------------------------------------------*/
00504     void m_toValue(CORBA::Boolean booVal);
00505     
00506     void m_toAttributes();
00507     
00508     long m_calcLeap();
00509     
00510     void m_almostUnix(std::ostringstream&);
00511     void m_iso8601date(std::ostringstream&);
00512     void m_iso8601full(std::ostringstream&);
00513     void m_abbrevMonth(std::ostringstream&);
00514     void m_abbrevWeekday(std::ostringstream&);
00515     void m_microSec(std::ostringstream&, int);
00516     /* ----------------------------------------------------------------*/
00517     //The real variables affected by calls to public methods.
00518     acstime::Epoch value_m;
00519     CORBA::ULong year_m;
00520     CORBA::Long month_m;
00521     CORBA::Long day_m;
00522     CORBA::Long day_mOfYear;
00523     CORBA::ULong dayOfWeek_m;
00524     CORBA::Long hour_m;
00525     CORBA::Long minute_m;
00526     CORBA::Long second_m;
00527     CORBA::Long microSecond_m;
00528     CORBA::Boolean normalize_m;
00529     
00532     EpochHelper(const EpochHelper&);
00533     
00536     void operator= (const EpochHelper&);
00537 };
00538 
00547 DurationHelper* operator% (const EpochHelper&, const ACS::TimeInterval &);
00548 
00557 DurationHelper* operator% (const ACS::TimeInterval &, const EpochHelper&);
00558 
00559 #endif
00560 
00561 
00562 
00563 
00564 
00565 
00566 
00567 
00568 
00569 

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0