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 Container &c) |
FloatContainerFormatter & | operator() (const unsigned int p, const int w) |
FloatContainerFormatter & | operator() (Container &c, const unsigned int p, const int w) |
unsigned int | precision () const |
Access the current precision used by this formatter. More... | |
FloatContainerFormatter & | precision (const unsigned int p) |
Sets the precision format parameter. 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 79 of file common/formatters.hpp.
typedef Container::value_type ecl::formatters::FloatContainerFormatter< Container >::value_type |
Catches the container element's type.
Definition at line 94 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 102 of file common/formatters.hpp.
|
inlinevirtual |
Definition at line 112 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 205 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 159 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 148 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 173 of file common/formatters.hpp.
|
inline |
Access the current precision used by this formatter.
Returns the current precision setting.
Definition at line 140 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 122 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 133 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 228 of file common/formatters.hpp.
|
private |
Definition at line 202 of file common/formatters.hpp.
|
private |
Definition at line 201 of file common/formatters.hpp.
|
private |
Definition at line 198 of file common/formatters.hpp.
|
private |
Definition at line 199 of file common/formatters.hpp.
|
private |
Definition at line 203 of file common/formatters.hpp.
|
private |
Definition at line 199 of file common/formatters.hpp.
|
private |
Definition at line 200 of file common/formatters.hpp.