00001 /* -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*- */ 00002 /********************************************************************* 00003 * 00004 * Filename : print.h (dbm) 00005 * C/C++ header. 00006 * 00007 * This file is a part of the UPPAAL toolkit. 00008 * Copyright (c) 1995 - 2003, Uppsala University and Aalborg University. 00009 * All right reserved. 00010 * 00011 * $Id: print.h,v 1.4 2005/05/24 19:13:24 adavid Exp $ 00012 * 00013 **********************************************************************/ 00014 00015 #ifndef INCLUDE_DBM_PRINT_H 00016 #define INCLUDE_DBM_PRINT_H 00017 00018 #include <stdio.h> 00019 #include "dbm/constraints.h" 00020 00021 #ifdef __cplusplus 00022 00023 #include <iostream> 00024 00025 /** Pretty print of a DBM. 00026 * @param dbm: DBM. 00027 * @param dim: dimension. 00028 * @param out: output stream. 00029 */ 00030 std::ostream& dbm_cppPrint(std::ostream& out, const raw_t *dbm, cindex_t dim); 00031 00032 00033 /** Pretty print of the difference between 2 DBMs: 00034 * prints 2 DBMS with the difference in color. 00035 * If color printing is desactivated then the 00036 * differences are marked with *. 00037 * @param dbm1,dbm2: DBMs. 00038 * @param dim: dimension. 00039 * @param out: output stream. 00040 * @pre same dimension for both DBMs. 00041 */ 00042 std::ostream& dbm_cppPrintDiff(std::ostream& out, const raw_t *dbm1, const raw_t *dbm2, cindex_t dim); 00043 00044 00045 /** Pretty print of the difference between a DBM 00046 * and its closure: shows the updates that will be 00047 * done by the closure. 00048 * @param out: output stream. 00049 * @param dbm: the DBM. 00050 * @param dim: dimension. 00051 */ 00052 std::ostream& dbm_cppPrintCloseDiff(std::ostream& out, const raw_t *dbm, cindex_t dim); 00053 00054 00055 /** Pretty print of one clock constraint. 00056 * @param out: output stream. 00057 * @param c: the encoded constraint. 00058 */ 00059 std::ostream& dbm_cppPrintRaw(std::ostream& out, raw_t c); 00060 00061 00062 /** Pretty print of one clock bound. 00063 * @param out: output stream. 00064 * @param b: the decoded bound. 00065 */ 00066 std::ostream& dbm_cppPrintBound(std::ostream& out, int32_t b); 00067 00068 00069 /** Print a vector of constraints. 00070 * @param data: the vector of constraints 00071 * @param size: size of the vector. 00072 * @param out: where to print. 00073 * @pre data is a int32_t[size] 00074 */ 00075 std::ostream& dbm_cppPrintRaws(std::ostream& out, const raw_t *data, size_t size); 00076 00077 00078 /** Print a vector of bounds. 00079 * @param data: the vector of bounds. 00080 * @param size: size of the vector. 00081 * @param out: where to print. 00082 * @pre data is a int32_t[size] 00083 */ 00084 std::ostream& dbm_cppPrintBounds(std::ostream& out, const int32_t *data, size_t size); 00085 00086 00087 /** Print constraints. 00088 * @param c: constraints to print. 00089 * @param n: number of constraints 00090 */ 00091 std::ostream& dbm_cppPrintConstraints(std::ostream& out, const constraint_t *c, size_t n); 00092 00093 #ifndef INCLUDE_DBM_FED_H 00094 namespace dbm 00095 { 00096 class dbm_t; 00097 class fed_t; 00098 } 00099 #endif 00100 00101 /** Operator overload. 00102 * @param c: constraint to print. 00103 */ 00104 std::ostream& operator << (std::ostream& os, const constraint_t& c); 00105 00106 namespace dbm // Needed for unidentifed reason. 00107 { 00108 /** Operator overload. 00109 * @param dbm: DBM to print. 00110 */ 00111 std::ostream& operator << (std::ostream& os, const dbm::dbm_t& dbm); 00112 00113 /** Operator overload. 00114 * @param fed: federation to print. 00115 */ 00116 std::ostream& operator << (std::ostream& os, const dbm::fed_t& fed); 00117 } 00118 00119 extern "C" { 00120 00121 #endif 00122 00123 00124 /** Pretty print of a DBM. 00125 * @param dbm: DBM. 00126 * @param dim: dimension. 00127 * @param out: output stream. 00128 */ 00129 void dbm_print(FILE* out, const raw_t *dbm, cindex_t dim); 00130 00131 00132 /** Pretty print of the difference between 2 DBMs: 00133 * prints 2 DBMS with the difference in color. 00134 * If color printing is desactivated then the 00135 * differences are marked with *. 00136 * @param dbm1,dbm2: DBMs. 00137 * @param dim: dimension. 00138 * @param out: output stream. 00139 * @pre same dimension for both DBMs. 00140 */ 00141 void dbm_printDiff(FILE *out, const raw_t *dbm1, const raw_t *dbm2, cindex_t dim); 00142 00143 00144 /** Pretty print of the difference between a DBM 00145 * and its closure: shows the updates that will be 00146 * done by the closure. 00147 * @param out: output stream. 00148 * @param dbm: the DBM. 00149 * @param dim: dimension. 00150 */ 00151 void dbm_printCloseDiff(FILE *out, const raw_t *dbm, cindex_t dim); 00152 00153 00154 /** Pretty print of one clock constraint. 00155 * @param out: output stream. 00156 * @param c: the encoded constraint. 00157 */ 00158 void dbm_printRaw(FILE* out, raw_t c); 00159 00160 00161 /** Pretty print of one clock bound. 00162 * @param out: output stream. 00163 * @param b: the decoded bound. 00164 */ 00165 void dbm_printBound(FILE* out, int32_t b); 00166 00167 00168 /** Print a vector of constraints. 00169 * @param data: the vector of constraints 00170 * @param size: size of the vector. 00171 * @param out: where to print. 00172 * @pre data is a int32_t[size] 00173 */ 00174 void dbm_printRaws(FILE *out, const raw_t *data, size_t size); 00175 00176 00177 /** Print a vector of bounds. 00178 * @param data: the vector of bounds. 00179 * @param size: size of the vector. 00180 * @param out: where to print. 00181 * @pre data is a int32_t[size] 00182 */ 00183 void dbm_printBounds(FILE *out, const int32_t *data, size_t size); 00184 00185 00186 /** Print constraints. 00187 * @param n: number of constraints to print. 00188 * @param c: constraint. 00189 * @param out: where to print. 00190 */ 00191 void dbm_printConstraints(FILE *out, const constraint_t *c, size_t n); 00192 00193 00194 #ifdef __cplusplus 00195 } 00196 #endif 00197 00198 #endif /* INCLUDE_DBM_PRINT_H */