#include "Brooks0254BasePar.hh" //! Implementation of the base class for Brooks parameters //! Use only 3 decimal points for all double parameters short Brooks0254BasePar::bbpDecPoint = 3; //! Constructor Brooks0254BasePar::Brooks0254BasePar( Brooks0254Module& module, Brooks0254ParID parID ) : Brooks0254Module( module ), bbpID( parID ) { InitMutex(); MtxLock scopeLock( bmMutex ); return; } //! Copy constructor Brooks0254BasePar::Brooks0254BasePar( Brooks0254BasePar& par ) : Brooks0254Module( par ), bbpID(par.bbpID) { //! All pararmeter instances will have the same //! mutex attributes given in the InitMutex method of the //! Brooks0254Module class. InitMutex(); return; } //! Destructor Brooks0254BasePar::~Brooks0254BasePar() { return; } //! Copy operator Brooks0254BasePar& Brooks0254BasePar::operator=( Brooks0254BasePar& par ) { if( this == &par ) return *this; MtxLock scopeLock( bmMutex ); bbpID = par.GetType() ; return (*this); } //! Static method to substitute commas in a string with spaces string Brooks0254BasePar::RemoveComas( string& inStr ) { string outStr = inStr; for( unsigned iChar = 0; iChar < inStr.size(); iChar++ ) { if( inStr[iChar] == ',' ) { outStr[iChar] = ' '; } else { outStr[iChar] = inStr[iChar]; } } return outStr; } //! Get the leftmost digit in decimal representation //! Assuming the number is less 10M, static //! This is specific to 0-th parameter return value //! of Brook0254 device. int Brooks0254BasePar::StripVal( int val ) { if( bmDebFlag ) cout << "Will strip val=" << val << endl; int lastVal = 0; int newVal = 1; for( int iPow = 0; ( iPow <= 6 && newVal != 0 ); iPow++ ) { lastVal = newVal; newVal = val / pow( 10, iPow ); } if( bmDebFlag ) cout << "Stripped value is " << lastVal << endl; return lastVal; } // End of Base class