//***************************************************************** // File name: Verifier.cpp // // Classes defined: // none // // Classes referenced: // SpeHeader -- Member class to read spectral header // MFMData -- Member class to read MFM data // FSMStepHeader -- Member class to read an FSM step header // FSMStepData -- Member class to read one step of FSM data // B3Spectrum -- Base class to read an ASCII spectral file // // Classes referenced: // none // // Purpose: Invokes B3Spectrum to read every spectrum and verify // the format and internal consistency of a Pioneer 10/11 // spectral file in ASCII format. // // General design philosophy: // 1) Code is designed to resemble JAVA. // 2) Most constructors call other functions to open, read, // and close files and perform calculations. // 3) Text files are read line by line, converted to string // streams and tokenized using the '<<' opperator. // 4) The STL String class is used to represent character // strings. Strings are passed by value to take advantage of // the translation capability of the copy constructor. // 5) Classes, structures and arrays are passed by reference // whenever possible. // 6) Variables of member classes are left public. For // other classes, variables are protected and accessed by // access functions. // // Author: P. R. Gazis 16-MAY-1999 // Modified: 10-JUN-1999 //***************************************************************** #include #include #include #include #include #include #include #include // Classes from the Standard Template Library #include using namespace std; #include "g:\cpp_new\bcparams\BCParams.h" #include "g:\cpp_new\bcparams\BCParams.cpp" #include "h:\b3spectra\cppcode\B3Spectrum.cpp" //***************************************************************** // Main routine // // Purpose: Invoke class B3Spectrum and read through a Pioneer // 10/11 spectral file to verify that the format is correct and // the headers and data are internally consistent. // // Functions: // main() -- main routine // // Author: P. R. Gazis 17-MAY-1999 // Modified: 10-JUN-1999 //***************************************************************** //***************************************************************** // main() -- Verify Pioneer 10/11 ASCII spectral file main() { cout << "Verifier: And so it begins...\n"; // Get control parameters BCParams cParams( "Verifier.in"); // Loop: Examine successive spectra do { // Instantiate spectrum B3Spectrum spectrum( cParams.getString( "speFileSpec:")); // Loop: Read spectral file until done int nTest = cParams.getInt( "nTest:"); for( int i = 0; i < nTest; i++) { if( spectrum.isSpeFileOpen() == 0) break; spectrum.read(); if( spectrum.eof() != 0) { cout << "Verifier: finished with " << i << " cycles\n"; break; } } // Report accounting information cout << "Verifier\n" << " nSpectra: " << setw( 7) << spectrum.nSpectra() << "\n" << " nSpeHeaders: " << setw( 7) << spectrum.nSpeHeaders() << " " << setw( 7) << spectrum.nBadSpeHeaders() << "\n" << " nMFMRecords: " << setw( 7) << spectrum.nMFMRecords() << " " << setw( 7) << spectrum.nBadMFMRecords() << " " << setw( 7) << spectrum.nBadMFMValuesA() << " " << setw( 7) << spectrum.nBadMFMValuesB() << "\n" << " nFSMStepHeaders: " << setw( 7) << spectrum.nFSMStepHeaders() << " " << setw( 7) << spectrum.nBadFSMStepHeaders() << "\n" << " nFSMStepRecords: " << setw( 7) << spectrum.nFSMStepRecords() << " " << setw( 7) << spectrum.nBadFSMStepRecords() << " " << setw( 7) << spectrum.nBadFSMStepValuesA() << " " << setw( 7) << spectrum.nBadFSMStepValuesB() << "\n" << " nRecs: " << setw( 7) << spectrum.nRecs() << "\n"; } while( cParams.nextParams() != 0); // Close files and terminate routine cout << "\n"; cout << "Verifier: Th-th-th-that's all, folks!\n"; }