Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

FluxSvc::Times Class Reference

encapsulate the various times of interest More...

List of all members.

Public Member Functions

void initialize (MsgStream &log)
double convert (std::string date)
double launch ()
double start ()
double current ()
double end ()
double offset (double t)

Public Attributes

StringProperty m_launchDate
StringProperty m_startDate
DoubleProperty m_startTime
DoubleProperty m_endTime
DoubleProperty m_deltaTime
StringProperty m_startTimeEnvVar
double m_launch
double m_start
double m_end
double m_current


Detailed Description

encapsulate the various times of interest

Definition at line 210 of file FluxSvc.cxx.


Member Function Documentation

double FluxSvc::Times::convert std::string  date  )  [inline]
 

Definition at line 260 of file FluxSvc.cxx.

Referenced by initialize().

00260                                       {
00261             using astro::JulianDate;
00262             if(date.empty())return 0;
00263             // parse a string of the form "2004-09-03 18:00" using the Timestamp class.
00264             facilities::Timestamp jt(date);
00265             return (JulianDate(jt.getJulian())-JulianDate::missionStart())*JulianDate::secondsPerDay;
00266         }

double FluxSvc::Times::current  )  [inline]
 

Definition at line 281 of file FluxSvc.cxx.

Referenced by FluxSvc::run().

00281 { return GPS::instance()->time();}

double FluxSvc::Times::end  )  [inline]
 

Definition at line 282 of file FluxSvc.cxx.

References m_end.

Referenced by FluxSvc::endruntime(), and FluxSvc::run().

00282 {return m_end;}

void FluxSvc::Times::initialize MsgStream &  log  )  [inline]
 

Definition at line 212 of file FluxSvc.cxx.

References convert(), m_deltaTime, m_end, m_endTime, m_launch, m_launchDate, m_start, m_startDate, m_startTime, m_startTimeEnvVar, and offset().

Referenced by FluxSvc::initialize().

00212                                        {
00213             // the launch: if set, all times will be added to it
00214             
00215             m_start = convert(m_startDate);
00216             m_launch= convert(m_launchDate);
00217             if( m_launch==0 ) m_launch=m_start;
00218 
00219             // now add StartTime as offset to either the StartDate or LaunchDate
00220             double offset = m_startTime.value();
00221             double delta  = m_deltaTime.value();
00222             if(! m_startTimeEnvVar.value().empty()) {
00223                 std::string t(m_startTimeEnvVar.value());
00224                 if( t.substr(0,2)=="$(" && t.size()>3 ) { // strip off redundant $(...) 
00225                     t= t.substr(2, t.size()-3);
00226                 }
00227                 const char* envar=::getenv(t.c_str());
00228                 if( envar==0 ){
00229                     log << MSG::WARNING << "Env var \"" << t
00230                         << "\" requested for start time, not found, using value of StartTime: " 
00231                         << m_startTime << endreq;
00232                 } else {
00233                     // set offset and optional delta if env var found (parse 9999,2)
00234                     std::string ev(envar); 
00235                     int comma =  ev.find(',');
00236                     offset = ::atof( ev.substr(0,comma>0?comma+1:-1).c_str() );
00237                     log << MSG::INFO << "Setting start time offset from environment variable " 
00238                         << t << " to "  << offset; 
00239                     if( comma>0){ 
00240                         delta = ::atof(ev.substr(comma+1).c_str());
00241                         log << "\n\t\t\tsetting deltat to " << delta; 
00242                     }
00243                     log << endreq;
00244                  }
00245             }
00246             m_start += offset;
00247 
00248 
00249             if( delta >0 && m_endTime==0 )  m_endTime=m_start+delta;
00250             // set the basic time here: it will be incremented by the flux object
00251             GPS::instance()->time(m_start);
00252             m_end = m_endTime;
00253             if( m_deltaTime>0) m_end=m_start+delta;
00254 
00255             log << MSG::INFO << "init: start time = " << std::setprecision(12)
00256                 << m_start << " sec, end time = " << m_end << " sec, delta = " 
00257                 << m_end-m_start << " sec" << endreq;
00258 
00259         }

double FluxSvc::Times::launch  )  [inline]
 

Definition at line 279 of file FluxSvc.cxx.

References m_launch.

Referenced by FluxSvc::initialize(), and FluxSvc::run().

00279 {return m_launch;}

double FluxSvc::Times::offset double  t  )  [inline]
 

Definition at line 283 of file FluxSvc.cxx.

References m_launch.

Referenced by initialize().

00283 {return t-m_launch;}

double FluxSvc::Times::start  )  [inline]
 

Definition at line 280 of file FluxSvc.cxx.

References m_start.

Referenced by FluxSvc::run().

00280 {return m_start;}


Member Data Documentation

double FluxSvc::Times::m_current
 

Definition at line 278 of file FluxSvc.cxx.

DoubleProperty FluxSvc::Times::m_deltaTime
 

Definition at line 272 of file FluxSvc.cxx.

Referenced by FluxSvc::FluxSvc(), and initialize().

double FluxSvc::Times::m_end
 

Definition at line 277 of file FluxSvc.cxx.

Referenced by end(), and initialize().

DoubleProperty FluxSvc::Times::m_endTime
 

Definition at line 271 of file FluxSvc.cxx.

Referenced by FluxSvc::FluxSvc(), and initialize().

double FluxSvc::Times::m_launch
 

Definition at line 275 of file FluxSvc.cxx.

Referenced by initialize(), launch(), and offset().

StringProperty FluxSvc::Times::m_launchDate
 

Definition at line 268 of file FluxSvc.cxx.

Referenced by FluxSvc::FluxSvc(), and initialize().

double FluxSvc::Times::m_start
 

Definition at line 276 of file FluxSvc.cxx.

Referenced by initialize(), and start().

StringProperty FluxSvc::Times::m_startDate
 

Definition at line 269 of file FluxSvc.cxx.

Referenced by FluxSvc::FluxSvc(), and initialize().

DoubleProperty FluxSvc::Times::m_startTime
 

Definition at line 270 of file FluxSvc.cxx.

Referenced by FluxSvc::FluxSvc(), and initialize().

StringProperty FluxSvc::Times::m_startTimeEnvVar
 

Definition at line 273 of file FluxSvc.cxx.

Referenced by FluxSvc::FluxSvc(), and initialize().


The documentation for this class was generated from the following file:
Generated on Mon Dec 1 13:30:00 2008 by doxygen 1.3.3