GDCM
2.2.3
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef GDCMARTIMTIMER_H 00019 #define GDCMARTIMTIMER_H 00020 00021 namespace gdcm { 00022 namespace network{ 00038 class ARTIMTimer 00039 { 00040 private: 00041 double mStartTime; //ms timing should be good enough, but there are also 00042 //high-resolution timing options. Those return doubles. For now, 00043 //go with integer timing solutions based on milliseconds (DWORD on windows), 00044 //but leave as doubles to ease transitions to other timing methods. 00045 00046 double mTimeOut; 00047 //once GetCurrentTime() -mStartTime > mTimeout, GetHasExpired returns true. 00048 00049 double GetCurrentTime() const;//a platform-specific implementation of getting the 00050 //current time. 00051 00052 public: 00053 ARTIMTimer(); //initiates the start and timeout at -1; 00054 void Start(); //'start' the timer by getting the current wall time 00055 void Stop();//'stop' the timer by resetting the 'start' to -1; 00056 void SetTimeout(double inTimeout); 00057 double GetTimeout() const; 00058 00059 double GetElapsedTime() const; 00060 00061 bool GetHasExpired() const; 00062 00063 }; 00064 } 00065 } 00066 00067 #endif //GDCMARTIMTIMER_H