Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

Output.hpp

Go to the documentation of this file.
00001 //
00002 //  file Output.hpp
00003 //  defines various output classes
00004 //
00005 
00006 #ifndef __Output__
00007 #define __Output__
00008 
00009 
00010 #include "Formula.hpp"
00011 
00012 
00013 // class ostream;
00014 class Literal;
00015 class LiteralList;
00016 class Clause;
00017 class Unit;
00018 class UnitList;
00019 class Refutation;
00020 
00021 
00022 
00023 // ****************** class Output, definition *************************
00024 
00039 enum OutputSyntax {
00040   TPTP = 0,       // the numbers should not be changed
00041   NATIVE = 1,     // they are used in some analogues of
00042   KIF = 2,        // virtual tables
00043   XML = 3,            // XML
00044   LATEX = 4       // must be the last one
00045 };
00046 
00047 
00051 class Output {
00052  public:
00053   // create an output
00054   static Output* create (OutputSyntax, ostream&);
00055 
00056   // constructors/destructors
00057   Output (OutputSyntax syntax, ostream& str);
00058 
00059   virtual void pretty (const Refutation&, int answerNumber) = 0;
00060   virtual void formula (const Formula&);
00061 
00062  protected:
00063   class Map; // defined in Output.cpp
00064   virtual void symbol (const Signature::Symbol*);
00065   void refutation (const Unit& goal, int indent, Map& map);
00066   void refutations (const UnitList& goal, int indent, Map& map);
00067   virtual void inference (const Unit& conclusion, int indent) = 0;
00068   virtual void connective (Formula::Connective);
00069   virtual void var (Var v);
00070   virtual void term (const Term&);
00071   virtual void terms (const TermList&);
00072   virtual void atom (const Atom&);
00073   virtual void literal (const Literal&);
00074   virtual void clause (const Clause&) = 0;
00075   virtual void clause (const Clause&, int indent) = 0;
00076   virtual void formula (const Formula&, int indent) = 0;
00077   void subformula (const Formula&, int indent, Formula::Connective outer);
00078   void subformula (const Formula&, Formula::Connective outer);
00079   void content (const Unit& unit); // print clause or formula from unit
00080   virtual void content (const Unit& unit, int indent);
00081   bool fitsInOneLine (const Formula&) const;
00082   static bool fitsInOneLine (const Formula&, int& limit);
00083   static bool parenthesesRequired (Formula::Connective inner, 
00084                                    Formula::Connective outer);
00085   void vars (const VarList&);
00086 
00087   // structure
00088   OutputSyntax _syntax;
00089   ostream& _stream;
00090 
00091   // printing various data types
00092   virtual void spaces (int times);
00093   void repeat (char character, int times);
00094 
00095   // virtual tables
00096   static int _oneLineLengthLimit [LATEX+1];
00097 }; // class Output
00098 
00099 
00100 class NativeOutput
00101   : public Output
00102 {
00103  public:
00104   NativeOutput (ostream&);
00105 
00106   // output functions
00107   void pretty (const Refutation&, int answerNumber);
00108 
00109  public:
00110   void inference (const Unit& conclusion, int indent);
00111   void clause (const Clause&);
00112   void clause (const Clause&, int indent);
00113   void formula (const Formula&, int indent);
00114   void formula (const Formula&);
00115   virtual void connective (Formula::Connective);
00116 };  // class NativeOutput
00117 
00118 
00119 class TPTPOutput
00120   : public Output
00121 {
00122  public:
00123   TPTPOutput (ostream&);
00124 
00125   // output functions
00126   void pretty (const Refutation&, int answerNumber);
00127 
00128  private:
00129   void inference (const Unit& conclusion, int indent);
00130   void clause (const Clause&);
00131   void clause (const Clause&, int indent);
00132   void formula (const Formula&);
00133   void formula (const Formula&, int indent);
00134 };  // class TPTPOutput
00135 
00136 
00137 class KIFOutput
00138   : public Output
00139 {
00140  public:
00141   KIFOutput (ostream&);
00142 
00143   // output functions
00144   void pretty (const Refutation&, int answerNumber);
00145 
00146  private:
00147   void inference (const Unit& conclusion, int indent);
00148   void content (const Unit& unit, int indent);
00149   void clause (const Clause&);
00150   void clause (const Clause&, int indent);
00151   void formula (const Formula&);
00152   void formula (const Formula&, int indent);
00153   void literal (const Literal&);
00154   void atom (const Atom&);
00155   void connective (Formula::Connective);
00156   void var (Var v);
00157   void terms (const TermList&);
00158   void term (const Term&);
00159 
00160   static int _connectivePrintLength[];
00161 };  // class KIFOutput
00162 
00163 
00167 class XMLOutput
00168   : public Output
00169 {
00170  public:
00171   XMLOutput (ostream&);
00172 
00173   // output functions
00174   void pretty (const Refutation&, int answerNumber);
00175 
00176  private:
00177   void inference (const Unit& conclusion, int indent);
00178   void content (const Unit& unit, int indent);
00179   void clause (const Clause&);
00180   void clause (const Clause&, int indent);
00181   void formula (const Formula&);
00182   void formula (const Formula&, int indent);
00183   void literal (const Literal&);
00184   void atom (const Atom&);
00185   void connective (Formula::Connective);
00186   void var (Var v);
00187   void terms (const TermList&);
00188   void term (const Term&);
00189 
00190   static int _connectivePrintLength[];
00191 };  // class XMLOutput
00192 
00193 
00194 class LaTeXOutput
00195   : public Output
00196 {
00197  public:
00198   LaTeXOutput (ostream&);
00199 
00200   // output functions
00201   void pretty (const Refutation&, int answerNumber);
00202 
00203  private:
00204   void symbol (const Signature::Symbol*);
00205   void inference (const Unit& conclusion, int indent);
00206   void clause (const Clause&);
00207   void literals (const LiteralList& lits);
00208   void literals (const LiteralList& lits, int indent);
00209   void clause (const Clause&, int indent);
00210   void formula (const Formula&, int indent);
00211   void formula (const Formula&);
00212   void connective (Formula::Connective);
00213   void var (Var v);
00214   void spaces (int times);
00215 };  // class LaTeXOutput
00216 
00217 
00218 // ***************** class Output, implementation ***************
00219 
00220 
00221 // for debugging only
00222 ostream& operator<< (ostream&, const Formula&);
00223 
00224 #endif // __Output__
00225 

Generated on Sat Jun 28 15:08:58 2003 for Vampire by doxygen 1.3.2