pantheios::real Class Reference
[Inserters]

#include <pantheios/inserters/real.hpp>

List of all members.


Detailed Description

Class for inserting floating-point types into Panthieos logging statements.

This class converts a floating-point variable into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement

  double      d   = 123.456;
  char        s[] = "abc";
  std::string str("def");

  pantheios::log(pantheios::notice, "s=", s, ", d=", pantheios::real(d), ", str=", str);

This will produce the output:

    s=abc, d=123.456, str=def

Note:
Currently, Pantheios does not support the insertion of floating-point types in logging statements, due to the various ambiguities inherent in the C++ language. (See chapters 14, 15, 19, 24 of Imperfect C++ for discussions of these issues.) It is possible that a future version of the library will be able to incorporate them directly, so long as that does not sacrifice Pantheios's central claim of not paying for what you don't use.
Examples:

cpp/example_cpp_real/example_cpp_real.cpp.


Public Types

typedef real class_type

Public Member Functions

 real (float value, int widthAndFormat=0)
 Construct from a float value.
 real (double value, int widthAndFormat=0)
 Construct from a double value.
 real (long double value, int widthAndFormat=0)
 Construct from a long double value.
char const * data () const
 A possibly non-nul-terminated non-null pointer to the c-style string representation of the floating-point number.
char const * c_str () const
 A nul-terminated non-null pointer to the c-style string representation of the floating-point number.
size_t length () const
 The length of the c-style string representation of the floating-point number.

Classes

union  u


Member Typedef Documentation

typedef real pantheios::real::class_type
 


Constructor & Destructor Documentation

pantheios::real::real float  value,
int  widthAndFormat = 0
[explicit]
 

Construct from a float value.

pantheios::real::real double  value,
int  widthAndFormat = 0
[explicit]
 

Construct from a double value.

pantheios::real::real long double  value,
int  widthAndFormat = 0
[explicit]
 

Construct from a long double value.


Member Function Documentation

char const* pantheios::real::c_str  )  const
 

A nul-terminated non-null pointer to the c-style string representation of the floating-point number.

char const* pantheios::real::data  )  const
 

A possibly non-nul-terminated non-null pointer to the c-style string representation of the floating-point number.

size_t pantheios::real::length  )  const
 

The length of the c-style string representation of the floating-point number.


The documentation for this class was generated from the following file:

pantheios Library documentation © Matthew Wilson, 2006 SourceForge.net Logo