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

acstimeDurationHelper.h

Go to the documentation of this file.
00001 #ifndef ACSTIME_DURATION_HELPER_H
00002 #define ACSTIME_DURATION_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: acstimeDurationHelper.h,v 1.17 2011/10/28 15:12:04 hsommer Exp $"
00022 */
00023 #ifndef __cplusplus
00024 #error This is a C++ include file and cannot be used from plain C
00025 #endif
00026 /* ----------------------------------------------------------------*/
00027 #include "acstimeTimeUtil.h"
00028 /* ----------------------------------------------------------------*/
00043 class DurationHelper : TimeUtil
00044 {
00045   public:
00046     /* ----------------------------------------------------------------*/
00051     DurationHelper(const acstime::Duration &duration);
00052 
00055     DurationHelper();
00056 
00061     DurationHelper(long double seconds);
00062 
00067     DurationHelper(const ACS::TimeInterval &duration);
00068     
00071     virtual ~DurationHelper(){};
00072     /* ----------------------------------------------------------------*/
00080     acstime::Duration value();
00081 
00089     void value(const acstime::Duration &duration);
00090 
00098     void value(const ACS::TimeInterval &duration);
00099 
00107     void value(long double seconds);
00108     /* ----------------------------------------------------------------*/
00117     CORBA::Boolean positive();
00118     
00127     void positive(const CORBA::Boolean&);
00128     /* ----------------------------------------------------------------*/
00136     CORBA::Long day();
00137 
00145     void day(const CORBA::Long&);
00146     /* ----------------------------------------------------------------*/
00154     CORBA::Long hour();    
00155 
00163     void hour(const CORBA::Long&);
00164     /* ----------------------------------------------------------------*/
00172     CORBA::Long minute();
00173 
00181     void minute(const CORBA::Long&);
00182     /* ----------------------------------------------------------------*/
00190     CORBA::Long second();
00191 
00199     void second(const CORBA::Long&);
00200     /* ----------------------------------------------------------------*/
00208     CORBA::ULong microSecond();
00209 
00217     void microSecond(const CORBA::ULong&);
00218     /* ----------------------------------------------------------------*/
00235     CORBA::Boolean normalize();
00236 
00253     void normalize(const CORBA::Boolean&);
00254     /* ----------------------------------------------------------------*/
00262     void reset();
00263     /* ----------------------------------------------------------------*/
00275     acstime::TimeComparison compare(const acstime::Duration &duration);
00276     //These are the equivalent of the compare method()
00277     CORBA::Boolean operator==(const acstime::Duration &duration) const;
00278     CORBA::Boolean operator<=(const acstime::Duration &duration) const;
00279     CORBA::Boolean operator<(const acstime::Duration &duration) const;
00280     CORBA::Boolean operator>=(const acstime::Duration &duration) const;
00281     CORBA::Boolean operator>(const acstime::Duration &duration) const;
00282 
00292     void add(const acstime::Duration &duration) ;
00293     
00302     DurationHelper& operator+=(const acstime::Duration &duration);
00303 
00313     void subtract(const acstime::Duration &duration);
00314     
00323     DurationHelper& operator-=(const acstime::Duration &duration);
00324 
00333     void modulo(const acstime::Duration &duration);
00334 
00343     DurationHelper& operator%=(const acstime::Duration &duration);
00344 
00354     void multiply(const CORBA::ULong &multiplier);
00355 
00364     DurationHelper& operator*=(const CORBA::ULong &multiplier);
00365     
00374     void divide(const CORBA::ULong &divider);
00375 
00384     DurationHelper& operator/=(const CORBA::ULong &divider);
00385     /* ----------------------------------------------------------------*/
00396     std::string toString(const char *format);
00397     
00407     void fromString(const char *duration);
00408 
00421     long double toSeconds();
00422 
00423 
00424   private:
00425     /* ----------------------------------------------------------------*/
00429     void m_toValue();
00430     
00431     void m_toAttributes();
00432       
00433     void m_microSec(std::ostringstream&);
00434     /* ----------------------------------------------------------------*/
00435     //The real variables affected by calls to public methods.
00436     acstime::Duration value_m;
00437     CORBA::Boolean positive_m;
00438     CORBA::Long day_m;
00439     CORBA::Long hour_m;
00440     CORBA::Long minute_m;
00441     CORBA::Long second_m;
00442     CORBA::ULong microSecond_m;
00443     CORBA::Boolean normalize_m;
00444     /* ----------------------------------------------------------------*/
00447     DurationHelper(const DurationHelper&);
00448 
00451     void operator= (const DurationHelper&);
00452 };
00453 
00454 #endif
00455 
00456 
00457 
00458 
00459 
00460 
00461 
00462 

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