00001 /** @file UppaalInterpreter.h 00002 * @author Gabor Madl 00003 * @date Created 07/2005 00004 * @brief This interpreter generates Uppaal XML input from the DREAM models. 00005 * 00006 * 00007 * ================================================================= 00008 * DREAM License v2.0 00009 * 00010 * DREAM - Distributed Real-time Embedded Analysis Method 00011 * http://dre.sourceforge.net. 00012 * Copyright (c) 2005-2007 Gabor Madl, All Rights Reserved. 00013 * 00014 * This file is part of DREAM. 00015 * 00016 * DREAM is free software; you can redistribute it and/or modify it 00017 * under the terms of the GNU General Public License version 2 as 00018 * published by the Free Software Foundation. No future versions of 00019 * the GPL license may be automatically applied to DREAM. It is in 00020 * the sole discretion of the copyright holder to determine whether 00021 * DREAM may be released under a different license or terms. There 00022 * are no restrictions on the use of DREAM for any purpose. 00023 * 00024 * DREAM is distributed in the hope that it will be useful, 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00027 * GNU General Public License for more details. 00028 * 00029 * You should have received a copy of the GNU General Public License 00030 * along with this program; if not, write to the Free Software 00031 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00032 * MA 02110-1301, USA. 00033 * 00034 * By submitting comments, suggestions, code, code snippets, 00035 * techniques (including that of usage), and algorithms, submitters 00036 * acknowledge that they have the right to do so, that any such 00037 * submissions are given freely and unreservedly, and that they 00038 * waive any claims to copyright or ownership. In addition, 00039 * submitters acknowledge that any such submission might become 00040 * part of the copyright maintained on the overall body of code, 00041 * which comprises DREAM. By making a submission, submitter agrees 00042 * to these terms. Furthermore, submitters acknowledge that the 00043 * incorporation or modification of such submissions is entirely 00044 * at the discretion of the moderators of the DREAM project. 00045 * 00046 * DREAM links to the Libxml2 third party library. Please see 00047 * COPYING-libxml for the copyright information of Libxml2. 00048 * ================================================================= 00049 */ 00050 00051 #ifndef DREAM_UPPAALINTERPRETER 00052 #define DREAM_UPPAALINTERPRETER 00053 00054 #include "../core/System.h" 00055 00056 namespace DREAM 00057 { 00058 00059 /** The UppaalInterpreter class generates Uppaal XML input from the DREAM models. */ 00060 class UppaalInterpreter 00061 { 00062 public: 00063 /** Constructor. 00064 * @param system_ptr is the pointer to the system to be output. 00065 */ 00066 UppaalInterpreter (DREAM::System* system_ptr); 00067 00068 /** Destructor. */ 00069 ~UppaalInterpreter (); 00070 00071 /** Generates the Uppaal XML system description. 00072 * It uses the visitor pattern to get the data from the DREAM models. 00073 * @param outputFile specifies the output file to be generated. 00074 */ 00075 void visitor_uppaal (char* outputFile) 00076 #ifdef DREAM_ENHANCED_EXCEPTION_CHECKING 00077 throw (DREAM::Exception) 00078 #endif 00079 ; 00080 00081 /** Generates the Uppaal XML templates. It uses the visitor pattern to get the data from the DREAM models. 00082 * @param outputFile specifies the output file to be generated. 00083 */ 00084 void visitor_uppaaltemplate (char* outputFile) 00085 #ifdef DREAM_ENHANCED_EXCEPTION_CHECKING 00086 throw (DREAM::Exception) 00087 #endif 00088 ; 00089 00090 private: 00091 00092 /** Creates guard condition to model fixed-priority scheduling based on priorities. 00093 * @param node_map contains the Nodes in the Scheduler. 00094 * @param scheduler_id specifies the Scheduler id. 00095 * @param node is used to calculate the priority level used in the guard. 00096 */ 00097 std::string create_fixedpriority_guard (NODE_MAP* node_map, std::string scheduler_id, const DREAM::Node* const node) 00098 #ifdef DREAM_ENHANCED_EXCEPTION_CHECKING 00099 throw (DREAM::Exception) 00100 #endif 00101 ; 00102 00103 /** Determines whether the Task is the highest priority Task in the Scheduler. 00104 * Used to reduce state space caused by preemptions. 00105 * @param task_ptr is a pointer to the Task to be checked. 00106 * @return true if the Task is the highest priority Task in the Scheduler, false otherwise. 00107 */ 00108 bool highestpriority (DREAM::Node* task_ptr); 00109 00110 /** Determines whether the Task is the lowest priority Task in the Scheduler. 00111 * Used to reduce state space caused by preemptions. 00112 * @param task_ptr is a pointer to the Task to be checked. 00113 * @return true if the Task is the lowest priority Task in the Scheduler, false otherwise. 00114 */ 00115 bool lowestpriority (DREAM::Node* task_ptr); 00116 00117 /** Pointer to store the DREAM system */ 00118 DREAM::System* system_ptr_; 00119 00120 /** String storing the name of the generated file. */ 00121 std::string filename_; 00122 }; 00123 00124 }; 00125 00126 #endif 00127