00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Teuchos: Common Tools Package 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef TEUCHOS_TABLEENTRY_H 00030 #define TEUCHOS_TABLEENTRY_H 00031 00041 #include "Teuchos_ConfigDefs.hpp" 00042 #include "Teuchos_RCP.hpp" 00043 #include "Teuchos_Array.hpp" 00044 #include <iostream> 00045 00046 namespace Teuchos 00047 { 00055 class TableEntry 00056 { 00057 public: 00059 TableEntry() {} 00060 00062 virtual ~TableEntry() {} 00063 00065 virtual std::string toString() const = 0 ; 00066 00074 virtual std::string toChoppedString(int maxWidth) const ; 00075 00076 protected: 00077 }; 00078 00079 00083 class DoubleEntry : public TableEntry 00084 { 00085 public: 00088 DoubleEntry(const double& value, int precision); 00089 00091 virtual std::string toString() const ; 00092 00093 private: 00094 double data_; 00095 int precision_; 00096 }; 00097 00098 00102 class IntEntry : public TableEntry 00103 { 00104 public: 00106 IntEntry(int value); 00107 00109 virtual std::string toString() const ; 00110 00111 private: 00112 int data_; 00113 }; 00114 00115 00119 class StringEntry : public TableEntry 00120 { 00121 public: 00123 StringEntry(std::string value); 00124 00126 virtual std::string toString() const ; 00127 00128 private: 00129 std::string data_; 00130 }; 00131 00141 class CompoundEntryWithParentheses : public TableEntry 00142 { 00143 public: 00145 CompoundEntryWithParentheses(const RCP<TableEntry>& first, 00146 const RCP<TableEntry>& second, 00147 bool spaceBeforeParens=true); 00148 00150 virtual std::string toString() const ; 00151 00152 private: 00153 RCP<TableEntry> first_; 00154 RCP<TableEntry> second_; 00155 bool spaceBeforeParens_; 00156 }; 00157 00158 00159 00160 00161 00162 } 00163 #endif