From 418fa60dbd63b5f91d547f3d0b94efc1c0899421 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 26 Jun 1996 21:53:29 +0000 Subject: [PATCH] removed osi headers --- src/cxxTemplates/osiTime.h | 228 ------------------------------------ src/cxxTemplates/osiTimer.h | 132 --------------------- 2 files changed, 360 deletions(-) delete mode 100644 src/cxxTemplates/osiTime.h delete mode 100644 src/cxxTemplates/osiTimer.h diff --git a/src/cxxTemplates/osiTime.h b/src/cxxTemplates/osiTime.h deleted file mode 100644 index c42c57ce0..000000000 --- a/src/cxxTemplates/osiTime.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - * $Id$ - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - * - * History - * $Log$ - * Revision 1.1.1.1 1996/06/20 22:15:56 jhill - * installed ca server templates - * - * - */ - - -#ifndef osiTimehInclude -#define osiTimehInclude - -#include -#include -#ifndef assert // allows use of epicsAssert.h -#include -#endif - -const unsigned nSecPerSec = 1000000000u; -const unsigned nSecPerUSec = 1000u; -const unsigned secPerMin = 60u; - -class osiTime { - static friend osiTime operator+ - (const osiTime &lhs, const osiTime &rhs); - static friend osiTime operator- - (const osiTime &lhs, const osiTime &rhs); - static friend int operator>= - (const osiTime &lhs, const osiTime &rhs); -public: - osiTime () : sec(0u), nSec(0u) {} - osiTime (const osiTime &t) : sec(t.sec), nSec(t.nSec) {} - osiTime (const unsigned long secIn, const unsigned long nSecIn) - { - if (nSecInsec = secIn; - this->nSec = nSecIn; - } - else if (nSecIn<(nSecPerSec<<1u)){ - this->sec = secIn + 1u; - this->nSec = nSecIn-nSecPerSec; - } - else { - this->sec = nSecIn/nSecPerSec + secIn; - this->nSec = nSecIn%nSecPerSec; - } - } - osiTime (double t) - { - double intPart; - if (t<0.0l) { - t = 0.0l; - } - this->sec = (unsigned long) t; - intPart = (double) this->sec; - this->nSec = (unsigned long) ((t-intPart)*nSecPerSec); - } - - // - // fetched as fields so this file is not required - // to include os dependent struct timeval - // - void getTV(long &secOut, long &uSecOut) const - { - assert (this->sec<=LONG_MAX); - secOut = (long) this->sec; - assert (this->nSec<=LONG_MAX); - uSecOut = (long) this->nSec/nSecPerUSec; - } - // - // - void get(long &secOut, long &nSecOut) const - { - assert(this->sec <= LONG_MAX); - secOut = this->sec; - assert(this->nSec <= LONG_MAX); - nSecOut = this->nSec; - } - void get(unsigned long &secOut, unsigned long &nSecOut) const - { - secOut = this->sec; - nSecOut = this->nSec; - } - void get(unsigned &secOut, unsigned &nSecOut) const - { - secOut = this->sec; - nSecOut = this->nSec; - } - - operator double() const - { - return ((double)this->nSec)/nSecPerSec+this->sec; - } - operator float() const - { - return ((float)this->nSec)/nSecPerSec+this->sec; - } - static osiTime getCurrent(); - - osiTime operator+= (const osiTime &rhs); - osiTime operator-= (const osiTime &rhs); - - void show(unsigned) - { - printf("osiTime: sec=%lu nSec=%lu\n", - this->sec, this->nSec); - } -private: - unsigned long sec; - unsigned long nSec; -}; - -inline osiTime operator+ (const osiTime &lhs, const osiTime &rhs) -{ - return osiTime(lhs.sec + rhs.sec, lhs.nSec + rhs.nSec); -} - -inline osiTime osiTime::operator+= (const osiTime &rhs) -{ - *this = *this + rhs; - return *this; -} - -// -// like data type unsigned this assumes that the lhs > rhs -// (otherwise we assume sec wrap around) -// -inline osiTime operator- (const osiTime &lhs, const osiTime &rhs) -{ - unsigned long nSec, sec; - - if (lhs.sec= (const osiTime &lhs, const osiTime &rhs) -{ - int rc; -// -// Sun's CC -O generates bad code here -// -// -// -#if 0 - if (lhs.sec>rhs.sec) { - return 1; - } - else if (lhs.sec==rhs.sec) { - if (lhs.nSec>=rhs.nSec) { - return 1; - } - } - assert(lhs.sec<=rhs.sec); - return 0; -#endif - if (lhs.sec>rhs.sec) { - rc = 1; - } - else if (lhs.sec=rhs.nSec) { - rc = 1; - } - else { - rc = 0; - } - } - return rc; -} - -#endif // osiTimehInclude - diff --git a/src/cxxTemplates/osiTimer.h b/src/cxxTemplates/osiTimer.h deleted file mode 100644 index 6df763c5d..000000000 --- a/src/cxxTemplates/osiTimer.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * $Id$ - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - * - * History - * $Log$ - * - */ - - -#ifndef osiTimerHInclude -#define osiTimerHInclude - -#include -#include - -enum osiBool {osiFalse=0, osiTrue=1}; -enum osiTimerState {ositPending, ositExpired, ositLimbo}; - -// -// osiTimer -// -class osiTimer : public tsDLNode { - friend class osiTimerQueue; -public: - osiTimer (const osiTime &delay) - { - this->arm(&delay); - } - virtual ~osiTimer(); - - // - // called when the timer expires - // - virtual void expire()=0; - - // - // called if - // 1) osiTimer exists and the osiTimerQueue is deleted - // 2) when the timer expies and again() returs false - // - // osiTimer::destroy() does a "delete this" - // - virtual void destroy(); - - // - // osiTimer::again() returns false - // (run the timer once only) - // returning true indicates that the - // timer should be rearmed with delay - // "delay()" when it expires - // - virtual osiBool again(); - - // - // returns the delay prior to expire - // for subsequent iterations (if "again()" - // returns true) - // - // osiTimer::delay() returns 1 sec - // - virtual const osiTime delay(); - - virtual void show (unsigned level); - - // - // for diagnosics - // - virtual const char *name() - { - return "unknown class deriving from osiTimer"; - } -private: - osiTime exp; - osiTimerState state; - - // - // arm() - // place timer in the pending queue - // - void arm (const osiTime * const pInitialDelay=0); -}; - -// -// osiTimerQueue -// -class osiTimerQueue { -friend class osiTimer; -public: - osiTimerQueue() : inProcess(osiFalse) {}; - ~osiTimerQueue(); - osiTime delayToFirstExpire (); - void process (); - void show (unsigned level); -private: - tsDLList pending; - tsDLList expired; - osiBool inProcess; - - void install (osiTimer &tmr, osiTime delay); -}; - -extern osiTimerQueue staticTimerQueue; - - -#endif // osiTimerHInclude -