Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_TableEntry.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_TABLEENTRY_H
11 #define TEUCHOS_TABLEENTRY_H
12 
22 #include "Teuchos_ConfigDefs.hpp"
23 #include "Teuchos_RCP.hpp"
24 #include "Teuchos_Array.hpp"
25 #include <iostream>
26 #include <iomanip>
27 
28 namespace Teuchos
29 {
37  class TableEntry
38  {
39  public:
42 
44  virtual ~TableEntry() {}
45 
47  virtual std::string toString() const = 0 ;
48 
56  virtual std::string toChoppedString(int maxWidth) const ;
57 
58  protected:
59  };
60 
61 
65  class DoubleEntry : public TableEntry
66  {
67  public:
70  DoubleEntry(const double& value, int precision, const std::ios_base::fmtflags& flags);
71 
73  virtual std::string toString() const ;
74 
75  private:
76  double data_;
78  std::ios_base::fmtflags fmtflags_;
79  };
80 
81 
85  class IntEntry : public TableEntry
86  {
87  public:
89  IntEntry(int value, const std::ios_base::fmtflags& flags);
90 
92  virtual std::string toString() const ;
93 
94  private:
95  int data_;
96  std::ios_base::fmtflags fmtflags_;
97  };
98 
99 
103  class StringEntry : public TableEntry
104  {
105  public:
107  StringEntry(std::string value);
108 
110  virtual std::string toString() const ;
111 
112  private:
113  std::string data_;
114  };
115 
126  {
127  public:
130  const RCP<TableEntry>& second,
131  bool spaceBeforeParens=true);
132 
134  virtual std::string toString() const ;
135 
136  private:
140  };
141 
142 
143 
144 
145 
146 }
147 #endif
virtual ~TableEntry()
virtual dtor
virtual std::string toString() const =0
Return a std::string representation of this entry.
An entry, perhaps compound, to be written into a table.
virtual std::string toChoppedString(int maxWidth) const
Return a std::string representation of this entry, truncated if necessary to fit within the given col...
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
std::ios_base::fmtflags fmtflags_
virtual std::string toString() const
Write the specified entry to a std::string.
std::ios_base::fmtflags fmtflags_
IntEntry(int value, const std::ios_base::fmtflags &flags)
Construct with a value.
A table entry that is a simple double-precision number.
A table entry that is a simple std::string.
virtual std::string toString() const
Write the specified entry to a std::string.
An entry containing two subentries, with the second to be written in parentheses after the first...
virtual std::string toString() const
Write the specified entry to a std::string.
Templated array class derived from the STL std::vector.
A table entry that is a simple integer.
virtual std::string toString() const
Write the specified entry to a std::string.
Smart reference counting pointer class for automatic garbage collection.
CompoundEntryWithParentheses(const RCP< TableEntry > &first, const RCP< TableEntry > &second, bool spaceBeforeParens=true)
DoubleEntry(const double &value, int precision, const std::ios_base::fmtflags &flags)
Construct with a value and a precision.
Reference-counted pointer class and non-member templated function implementations.
StringEntry(std::string value)
Construct with a value.