00001 /******************************************************************************* 00002 * Copyright (c) 2006 International Business Machines Corporation 00003 * All rights reserved. This program and the accompanying materials 00004 * are made available under the terms of the Common Public License v1.0 00005 * which accompanies this distribution, and is available at 00006 * http://www.opensource.org/licenses/cpl1.0.php 00007 * 00008 * Contributors: 00009 * Douglas Sprague, Joel Wheeler - initial API and implementation 00010 * 00011 *****************************************************************************/ 00012 00013 #ifndef STILScanMatrix_H 00014 #define STILScanMatrix_H 00015 00016 #include "stilcom.h" // Common library 00017 #include "stilscanstring.h" // STIL Scan String interface 00018 #include <vector> 00019 00020 00021 //--------------------------------------------------------------------------- 00027 //--------------------------------------------------------------------------- 00028 class STILScanMatrix { 00029 00030 // - Public members 00031 public: 00032 00033 // - Default constructor 00034 STILScanMatrix(); 00035 00036 // - Copy Constructor 00037 STILScanMatrix(const STILScanMatrix &); 00038 00039 // - Destructor 00040 virtual ~STILScanMatrix(); 00041 00042 // - Assignment operator 00043 STILScanMatrix & operator=(const STILScanMatrix &); 00044 00045 // - Initialize/reset this object 00046 void init(); 00047 00048 // - Normalize all scan sstring to the same length 00049 // Pre-pad all ScanIn pins and post-pad all ScanOut pins 00050 LONG normalize(); 00051 00052 // - "Flatten" this scan down into just it's 'unique' states 00053 LONG flatten(); 00054 00055 // - Print contents of this scan matrix for debug purposes 00056 void print(); 00057 00058 // - Get the maximum scan length for all scan sstrings in this matrix 00059 LONG getMaxScanLength(); 00060 00061 // - Get/Set the scan sstring type (ScanIn/ScanOut) for this signal ID 00062 void setScanStringType(LONG id, STILScanType st); 00063 STILScanType getScanStringType(LONG id) const; 00064 00065 // - Get the current piece of scan data (WFC) for the given signal ID 00066 char getCurrentScanWFC(LONG id) const; 00067 00068 // - Move to the next available scan event for the given signal ID 00069 void moveToNextScanEvent(LONG id); 00070 00071 // - Reference a specific scan sstring based on the signal ID. 00072 STILScanString & operator[](LONG id); 00073 00074 // - Private members 00075 private: 00076 00077 LONG m_maxScanLength; // maximum scan length 00078 std::vector<STILScanString *> m_ssVector; // vector of scan sstring poniters 00079 00080 }; 00081 00083 00084 //-------------------------------------------------------------------------- 00092 //-------------------------------------------------------------------------- 00093 inline STILScanType STILScanMatrix::getScanStringType(LONG i) const { 00094 STILScanType retval = ScanDisabled; 00095 if ( m_ssVector.size() > i 00096 && m_ssVector[i] != NULL 00097 ) { 00098 retval = m_ssVector[i]->getScanType(); 00099 } 00100 return retval; 00101 } 00102 00103 #endif