00001 /* 00002 * Copyright (C) 2000 KOM/Darmstadt University of Technology 00003 * 00004 * This program is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU General Public License as published by the 00006 * Free Software Foundation; either version 2, or (at your option) any 00007 * later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00017 * USA. 00018 */ 00019 #ifndef V1_STATES_H 00020 #define V1_STATES_H 00021 00022 #include "MNdictionary.h" 00023 #include "MNList.h" 00024 #include "MNString.h" 00025 00026 class V1StateCollector; 00027 class V1StateVector; 00028 class V1StateVectorKeep; 00029 class V1StateElements; 00030 class V1StateKeep; 00031 class V1StateOther; 00032 class V1PartialState; 00033 class SignalParameter; 00034 00035 class V1Transition; 00036 class V2StateVector; 00037 00038 /*********************************************************************** 00039 * V1StateCollector 00040 ***********************************************************************/ 00041 00042 class V1StateCollector 00043 { 00044 MNList<V1StateVector*> _source; 00045 MNList<V1StateVector*> _target; 00046 V1StateVector* _initial; 00047 00048 public: 00049 V1StateCollector( ); 00050 00051 void v1appendSource( V1StateVector* v ); // verify not keep 00052 void v1appendTarget( V1StateVector* v ); // verify not generic, not complement, len==1 00053 void v1setInitial ( V1StateVector* v ); // verify both of the above 00054 00055 int v1getDimension( ); 00056 void v1resolveComplements( ); 00057 00058 V1StateVector* getInitial(); 00059 MNList<V1StateVector*>& getSources(); 00060 MNList<V1StateVector*>& getTargets(); 00061 }; 00062 00063 /*********************************************************************** 00064 * V1StateVector 00065 ***********************************************************************/ 00066 00067 class V1StateVector 00068 { 00069 MNList<V1StateElements*> _elements; 00070 V1Transition* _transition; 00071 int _first_line; 00072 bool _forbid; 00073 00074 protected: 00075 V1Transition* getTransition( ); 00076 00077 public: 00078 V1StateVector(); 00079 V1StateVector( V1StateVector& orig ); 00080 virtual ~V1StateVector() { } 00081 00082 virtual V1StateVector* clone(); 00083 00084 virtual bool keep(); 00085 virtual bool generic(); 00086 virtual bool complement(); 00087 00088 void appendElement( V1StateElements* e ); 00089 00090 virtual int size(); 00091 virtual void transform( int dimension, MNList<V2StateVector*>& out ); 00092 virtual void resolveComplements( ); 00093 00094 void addTransition( V1Transition* t ); 00095 void setFirstLine( int first_line ); 00096 int getFirstLine( ); 00097 void forbid( ); 00098 }; 00099 00100 /*********************************************************************** 00101 * V1StateVectorKeep 00102 ***********************************************************************/ 00103 00104 class V1StateVectorKeep : public V1StateVector 00105 { 00106 public: 00107 V1StateVectorKeep( int first_line ); 00108 V1StateVectorKeep( V1StateVectorKeep& orig ); 00109 00110 virtual V1StateVector* clone(); 00111 00112 virtual bool keep(); 00113 virtual bool generic(); 00114 virtual bool complement(); 00115 00116 virtual int size(); 00117 virtual void transform( int dimension, MNList<V2StateVector*>& out ); 00118 virtual void resolveComplements( ); 00119 }; 00120 00121 /*********************************************************************** 00122 * V1StateElements 00123 ***********************************************************************/ 00124 00125 class V1StateElements 00126 { 00127 bool _complement; 00128 MNList<V1PartialState*> _partialStates; 00129 int _partialStateIndex; 00130 00131 public: 00132 V1StateElements( ); 00133 V1StateElements( V1StateElements& orig ); 00134 virtual ~V1StateElements( ); 00135 00136 virtual V1StateElements* clone(); 00137 00138 virtual bool keep(); 00139 virtual bool generic(); 00140 virtual bool complement(); 00141 00142 void setComplement(); 00143 00144 void appendPartialState( V1PartialState* p ); 00145 int getPartialStateIndex(); 00146 void setPartialStateIndex( int idx ); 00147 00148 MNList<V1PartialState*>& getPartialStates(); 00149 00150 virtual void resolveComplements( ); 00151 virtual int getFirstLine( ); 00152 }; 00153 00154 /*********************************************************************** 00155 * V1StateKeep 00156 ***********************************************************************/ 00157 00158 class V1StateKeep : public V1StateElements 00159 { 00160 int _first_line; 00161 public: 00162 V1StateKeep( int first_line ); 00163 V1StateKeep( V1StateKeep& orig ); 00164 00165 virtual V1StateElements* clone(); 00166 00167 virtual bool keep(); 00168 virtual bool complement(); 00169 virtual int getFirstLine( ); 00170 }; 00171 00172 /*********************************************************************** 00173 * V1StateOther 00174 ***********************************************************************/ 00175 00176 class V1StateOther : public V1StateElements 00177 { 00178 int _first_line; 00179 public: 00180 V1StateOther( int first_line ); 00181 V1StateOther( V1StateOther& orig ); 00182 00183 virtual V1StateElements* clone(); 00184 00185 virtual bool generic(); 00186 virtual bool complement(); 00187 virtual int getFirstLine( ); 00188 }; 00189 00190 /*********************************************************************** 00191 * V1PartialState 00192 ***********************************************************************/ 00193 00194 class V1PartialState 00195 { 00196 int _name; 00197 int _ps_index; 00198 int _first_line; 00199 public: 00200 V1PartialState( int name, int first_line ); 00201 V1PartialState( V1PartialState& orig ); 00202 00203 virtual V1PartialState* clone(); 00204 00205 int getName( ); 00206 int getIndex( ); 00207 void setDimension( int idx ); 00208 int getFirstLine( ); 00209 }; 00210 00211 /*********************************************************************** 00212 * SignalParameterList 00213 ***********************************************************************/ 00214 00215 class SignalParameterList 00216 : public MNList<SignalParameter*> 00217 { 00218 bool _forceSyncCall; 00219 public: 00220 SignalParameterList(); 00221 00222 void setForceSyncCall( bool force ); 00223 bool isSyncCall( ); 00224 00225 MNString declaration( bool withLeadingComma ); 00226 MNString definition(); 00227 MNString use( bool withLeadingComma ); 00228 MNString classMembers(); 00229 MNString constructMembers(); 00230 MNString useMembers( bool withLeadingComma ); 00231 }; 00232 00233 /*********************************************************************** 00234 * SignalParameter 00235 ***********************************************************************/ 00236 00237 class SignalParameter 00238 { 00239 int _name; 00240 MNList<char*> _specifiers; 00241 00242 public: 00243 SignalParameter(); 00244 00245 void addSpecifier( char* c ); 00246 void setName( int n ); 00247 00248 MNString declaration(); 00249 MNString definition(); 00250 MNString use(); 00251 MNString classMembers(); 00252 MNString constructMembers(); 00253 MNString useMembers(); 00254 }; 00255 00256 #endif /* V1_STATES_H */ 00257