avoid strange problems with ms compiler that appear to

be influenced by using inline functions with the expireStatus
class
This commit is contained in:
Jeff Hill
2002-09-11 20:47:21 +00:00
parent 9af78b1d37
commit 4c04096ce9
2 changed files with 45 additions and 29 deletions

View File

@@ -15,6 +15,8 @@
* 505 665 1831
*/
#include <stdexcept>
#define epicsExportSharedSymbols
#include "epicsTimer.h"
#include "epicsGuard.h"
@@ -103,6 +105,44 @@ void epicsTimerQueuePassiveForC::destroy ()
delete this;
}
epicsTimerNotify::expireStatus::expireStatus ( restart_t restart ) :
delay ( - DBL_MAX )
{
if ( restart != noRestart ) {
throw std::logic_error
( "timer restart was requested without specifying a delay?" );
}
}
epicsTimerNotify::expireStatus::expireStatus
( restart_t, const double & expireDelaySec ) :
delay ( expireDelaySec )
{
assert ( this->delay >= 0.0 );
if ( restart != restart ) {
throw std::logic_error
( "no timer restart was requested, but a delay was specified?" );
}
if ( this->delay < 0.0 ) {
throw std::logic_error
( "timer restart was requested, but a negative delay was specified?" );
}
}
bool epicsTimerNotify::expireStatus::restart () const
{
return this->delay >= 0.0;
}
double epicsTimerNotify::expireStatus::expirationDelay () const
{
if ( this->delay < 0.0 ) {
throw std::logic_error
( "no timer restart was requested, but you are asking for a restart delay?" );
}
return this->delay;
}
extern "C" epicsTimerQueuePassiveId epicsShareAPI
epicsTimerQueuePassiveCreate ( epicsTimerQueueRescheduleCallback pCallbackIn, void *pPrivateIn )
{

View File

@@ -34,14 +34,14 @@ public:
enum restart_t { noRestart, restart };
class expireStatus {
public:
expireStatus ( restart_t );
expireStatus ( restart_t, const double &expireDelaySec );
bool restart () const;
double expirationDelay () const;
epicsShareFunc expireStatus ( restart_t );
epicsShareFunc expireStatus ( restart_t, const double & expireDelaySec );
epicsShareFunc bool restart () const;
epicsShareFunc double expirationDelay () const;
private:
bool again;
double delay;
};
epicsShareFunc virtual ~epicsTimerNotify ();
// return "noRestart" or "expireStatus ( restart, 30.0 /* sec */ )"
virtual expireStatus expire ( const epicsTime & currentTime ) = 0;
@@ -100,30 +100,6 @@ public:
virtual double process ( const epicsTime & currentTime ) = 0; // returns delay to next expire
};
inline epicsTimerNotify::expireStatus::expireStatus ( restart_t restart ) :
again ( false ), delay ( - DBL_MAX )
{
assert ( restart == noRestart );
}
inline epicsTimerNotify::expireStatus::expireStatus
( restart_t, const double &expireDelaySec ) :
again ( true ), delay ( expireDelaySec )
{
assert ( this->delay >= 0.0 );
}
inline bool epicsTimerNotify::expireStatus::restart () const
{
return this->again;
}
inline double epicsTimerNotify::expireStatus::expirationDelay () const
{
assert ( this->again );
return this->delay;
}
inline epicsTimer::expireInfo::expireInfo ( bool activeIn,
const epicsTime & expireTimeIn ) :
active ( activeIn ), expireTime ( expireTimeIn )