/* * ScanPositioner.cpp * * Created on: Dec 23, 2014 * Author: Hovanes Egiyan */ #include "ScanPositioner.hh" ClassImp(ScanPositioner) using namespace std; ScanPositioner::ScanPositioner() : ScanDetector(), posStepMode(""), posReadbackName(""), posReadbackDescription(""), posReadbackUnit("") { return; } ScanPositioner::ScanPositioner( istream& inStream ) : ScanDetector(), posStepMode(""), posReadbackName(""), posReadbackDescription(""), posReadbackUnit("") { // Read 8 lines from the input stream and check if the first descriptors // match the token for individual attributes of the detectors for( int iLine = 0; iLine < 8; iLine ++ ) { string sLine; if( !getline(inStream, sLine) ) break; size_t colPosition = sLine.find( ":" ); // Find the first colon position string firstString = sLine.substr( 0, colPosition ); string secondString = sLine.substr( colPosition+1 ); // The rest of the string if( firstString.find("Detector") != std::string::npos ) { // Convert the string values to integer value to assign to the integer attribute stringstream ssAttributes; ssAttributes << secondString; int attribValue; ssAttributes >> attribValue; detNumber = attribValue; } else if (firstString.find("Name") != std::string::npos ) { detName = secondString; } else if (firstString.find("Description") != std::string::npos ) { detDescription = secondString; } else if (firstString.find("Unit") != std::string::npos ) { detUnit = secondString; } else if (firstString.find("Step Mode") != std::string::npos ) { posStepMode = secondString; } else if (firstString.find("Readback Name") != std::string::npos ) { posReadbackName = secondString; } else if (firstString.find("Readback Description") != std::string::npos ) { posReadbackDescription = secondString; } else if (firstString.find("Readback Unit") != std::string::npos ) { posReadbackUnit = secondString; } } return; } ScanPositioner::ScanPositioner( const ScanPositioner& pos ) : ScanDetector(pos), posStepMode(pos.getStepMode()), posReadbackName(pos.getReadbackName()), posReadbackDescription(pos.getReadbackDescription()), posReadbackUnit(pos.getReadbackUnit()) { } ScanPositioner::~ScanPositioner() { // TODO Auto-generated destructor stub } ScanPositioner& ScanPositioner::operator =( const ScanPositioner& pos ) { if( this != &pos ) { *(dynamic_cast(this)) = ScanDetector::operator=(pos); posStepMode = pos.posStepMode; posReadbackName = pos.posReadbackName; posReadbackDescription = pos.posReadbackDescription; posReadbackUnit = pos.posReadbackUnit; } return *this; }