/* * baseEpicsChannel.hh * * Created on: Oct 1, 2019 * Author: hovanes */ #ifndef VOLTAGEAPP_SRC_BASEEPICSCHANNEL_HH_ #define VOLTAGEAPP_SRC_BASEEPICSCHANNEL_HH_ #include #include #include #include #include #include #include #include "dbCrate.hh" class baseEpicsChannel { protected: class BaseMacro4DB { public: BaseMacro4DB(){} virtual ~BaseMacro4DB(){} virtual std::string operator()( std::string detPrefix, std::string iocPrefix, baseEpicsChannel* chan ) = 0; }; std::string fullName ; std::string crateName; std::string crateHost; int slotNumber; int chanNum; std::string chanType; // Vector to keep the files that need to be loaded // The first index is detector name, second is the EPICS DB file number std::map > boardFileName; public: baseEpicsChannel( std::string name, std::string crName="", std::string crHost = "", int slot = 0, int chNum = -1, std::string type = "" ) : fullName(name), crateName(crName), crateHost(crHost), slotNumber(slot), chanNum(chNum), chanType(type) { return; } virtual ~baseEpicsChannel() { boardFileName.clear(); } int getSlotNumber() const {return slotNumber;} int getChanNum() const {return chanNum ;} std::string getChanType() const {return chanType ;} std::string getCrateName() const {return crateName;} std::string getCrateHost() const {return crateHost;} std::string getFullName() const {return fullName ;} int setSlotNumber(int slot) {return (slotNumber=slot);} int setChanNumber(int chan) {return (chanNum = chan);} std::string setChanType(std::string type) {return (chanType=type);} std::string setCrateName(std::string name ) { return (crateName=name);} std::string setCrateHost(std::string host ) {return (crateHost=host);} std::string setFullName(std::string name) {return (fullName = name );} virtual bool dbFileIsIncluded( std::string det, std::string fileName ) { if ( boardFileName.count( det ) > 0 ) { vector& nameVec = boardFileName[det]; if ( std::find( nameVec.begin(), nameVec.end(), fileName ) != nameVec.end() ) { return true; } else { return false; } } else { return false; } } virtual map > getBoardFileName() { return boardFileName;} // Method to load the EPICS records for corresponding detector channels virtual void loadRecords( std::string detPrefix, std::string iocPrefix ) = 0 ; // Method to initialize the file names map for the EPICS DB file names to be loaded virtual void initBoardFileName() = 0 ; // Method to return the name of the channel. virtual std::string getName() const = 0; }; #endif /* VOLTAGEAPP_SRC_BASEEPICSCHANNEL_HH_ */