pd_lang_k.hGo to the documentation of this file.00001 /** @file pd_lang_k.h Test class to derive strings from pushdown automata */ 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_LANG_K_H 00012 #define FAUDES_PD_LANG_K_H 00013 00014 #include "corefaudes.h" 00015 #include "pd_include.h" 00016 00017 00018 namespace faudes { 00019 00020 00021 /** 00022 * This class is used to find all words that can be found when traversing a maximum of 00023 * k transitions of a given generator. It is intended mainly for debugging purposes, 00024 * not for finding whole languages. 00025 * 00026 * Note: length k can include "empty" (lambda) strings 00027 * 00028 * 00029 * 00030 * 00031 * @ingroup PushdownPlugin 00032 * 00033 * @section Overview 00034 * Overview 00035 * 00036 * @section Contents 00037 * Contents 00038 */ 00039 00040 class LangK{ 00041 00042 public: 00043 00044 /** 00045 * Constructor 00046 * 00047 * @param gen 00048 * the generator 00049 */ 00050 LangK(const PushdownGenerator& gen) : pd(gen) {}; 00051 00052 /** 00053 * find all words that can be generated by traversing k transitions 00054 * 00055 * @param k 00056 * number of transitions to traverse 00057 * @param showStack 00058 * show stack while traversing, defaults to false 00059 */ 00060 std::set<std::string> FindLangK(uint k, bool showStack = false); 00061 00062 /** 00063 * Print the words that were found in the last execution of FindLangK 00064 */ 00065 void PrintWords(); 00066 00067 private: 00068 00069 /** storage for the words*/ 00070 std::set<std::string> words; 00071 /** the generator*/ 00072 const PushdownGenerator pd; 00073 /** maximum word length*/ 00074 uint k; 00075 00076 /** 00077 * Recursively traverse the generator and build new words until word length is k. 00078 * 00079 * @param i 00080 * Index of the current state 00081 * @param word 00082 * current word 00083 * @param stack 00084 * current stack 00085 * @param depth 00086 * current length 00087 * @param showStack 00088 * indicator whether to print the stack or not 00089 */ 00090 void Traverse(Idx i, std::string word, std::vector<Idx> stack, uint depth, bool showStack); 00091 00092 }; 00093 00094 } // namespace faudes 00095 00096 #endif libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |