Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

acstimeDurationHelper.h

Go to the documentation of this file.
00001 /* @(#) $Id: acstimeDurationHelper.h,v 1.16 2008/10/09 07:31:16 cparedes Exp $ 00002 * 00003 * Copyright (C) 2001 00004 * Associated Universities, Inc. Washington DC, USA. 00005 * 00006 * Produced for the ALMA project 00007 * 00008 * This library is free software; you can redistribute it and/or modify it it 00009 * under the terms of the GNU Library General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or (at your 00011 * option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful but WITHOUT 00014 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00015 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00016 * License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public License 00019 * along with this library; if not, write to the Free Software Foundation, 00020 * Inc., 675 Massachusetts Ave, Cambridge, MA, 02139, USA. 00021 * 00022 * Correspondence concerning ALMA should be addressed as follows: 00023 * Internet email: alma-sw-admin@nrao.edu 00024 */ 00025 /* ----------------------------------------------------------------*/ 00026 #ifndef ACSTIME_DURATION_HELPER_H 00027 #define ACSTIME_DURATION_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 /* ----------------------------------------------------------------*/ 00049 class DurationHelper : TimeUtil 00050 { 00051 public: 00052 /* ----------------------------------------------------------------*/ 00057 DurationHelper(const acstime::Duration &duration); 00058 00061 DurationHelper(); 00062 00067 DurationHelper(long double seconds); 00068 00073 DurationHelper(const ACS::TimeInterval &duration); 00074 00077 virtual ~DurationHelper(){}; 00078 /* ----------------------------------------------------------------*/ 00086 acstime::Duration value(); 00087 00095 void value(const acstime::Duration &duration); 00096 00104 void value(const ACS::TimeInterval &duration); 00105 00113 void value(long double seconds); 00114 /* ----------------------------------------------------------------*/ 00123 CORBA::Boolean positive(); 00124 00133 void positive(const CORBA::Boolean&); 00134 /* ----------------------------------------------------------------*/ 00142 CORBA::Long day(); 00143 00151 void day(const CORBA::Long&); 00152 /* ----------------------------------------------------------------*/ 00160 CORBA::Long hour(); 00161 00169 void hour(const CORBA::Long&); 00170 /* ----------------------------------------------------------------*/ 00178 CORBA::Long minute(); 00179 00187 void minute(const CORBA::Long&); 00188 /* ----------------------------------------------------------------*/ 00196 CORBA::Long second(); 00197 00205 void second(const CORBA::Long&); 00206 /* ----------------------------------------------------------------*/ 00214 CORBA::ULong microSecond(); 00215 00223 void microSecond(const CORBA::ULong&); 00224 /* ----------------------------------------------------------------*/ 00241 CORBA::Boolean normalize(); 00242 00259 void normalize(const CORBA::Boolean&); 00260 /* ----------------------------------------------------------------*/ 00268 void reset(); 00269 /* ----------------------------------------------------------------*/ 00281 acstime::TimeComparison compare(const acstime::Duration &duration); 00282 //These are the equivalent of the compare method() 00283 CORBA::Boolean operator==(const acstime::Duration &duration) const; 00284 CORBA::Boolean operator<=(const acstime::Duration &duration) const; 00285 CORBA::Boolean operator<(const acstime::Duration &duration) const; 00286 CORBA::Boolean operator>=(const acstime::Duration &duration) const; 00287 CORBA::Boolean operator>(const acstime::Duration &duration) const; 00288 00298 void add(const acstime::Duration &duration) ; 00299 00308 DurationHelper& operator+=(const acstime::Duration &duration); 00309 00319 void subtract(const acstime::Duration &duration); 00320 00329 DurationHelper& operator-=(const acstime::Duration &duration); 00330 00339 void modulo(const acstime::Duration &duration); 00340 00349 DurationHelper& operator%=(const acstime::Duration &duration); 00350 00360 void multiply(const CORBA::ULong &multiplier); 00361 00370 DurationHelper& operator*=(const CORBA::ULong &multiplier); 00371 00380 void divide(const CORBA::ULong &divider); 00381 00390 DurationHelper& operator/=(const CORBA::ULong &divider); 00391 /* ----------------------------------------------------------------*/ 00402 std::string toString(const char *format); 00403 00413 void fromString(const char *duration); 00414 00427 long double toSeconds(); 00428 00429 00430 private: 00431 /* ----------------------------------------------------------------*/ 00435 void m_toValue(); 00436 00437 void m_toAttributes(); 00438 00439 void m_microSec(std::ostringstream&); 00440 /* ----------------------------------------------------------------*/ 00441 //The real variables affected by calls to public methods. 00442 acstime::Duration value_m; 00443 CORBA::Boolean positive_m; 00444 CORBA::Long day_m; 00445 CORBA::Long hour_m; 00446 CORBA::Long minute_m; 00447 CORBA::Long second_m; 00448 CORBA::ULong microSecond_m; 00449 CORBA::Boolean normalize_m; 00450 /* ----------------------------------------------------------------*/ 00453 DurationHelper(const DurationHelper&); 00454 00457 void operator= (const DurationHelper&); 00458 }; 00459 00460 #endif 00461 00462 00463 00464 00465 00466 00467 00468

Generated on Thu Apr 30 02:30:49 2009 for ACS C++ API by doxygen 1.3.8