#ifndef __MO_VASYNPAR_HH__ #define __MO_VASYNPAR_HH__ /************/ /* Includes */ /************/ #include #include #include #include #include #include /* EPICS includes */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "new" #include "boost/function.hpp" #include "boost/bind.hpp" #include "MtxLock.hh" #include "MutexedClass.hh" #include "asynMasterOscillatorDrv.hh" //class asynMasterOscillatorDrv; // Base class for asyn parameters class moVAsynPar : public MutexedClass { protected: int mvapParNum; //! Asyn driver parameter index std::string mvapParName; //! Asyn parameter name epicsUInt32 mvapMask; //! Mask for reading int mvapElmNum; //! Number of elements the driver will return bool mvapSingleChannel; //! Flag to indicate that this parameter is single channel public: static epicsUInt32 mvapAllBitMask; //! Enable all 32 bits public: moVAsynPar() : mvapParNum(-1), mvapParName(""), mvapMask(mvapAllBitMask), mvapElmNum(0), mvapSingleChannel(true) { } // This is the main constructor. moVAsynPar(std::string parName, int parNum, epicsUInt32 mask = mvapAllBitMask ) : mvapParNum(parNum), mvapParName(parName), mvapMask(mask), mvapElmNum(0), mvapSingleChannel(true) { return; } // Copy constructor moVAsynPar(const moVAsynPar& par) : mvapParNum( par.mvapParNum), mvapParName(par.mvapParName), mvapMask(par.mvapMask), mvapElmNum(par.mvapElmNum), mvapSingleChannel(par.mvapSingleChannel) { return; } // Destructor virtual ~moVAsynPar() {;} virtual moVAsynPar& operator=(const moVAsynPar& argPar) { moVAsynPar& par = const_cast(argPar); // Remove constness MtxLock selfObjLock(mcMutex); MtxLock otherObjLock(par.mcMutex); mvapParNum = par.mvapParNum; mvapParName = par.mvapParName; mvapMask = par.mvapMask; mvapElmNum = par.mvapElmNum; mvapSingleChannel = par.mvapSingleChannel; return *this; } virtual asynStatus Write(asynMasterOscillatorDrv* driver, unsigned channel = 0, void* value = 0, epicsUInt32 mask = mvapAllBitMask) = 0; virtual asynStatus Read(asynMasterOscillatorDrv* driver, unsigned channel = 0, void* value = 0, epicsUInt32* mask = 0) = 0; inline virtual std::string GetName() { MtxLock objLock(mcMutex); return mvapParName; } inline virtual std::string SetName(std::string name) { MtxLock objLock(mcMutex); return (mvapParName = name); } inline virtual int GetNumber() { MtxLock objLock(mcMutex); return mvapParNum; } inline virtual int SetNumber(int num) { MtxLock objLock(mcMutex); return (mvapParNum = num); } inline virtual epicsUInt32 GetMask() { MtxLock objLock(mcMutex); return mvapMask; } inline virtual epicsUInt32 SetMask(epicsUInt32 mask) { MtxLock objLock(mcMutex); return (mvapMask = mask); } inline virtual bool IsSingleChannel() { MtxLock objLock(mcMutex); return mvapSingleChannel; } virtual void Connect2Driver(asynMasterOscillatorDrv* driver) = 0; static epicsUInt32 GetAllBitMask() { MtxLock classLock(mcClassMutex); return mvapAllBitMask; } }; #endif /* __MO_VASYNPAR_HH__ */