Quick Links:

bal | bbl | bdl | bsl

Public Member Functions | Static Public Member Functions

balm::MetricFormatSpec Class Reference

#include <balm_metricformat.h>

List of all members.

Public Member Functions

 MetricFormatSpec ()
 MetricFormatSpec (float scale, const char *format)
 MetricFormatSpec (const MetricFormatSpec &original)
MetricFormatSpecoperator= (const MetricFormatSpec &rhs)
void setScale (float scale)
void setFormat (const char *format)
float scale () const
const char * format () const
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=-1) const

Static Public Member Functions

static bsl::ostream & formatValue (bsl::ostream &stream, double value, const MetricFormatSpec &format)

Detailed Description

This class provides a value-semantic representation of the formatting specification for a metric aggregate value. The scale() is a multiplier used to scale the numeric value. The format() is a printf-style format string suitable for formatting a single floating-point value.

See Component balm_metricformat


Constructor & Destructor Documentation

balm::MetricFormatSpec::MetricFormatSpec (  ) 

Create a metric format spec having default values for scale and format. The default value for scale is 1.0 and the default value for format is "%f".

balm::MetricFormatSpec::MetricFormatSpec ( float  scale,
const char *  format 
)

Create a metric format spec having the specified scale and format. The scale indicates the multiplier that may be used when formatting values, and format must be a printf-style format string for formatting a single floating-point value. The behavior is undefined unless format is null-terminated, contains a printf-style format string valid for a single floating-point value, and remains valid and unmodified for the lifetime of this object.

balm::MetricFormatSpec::MetricFormatSpec ( const MetricFormatSpec original  ) 

Create a metric format spec having the same value as the specified original format spec. The behavior is undefined unless original.format() remains valid and unmodified for the lifetime of this object.


Member Function Documentation

static bsl::ostream& balm::MetricFormatSpec::formatValue ( bsl::ostream &  stream,
double  value,
const MetricFormatSpec format 
) [static]

Write the specified value to the specified stream using the specified format, and return a reference to the modifiable stream.

MetricFormatSpec& balm::MetricFormatSpec::operator= ( const MetricFormatSpec rhs  ) 

Assign to this format spec the value of the specified rhs format spec, and return a reference to this modifiable format spec.

void balm::MetricFormatSpec::setScale ( float  scale  ) 

Set, to the specified scale, the scale multiplier that may be applied when formatting values.

void balm::MetricFormatSpec::setFormat ( const char *  format  ) 

Set, to the specified format, the printf-style formatting string that may be applied when formatting values. The behavior is undefined unless format is null-terminated, contains a printf-style format string valid for a single floating-point value, and remains valid and unmodified for the lifetime of this object.

float balm::MetricFormatSpec::scale (  )  const

Return the floating-point multiplier value that may be applied to scale formatted values.

const char* balm::MetricFormatSpec::format (  )  const

Return the address of the null-terminated string containing the printf-style format that may be used to format values.

bsl::ostream& balm::MetricFormatSpec::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = -1 
) const

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.


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