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 STILPattern_H 00014 #define STILPattern_H 00015 00016 #include "stilcomstr.h" 00017 00018 00019 #include "stilpatternblock.h" // STIL PatternBlock Interface (base class) 00020 #include "stilvector.h" // STIL Vector Interface 00021 #include "stilloop.h" // STIL Loop Interface 00022 00023 //--------------------------------------------------------------------------- 00030 //--------------------------------------------------------------------------- 00031 class STILPattern : public STILPatternBlock { 00032 00033 // - Public members 00034 public: 00035 00036 // - Default Constructor 00037 STILPattern(); 00038 00039 // - Copy Constructor 00040 STILPattern(const STILPattern &); 00041 00042 // - Destructor 00043 virtual ~STILPattern(); 00044 00045 // - Assignment operator 00046 STILPattern & operator=(const STILPattern &); 00047 00048 // - Initialize this STILPattern object. 00049 void init(); 00050 00051 // - Write out this object to a given FILE 00052 virtual void write(FILE * pOutFile, LONG indentation=0) const; 00053 00054 00055 // - Get/Set the TimeUnit attribute 00056 void setTimeUnit(const sstring &,const sstring & label=""); 00057 const sstring & getTimeUnit() const; 00058 00059 // - Get/Set the "parser_blocked" attribute for this pattern block. 00060 // When the "parser_blocked" attribute is true it indicates that this 00061 // pattern block is in a "blocked" state in the parser thread and 00062 // the parser thread is waiting for the client thread to use up all 00063 // the currently parsed patterns and then "unblock" the parser. 00064 void setParserBlocked(bool pb); 00065 bool getParserBlocked() const; 00066 00067 // - Get/Set the "flush" attribute for this pattern block. 00068 // When the "flush" attribute is true it indicates that this 00069 // pattern block should be flushed by the parser up to the next 00070 // pattern block. The parser should just do syntax checking in 00071 // this case and not actually store pattern entries into this 00072 // pattern block. 00073 void setFlush(bool f); 00074 bool getFlush() const; 00075 00076 // Private members 00077 private: 00078 00079 sstring m_timeUnit; // TimeUnit Attribute 00080 bool m_parserBlocked; // Is the parser blocked on this pattern 00081 bool m_flush; // Should the parser flush this pat blk 00082 00083 }; // end STILPattern class 00084 00085 // Inline functions 00086 //-------------------------------------------------------------------------- 00094 //-------------------------------------------------------------------------- 00095 inline void STILPattern::setTimeUnit(const sstring & tu, 00096 const sstring & label) { 00097 m_timeUnit = tu; 00098 addEntity(TimeUnit,"TimeUnit",tu,label); 00099 } 00100 00101 //-------------------------------------------------------------------------- 00109 //-------------------------------------------------------------------------- 00110 inline const sstring & STILPattern::getTimeUnit() const { return m_timeUnit; } 00111 00112 //-------------------------------------------------------------------------- 00120 //-------------------------------------------------------------------------- 00121 inline void STILPattern::setParserBlocked(bool pb) { 00122 m_parserBlocked = pb; 00123 } 00124 00125 //-------------------------------------------------------------------------- 00133 //-------------------------------------------------------------------------- 00134 inline bool STILPattern::getParserBlocked() const { return m_parserBlocked; } 00135 00136 //-------------------------------------------------------------------------- 00144 //-------------------------------------------------------------------------- 00145 inline void STILPattern::setFlush(bool f) { 00146 m_flush = f; 00147 } 00148 00149 //-------------------------------------------------------------------------- 00157 //-------------------------------------------------------------------------- 00158 inline bool STILPattern::getFlush() const { return m_flush; } 00159 00160 00161 00162 #endif