Parent interface for formatters of fixed size float/double containers. More...
#include <formatters.hpp>
Public Types | |
typedef Container::value_type | value_type |
Catches the container element's type. More... | |
Public Member Functions | |
FloatContainerFormatter (const unsigned int p=2, const int w=-1) | |
FloatContainerFormatter & | operator() (const unsigned int p, const int w) |
FloatContainerFormatter & | operator() (const Container &c) |
FloatContainerFormatter & | operator() (Container &c, const unsigned int p, const int w) |
FloatContainerFormatter & | precision (const unsigned int p) |
Sets the precision format parameter. More... | |
unsigned int | precision () const |
Access the current precision used by this formatter. More... | |
FloatContainerFormatter & | width (const int w) |
Sets the width format parameter. More... | |
virtual | ~FloatContainerFormatter () |
Private Member Functions | |
long | digits (value_type min_coeff, value_type max_coeff) |
Private Attributes | |
const Container * | container |
Format< value_type > | format |
int | old_precision |
int | prm_width |
bool | ready_to_format |
int | tmp_width |
int * | width_ptr |
Friends | |
template<typename OutputStream , typename Container_ > | |
OutputStream & | operator<< (OutputStream &ostream, FloatContainerFormatter< Container_ > &formatter) |
Insertion operator for sending the formatter to an output stream. More... | |
Parent interface for formatters of fixed size float/double containers.
This defines the common interface to be shared by fixed size float/double containers. It only allows configuration of width and precision to be used to format the elements of the container. Note that if the width is set to -1 (the default), this class automatically configures an appropriate width by scanning the elements within and setting it to the minimum width necessary to display all elements properly.
Do not use this class directly, rather call it via either the Container type or Format classes explicitly. This makes the code more readable. e.g.
Container | : the underlying fixed size float or double array. |
Note, the above don't link properly to the partial specialisations. Look for them in the ecl::formatters namespace.
Definition at line 67 of file common/formatters.hpp.
typedef Container::value_type ecl::formatters::FloatContainerFormatter< Container >::value_type |
Catches the container element's type.
Definition at line 72 of file common/formatters.hpp.
|
inline |
Constructor - can be used to define the precision required for the formatter's elements.
p | : the number of decimal places of precision [default : 2]. |
w | : width [default : no width constraint] |
Definition at line 80 of file common/formatters.hpp.
|
inlinevirtual |
Definition at line 90 of file common/formatters.hpp.
|
private |
Compute the integral width. This accepts the minimum and maximum values in the array from which a minimum width that provides a common width for every element in the array to be fully displayed is determined.
min_coeff | : the minimum value in the array. |
max_coeff | : the maximum value in the array. |
Definition at line 193 of file common/formatters.hpp.
|
inline |
Permanently sets the stream's precision format. This is simply a convenient version of the precision(p) method.
p | : the number of decimal places of precision. |
w | : the width to use for the inserted float. |
Definition at line 126 of file common/formatters.hpp.
|
inline |
Convenient stream formatter. This function directly readies the formatter with the specified container and the stored (permanent) settings.
c | : the input container to be formatted. |
Definition at line 137 of file common/formatters.hpp.
|
inline |
Convenient stream formatter. This function directly readies the formatter with the specified container and configures a temporary setting for the precision (one-shot).
c | : the input container to be formatted. |
p | : the number of decimal places of precision. |
w | : the width to use for the inserted float. |
Definition at line 151 of file common/formatters.hpp.
|
inline |
Sets the precision format parameter.
Use this to set the precision of the displayed output.
p | : the number of decimal places of precision. |
Definition at line 100 of file common/formatters.hpp.
|
inline |
Access the current precision used by this formatter.
Returns the current precision setting.
Definition at line 118 of file common/formatters.hpp.
|
inline |
Sets the width format parameter.
Use this to configure the width of the displayed output. The formatter can be instructed to automatically determine a width suitable for all elements by setting this value to -1.
w | : the width to use for the inserted float [-1 for automatic resizing of cells]. |
Definition at line 111 of file common/formatters.hpp.
|
friend |
Insertion operator for sending the formatter to an output stream.
ostream | : the output stream. |
formatter | : the formatter to be inserted. |
StandardException | : throws if the formatter is used multiply in one stream operation [debug mode only]. |
Definition at line 216 of file common/formatters.hpp.
|
private |
Definition at line 180 of file common/formatters.hpp.
|
private |
Definition at line 179 of file common/formatters.hpp.
|
private |
Definition at line 176 of file common/formatters.hpp.
|
private |
Definition at line 177 of file common/formatters.hpp.
|
private |
Definition at line 181 of file common/formatters.hpp.
|
private |
Definition at line 177 of file common/formatters.hpp.
|
private |
Definition at line 178 of file common/formatters.hpp.