pd_merge.h

Go to the documentation of this file.
00001 /** @file pd_merge.h  Attributes for pushdown automata states */
00002 
00003 
00004 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
00005 
00006    Copyright (C) 2013  Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
00007 
00008 */
00009 
00010 
00011 #ifndef FAUDES_PD_MERGE_H
00012 #define FAUDES_PD_MERGE_H
00013 
00014 #include "corefaudes.h"
00015 #include "pd_basics.h"
00016 namespace faudes {
00017  
00018   
00019 //forward declarations
00020 /*template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr> class TpdGenerator;
00021 class AttributePushdownState;
00022 class AttributePushdownGlobal;
00023 class AttributePushdownTransition;
00024 typedef TpdGenerator<AttributePushdownGlobal, AttributePushdownState, AttributeCFlags,AttributePushdownTransition>
00025   PushdownGenerator;*/
00026 
00027 /**
00028  * Abstract interface class for all kinds of items which can comprise a new state.
00029 * 
00030 *
00031 * 
00032 *
00033 * @ingroup PushdownPlugin
00034 * 
00035 * @section Overview
00036 *  Overview
00037 * 
00038 * @section Contents
00039 *  Contents
00040 */
00041 
00042 class MergeAbstract{
00043 
00044   public:
00045     
00046     /**
00047      * Generator which contains the contained items. In order to print information
00048      * about the contained items, the class needs a reference to the generator.
00049      */
00050     //PushdownGenerator* mpGen;
00051   
00052     /**
00053      * Write Method which is to be implemented by all inheriting classes. Writes the
00054      * contained items of which the states consists.
00055      * 
00056      * @param rTw
00057      *      TokenWriter
00058      * @param rLabel
00059      *      label
00060      */
00061     virtual void Write(TokenWriter& rTw, const std::string& rLabel) = 0;
00062     
00063 };// class MergeAbstract
00064 
00065 /**
00066  * Merge class which contains only states.
00067 * 
00068 *
00069 * 
00070 *
00071 * @ingroup PushdownPlugin
00072 * 
00073 * @section Overview
00074 *  Overview
00075 * 
00076 * @section Contents
00077 *  Contents
00078 */
00079 class MergeStates : public MergeAbstract{
00080 
00081   public:
00082   
00083   /** the contained states */
00084   std::vector<Idx> mStates;
00085   
00086   /**
00087    * Constructor.
00088    * 
00089    * @param states
00090    *        Vector of states. The vector must not be empty.
00091    */
00092   MergeStates(const std::vector<Idx>& states);
00093   //MergeStates(std::vector<Idx> states, PushdownGenerator* gen);
00094   
00095   /**
00096    * Writes the contained items.
00097    * @param rTw
00098    *        TokenWriter
00099    * @param rLabel
00100    *        label
00101    */
00102   void Write(TokenWriter& rTw, const std::string& rLabel);
00103   
00104   /**
00105    * Getter for States
00106    * 
00107    * @return
00108    *    mStates
00109    */
00110   std::vector<Idx> States() const { return mStates; }
00111   
00112 //   /**
00113 //    * Set the contained states.
00114 //    * 
00115 //    * @param states
00116 //    *        Vector of states. The vector must not be emtpy.
00117 //    */
00118 //   void Set(std::vector<Idx> states);
00119 };//class MergeStates
00120 
00121 /**
00122  * Merge class which contains one state and a string annotation.
00123 * 
00124 *
00125 * 
00126 *
00127 * @ingroup PushdownPlugin
00128 * 
00129 * @section Overview
00130 *  Overview
00131 * 
00132 * @section Contents
00133 *  Contents
00134 */
00135 class MergeStateAnnotation : public MergeAbstract{
00136 
00137   public:
00138   
00139   /** the contained state */
00140   Idx mState;
00141   /** the annotation */
00142   std::string mAnnotation;
00143   
00144   /**
00145    * Constructor.
00146    * 
00147    * @param state
00148    *        The state, which must not be empty
00149    * @param annotation
00150    *        The annotation
00151    */
00152   MergeStateAnnotation(const Idx state, const std::string& annotation);
00153   
00154   /**
00155    * Getter for State
00156    * 
00157    * @return
00158    *    mState
00159    */
00160   Idx State() const { return mState; }
00161   
00162     /**
00163    * Getter for annotation
00164    * 
00165    * @return
00166    *    mAnnotation
00167    */
00168   std::string Annotation() const { return mAnnotation; }
00169   
00170   /**
00171    * Writes the contained items.
00172    * @param rTw
00173    *        TokenWriter
00174    * @param rLabel
00175    *        label
00176    */
00177   void Write(TokenWriter& rTw, const std::string& rLabel);
00178   
00179 };//class MergeStateAnnotation
00180 
00181 /**
00182  * Merge class which contains one state and one event
00183 * 
00184 *
00185 * 
00186 *
00187 * @ingroup PushdownPlugin
00188 * 
00189 * @section Overview
00190 *  Overview
00191 * 
00192 * @section Contents
00193 *  Contents
00194 */
00195 class MergeStateEvent : public MergeAbstract{
00196 
00197   public:
00198   
00199   /** the contained state */
00200   Idx mState;
00201   /** the contained event*/
00202   Idx mEvent;
00203   
00204   /**
00205    * Constructor.
00206    * 
00207    * @param state
00208    *        The state, which must not be empty
00209    * @param event
00210    *        The event
00211    */
00212   MergeStateEvent(const Idx state, const Idx event);
00213   
00214   /**
00215    * Getter for State
00216    * 
00217    * @return
00218    *    mState
00219    */
00220   Idx State() const { return mState; }
00221   
00222     /**
00223    * Getter for event
00224    * 
00225    * @return
00226    *    mEvent
00227    */
00228   Idx Event() const { return mEvent; }
00229   
00230   /**
00231    * Writes the contained items.
00232    * @param rTw
00233    *        TokenWriter
00234    * @param rLabel
00235    *        label
00236    */
00237   void Write(TokenWriter& rTw, const std::string& rLabel);
00238   
00239 };//class MergeStateEvent
00240 
00241 
00242 /**
00243  * Merge class which contains one state, one stack symbol and a string annotation.
00244 * 
00245 *
00246 * 
00247 *
00248 * @ingroup PushdownPlugin
00249 * 
00250 * @section Overview
00251 *  Overview
00252 * 
00253 * @section Contents
00254 *  Contents
00255 */
00256 class MergeStateSplit : public MergeAbstract{
00257 
00258   public:
00259   
00260   /** the contained state */
00261   Idx mState;
00262   /** the stack symbol */
00263   Idx mSymbol;
00264   /** isHead */
00265   bool mIsHead;
00266   
00267   /**
00268    * Constructor for heads.
00269    * 
00270    * @param state
00271    *        The state, which must not be empty
00272    */
00273   MergeStateSplit(const Idx state);
00274   
00275   /**
00276    * Constructor for ears.
00277    * 
00278    * @param state
00279    *        The state, which must not be empty
00280    * @param symbol
00281    *        The stack symbol
00282    */
00283   MergeStateSplit(const Idx state, const Idx symbol);
00284   
00285   /**
00286    * Getter for State
00287    * 
00288    * @return
00289    *    mState
00290    */
00291   Idx State() const { return mState; }
00292   
00293   /**
00294    * Getter for symbol
00295    * 
00296    * @return
00297    *    mSymbol
00298    */
00299   Idx Symbol() const { return mSymbol; }
00300   
00301   /**
00302    * Getter for IsHead
00303    * 
00304    * @return
00305    *    mIsHead
00306    */
00307   bool IsHead() const { return mIsHead; }
00308   
00309   /**
00310    * Writes the contained items.
00311    * @param rTw
00312    *        TokenWriter
00313    * @param rLabel
00314    *        label
00315    */
00316   void Write(TokenWriter& rTw, const std::string& rLabel);
00317   
00318 };//class MergeStateSplit
00319 
00320 /**
00321  * Merge class which contains one transition
00322 * 
00323 *
00324 * 
00325 *
00326 * @ingroup PushdownPlugin
00327 * 
00328 * @section Overview
00329 *  Overview
00330 * 
00331 * @section Contents
00332 *  Contents
00333 */
00334 class MergeTransition : public MergeAbstract{
00335 
00336   public:
00337   
00338   /** the transition's start state, event, end state, pop symbols and push symbols */
00339   Idx mX1;
00340   Idx mEv;
00341   Idx mX2;
00342   std::vector<Idx> mPop;
00343   std::vector<Idx> mPush;
00344   
00345   /**
00346    * Constructor for heads.
00347    * 
00348    * @param x1
00349    *    start state
00350    * @param ev
00351    *    event
00352    * @param x2
00353    *    end state
00354    * @param pop
00355    *    pop stack symbols
00356    * @param push
00357    *    push stack symbols
00358    */
00359   MergeTransition(Idx x1, Idx ev, Idx x2, const std::vector<Idx>& pop, const std::vector<Idx>& push);
00360   
00361   /**
00362    * Getter for mX1
00363    * 
00364    * @return
00365    *    mX1
00366    */
00367   Idx X1() const { return mX1; }
00368   
00369   /**
00370    * Getter for mEv
00371    * 
00372    * @return
00373    *    mEv
00374    */
00375   Idx Ev() const { return mEv; }
00376   
00377   /**
00378    * Getter for mX2
00379    * 
00380    * @return
00381    *    mX2
00382    */
00383   Idx X2() const { return mX2; }
00384   
00385   /**
00386    * Getter for mPop
00387    * 
00388    * @return
00389    *    mPop
00390    */
00391   const std::vector<Idx>& Pop() const { return mPop; }
00392   
00393   /**
00394    * Getter for mPush
00395    * 
00396    * @return
00397    *    mPush
00398    */
00399   const std::vector<Idx>& Push() const { return mPush; }
00400   
00401   
00402   /**
00403    * Writes the contained items.
00404    * @param rTw
00405    *        TokenWriter
00406    * @param rLabel
00407    *        label
00408    */
00409   void Write(TokenWriter& rTw, const std::string& rLabel);
00410   
00411 };//class MergeTransition
00412 
00413 } // namespace faudes
00414 
00415 #endif

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen