Tide 0.1.0
Public Member Functions | Protected Member Functions | Protected Attributes

tide::FloatElement Class Reference

Float primitive element. More...

#include <tide/float_element.h>

Inheritance diagram for tide::FloatElement:
Inheritance graph
[legend]
Collaboration diagram for tide::FloatElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FloatElement (uint32_t id, double value, EBMLFloatPrec precision=EBML_FLOAT_PREC_DOUBLE)
 Create a new float element with no default.
 FloatElement (uint32_t id, double value, double default_value, EBMLFloatPrec precision=EBML_FLOAT_PREC_DOUBLE)
 Create a new float element with a default value.
virtual FloatElementoperator= (double const &rhs)
 Value assignment operator.
virtual EBMLFloatPrec precision () const
 Get the precision setting.
virtual void precision (EBMLFloatPrec precision)
 Set the precision setting.
virtual std::streamsize write_body (std::ostream &output)
 Element body writing.

Protected Member Functions

virtual std::streamsize body_size () const
 Get the size of the body of this element.
virtual std::streamsize read_body (std::istream &input, std::streamsize size)
 Element body loading.

Protected Attributes

EBMLFloatPrec prec_

Detailed Description

Float primitive element.

This element stores an IEEE floating-point number. 4-byte and 8-byte floats are allowed.

Definition at line 53 of file float_element.h.


Constructor & Destructor Documentation

tide::FloatElement::FloatElement ( uint32_t  id,
double  value,
EBMLFloatPrec  precision = EBML_FLOAT_PREC_DOUBLE 
)

Create a new float element with no default.

Parameters:
[in]idThe element's ID, as an unsigned integer up to 28 bits.
[in]valueThe element's value.
[in]precisionThe element's precision, single or double. This only has an effect when writing the float to file.
tide::FloatElement::FloatElement ( uint32_t  id,
double  value,
double  default_value,
EBMLFloatPrec  precision = EBML_FLOAT_PREC_DOUBLE 
)

Create a new float element with a default value.

Parameters:
[in]idThe element's ID, as an unsigned integer up to 28 bits.
[in]valueThe element's value.
[in]precisionThe element's precision, single or double. This only has an effect when writing the float to a file.
[in]default_valueThe default value of the element.

Member Function Documentation

virtual std::streamsize tide::FloatElement::body_size ( ) const [protected, virtual]

Get the size of the body of this element.

Implements tide::Element.

virtual FloatElement& tide::FloatElement::operator= ( double const &  rhs) [virtual]

Value assignment operator.

Reimplemented from tide::PrimitiveElement< double >.

virtual EBMLFloatPrec tide::FloatElement::precision ( ) const [inline, virtual]

Get the precision setting.

Definition at line 83 of file float_element.h.

virtual void tide::FloatElement::precision ( EBMLFloatPrec  precision) [inline, virtual]

Set the precision setting.

This value determines if the float is single or double precision. The precision value has no effect until the float is written to a file, at which point single-precision floats are written using 4 bytes while double-precision floats are written using 8 bytes.

Definition at line 92 of file float_element.h.

virtual std::streamsize tide::FloatElement::read_body ( std::istream &  input,
std::streamsize  size 
) [protected, virtual]

Element body loading.

Exceptions:
BadElementLengthif the float element is an incorrect length (i.e. not 4 or 8 bytes).

Implements tide::Element.

virtual std::streamsize tide::FloatElement::write_body ( std::ostream &  output) [virtual]

Element body writing.

Implements tide::Element.


Member Data Documentation

Definition at line 99 of file float_element.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines