/* * mpodChannel.hh * * Created on: July 28, 2014 * Author: Hovanes Egiyan */ #ifndef _MPODCHANNEL_HH_ #define _MPODCHANNEL_HH_ #include #include #include #include #include #include #include #include "dbSubsystem.hh" #include "epicsChannel.hh" class mpodChannel: public epicsChannel { protected: // Define function object to calculate the macro name class MacroDefault: public BaseMacro4DB { public: MacroDefault() { } virtual std::string operator()( std::string detPrefix, std::string iocPrefix, baseEpicsChannel* chanPtr ) { cout << "Uses its own name" << endl; return std::string( "DETch=" ) + detPrefix + chanPtr->getFullName() + ",PREF=" + iocPrefix + ",PORT=" + chanPtr->getCrateName() + ",CH=" + chanPtr->getName(); } }; MacroDefault macroDefault; // macro name with full name without the last character class MacroNoSign: public BaseMacro4DB { public: MacroNoSign() { } virtual std::string operator()( std::string detPrefix, std::string iocPrefix, baseEpicsChannel* chanPtr ) { std::string fName = chanPtr->getFullName(); fName = fName.substr(0, fName.size()-1); cout << "Full name is " << fName << endl; return std::string( "DETch=" ) + detPrefix + fName + ",PREF=" + iocPrefix + ",PORT=" + chanPtr->getCrateName() + ",CH=" + chanPtr->getName(); } }; MacroNoSign macroNoSign; // Map for keeping the function objects for calculating macro names // for each DB files that needs to be loaded by detectors. map > macroFunctor; string chanName; public: mpodChannel( string uri, string name, dbSubsystem* subsystemPtr, int chID = 0 ); virtual ~mpodChannel() {} virtual void loadRecords( std::string detectorPrefix, std::string iocPrefix = "" ); virtual void initBoardFileName(); virtual std::string getName() const { return chanName ; } static std::string getMPODChannelName( int slot, int chan ) ; }; #endif /* _MPODCHANNEL_HH_ */