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 STILScanString_H 00014 #define STILScanString_H 00015 00016 00017 #include "stilcom.h" // Common library 00018 #include "stilscantype.h" // STIL Scan Type definition 00019 #include "stilvectoreventlist.h" // STIL Vector Event List interface 00020 #include <vector> 00021 00022 00023 //--------------------------------------------------------------------------- 00029 //--------------------------------------------------------------------------- 00030 class STILScanString { 00031 00032 // - Public members 00033 public: 00034 00035 // - Default constructor 00036 STILScanString(); 00037 00038 // - Copy Constructor 00039 STILScanString(const STILScanString &); 00040 00041 // - Destructor 00042 ~STILScanString(); 00043 00044 // - Assignment operator 00045 STILScanString & operator=(const STILScanString &); 00046 00047 // - Index operators 00048 char operator[](LONG) const; 00049 char & operator[](LONG); 00050 00051 // - Initialize/reset this object 00052 void init(); 00053 00054 // - Get/Set the type of scan data this is (ScanIn or ScanOut) 00055 void setScanType(STILScanType st); 00056 STILScanType getScanType() const; 00057 00058 // - Get a count of the # of WFCs for this scan 00059 LONG getCount() const; 00060 00061 // - Add the given WFC to the end of this scan 00062 void addWFC(char wfc); 00063 00064 // - Pad the front of this scan sstring with n WFC's 00065 void padFront(LONG n, char wfc); 00066 00067 // - Pad the back of this scan sstring with n STIL events 00068 void padBack(LONG n, char wfc); 00069 00070 // - Get the current shift postion for this scan 00071 LONG getCurrentShiftPos() const; 00072 00073 // - Move to next shift position for this scan 00074 void moveToNextShiftPos(); 00075 00076 // - Get/Set the number of states to be applied before scan shifting 00077 void setNumPreShiftVecs(LONG n); 00078 LONG getNumPreShiftVecs() const; 00079 00080 // - Get/Set the number of states to be applied after scan shifting 00081 void setNumPostShiftVecs(LONG n); 00082 LONG getNumPostShiftVecs() const; 00083 00084 // - Private members 00085 private: 00086 00087 std::vector<char> m_scanString; // underlying sstring of WFC's 00088 STILScanType m_scanType; // type of scan sstring (ScanIn/ScanOut) 00089 LONG m_currentShiftPos; // current shift position for this scan 00090 00091 LONG m_preShiftVecs; // number of states that are applied before a shift block 00092 LONG m_postShiftVecs; // number of states that are applied after a shift block 00093 00094 }; 00095 00097 00098 //-------------------------------------------------------------------------- 00106 //-------------------------------------------------------------------------- 00107 inline STILScanType STILScanString::getScanType() const { 00108 return m_scanType; 00109 } 00110 00111 //-------------------------------------------------------------------------- 00119 //-------------------------------------------------------------------------- 00120 inline void STILScanString::setScanType(STILScanType st) { 00121 m_scanType = st; 00122 } 00123 00124 //-------------------------------------------------------------------------- 00132 //-------------------------------------------------------------------------- 00133 inline LONG STILScanString::getCurrentShiftPos() const { 00134 return m_currentShiftPos; 00135 } 00136 00137 //-------------------------------------------------------------------------- 00145 //-------------------------------------------------------------------------- 00146 inline void STILScanString::moveToNextShiftPos() { 00147 m_currentShiftPos++; 00148 } 00149 00150 //-------------------------------------------------------------------------- 00158 //-------------------------------------------------------------------------- 00159 inline void STILScanString::setNumPreShiftVecs(LONG n) { m_preShiftVecs = n; } 00160 00161 //-------------------------------------------------------------------------- 00169 //-------------------------------------------------------------------------- 00170 inline LONG STILScanString::getNumPreShiftVecs() const { return m_preShiftVecs; } 00171 00172 //-------------------------------------------------------------------------- 00180 //-------------------------------------------------------------------------- 00181 inline void STILScanString::setNumPostShiftVecs(LONG n) { m_postShiftVecs = n; } 00182 00183 //-------------------------------------------------------------------------- 00191 //-------------------------------------------------------------------------- 00192 inline LONG STILScanString::getNumPostShiftVecs() const { return m_postShiftVecs; } 00193 00194 00195 // Following inline functions will prevent errors when compiling the 00196 // template code for the STL lists of the pointers to these types. 00197 // This is needed because the compiler does not know how to ignore 00198 // delete when called on pointers with one level of indirection too much 00199 // (so says the STILBlock class, anyhow...) 00200 inline void destroy(STILScanString**) { } 00201 00202 00203 #endif