/* * ScanStream.hh * * Created on: Nov 17, 2016 * Author: Hovanes Egiyan */ #ifndef SCANSTREAM_HH_ #define SCANSTREAM_HH_ #include /* printf */ #include /* system, NULL, EXIT_FAILURE */ #include #include #include #include #include #include #include #include #include "ScanFile.hh" #include "ScanDetector.hh" #include "ScanPositioner.hh" class Scan; class ScanStream: public TObject { protected: ScanFile* scanFile; int scanNumber; // Scan number int scanRank; // Scan rank int nPoints; // Number of points in scan int nDetectors; // Number of detectors defined for this scan int nPositioners; // Number of positioned defined for this scan int nTriggers; // Number of triggers defined for this scan std::string scanName; // Name of the scan as defined in EPICS std::string scanTime; // Time the scan was taken int nDetectorsRead; int nPositionersRead; // These maps are defined to help handle scan attributes read from the file // Two of them contain pointers to the members of the class that come from the // MDA file. The third one defines possible strings in front of the "=" sign // that define a scan attribute. The key of the maps match the data member name of // this class, they are string type. std::map scanIntAttribute; // map of integer type attributes std::map scanStringAttribute; // map of string type attributes std::map scanAttributeToken; // tokens for various attributes expected in the file std::map scanDetector; // Map of all detectors read from the file, index is detector set number std::map scanPositioner; // Map of all positioners read from the file std::map subScan; // Map of all subscans read from the file virtual void initAttributes(); // Initialize the maps for attributes virtual void readMDAStream() ; virtual bool checkForAttributes(std::istringstream& strmLine); virtual bool checkForComments(std::istringstream& strmLine); virtual int checkForDetectors(std::istringstream& strmLine); virtual int checkForPositioners(std::istringstream& strmLine); virtual int checkForDetectorData(std::istringstream& strmLine); virtual int checkForPositionerData(std::istringstream& strmLine); virtual int checkForSubscan( std::istringstream& strmLine ) ; virtual bool scanStreamReadComplete(); public: ScanStream( ScanFile* inFile ); virtual ~ScanStream(); virtual void printAttributes(); // Print the attributes virtual int getScanNumber() { return scanNumber;} virtual int getScanRank() {return scanRank;} virtual int getNPoints() {return nPoints;} virtual int getNDetectors() {return nDetectors;} virtual int getNTriggers() {return nTriggers;} virtual std::string getScanName() {return scanName;} virtual std::string getScanTime() {return scanTime;} virtual int setScanNumber( int number ) {return scanNumber = number ;} virtual std::string getFileName() const {return scanFile->getFileName();} virtual std::map& getDetectors() { return scanDetector;} virtual ScanDetector* getDetector( int detNumber ) { return scanDetector[detNumber];} virtual std::map& getPositioners() { return scanPositioner;} virtual ScanPositioner* getPositioner( int posNumber ) { return scanPositioner[posNumber];} virtual std::map& getSubScans() {return subScan;} virtual Scan* getSubScan( int scanNumber ) { return subScan[scanNumber];} ClassDef(ScanStream, 0) }; #endif /* SCANSTREAM_HH_ */