/* * 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 // 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 void initAttributes(); // Initialize the maps for attributes void readMDAStream() ; bool checkForAttributes(std::istringstream& strmLine); bool checkForComments(std::istringstream& strmLine); int checkForDetectors(std::istringstream& strmLine); int checkForPositioners(std::istringstream& strmLine); int checkForDetectorData(std::istringstream& strmLine); int checkForPositionerData(std::istringstream& strmLine); int checkForSubscan( std::istringstream& strmLine ) ; public: ScanStream( ScanFile* inFile ); virtual ~ScanStream(); void printAttributes(); // Print the attributes inline int getScanNumber() { return scanNumber;} inline int getScanRank() {return scanRank;} inline int getNPoints() {return nPoints;} inline int getNDetectors() {return nDetectors;} inline int getNTriggers() {return nTriggers;} inline std::string getScanName() {return scanName;} inline std::string getScanTime() {return scanTime;} inline std::string getFileName() const {return scanFile->getFileName();} inline std::map& getDetectors() { return scanDetector;} inline ScanDetector* getDetector( int detNumber ) { return scanDetector[detNumber];} inline std::map& getPositioners() { return scanPositioner;} inline ScanPositioner* getPositioner( int posNumber ) { return scanPositioner[posNumber];} ClassDef(ScanStream, 0) }; #endif /* SCANSTREAM_HH_ */