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

tide::PrimitiveElement< T > Class Template Reference

The primitive data element interface. More...

#include <tide/prim_element.h>

Inheritance diagram for tide::PrimitiveElement< T >:
Inheritance graph
[legend]
Collaboration diagram for tide::PrimitiveElement< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PrimitiveElement (uint32_t id, T value)
 Create a new element with no default.
 PrimitiveElement (uint32_t id, T value, T default_value)
 Create a signed integer element with a default value.
virtual PrimitiveElementoperator= (T const &rhs)
 Value assignment operator.
virtual uint32_t id () const
 Get the element's ID.
virtual void id (uint32_t id)
 Set the element's ID.
virtual T value () const
 Get the value.
virtual void value (T value)
 Set the value.
 operator T () const
 Cast to the stored type.
virtual bool has_default () const
 Check if a default value is set.
virtual T get_default () const
 Get the default value.
virtual void set_default (T default_value)
 Set the default value.
virtual T remove_default ()
 Remove the default value.
virtual bool is_default () const
 Check if this element is at the default value.

Protected Member Functions

virtual bool equal_ (PrimitiveElement< T > const &rhs)

Protected Attributes

value_
default_
bool has_default_

Friends

bool operator== (PrimitiveElement< T > const &lhs, PrimitiveElement< T > const &rhs)
 Equality operator.

Detailed Description

template<typename T>
class tide::PrimitiveElement< T >

The primitive data element interface.

Primitive elements store one of the EBML primitive data types. These are:

A default value can be specified for the element. If a default is given, it may allow the element to be skipped when writing to a store.

Any type specified for T must initialise itself upon construction, be copy-constructable, have an assignment operator, and perform its own clean-up in its destructor. POD types qualify for this.

Definition at line 65 of file prim_element.h.


Constructor & Destructor Documentation

template<typename T>
tide::PrimitiveElement< T >::PrimitiveElement ( uint32_t  id,
value 
) [inline]

Create a new element with no default.

Parameters:
[in]idThe element's ID, as an unsigned integer up to 28 bits.
[in]valueThe element's value.

Definition at line 75 of file prim_element.h.

template<typename T>
tide::PrimitiveElement< T >::PrimitiveElement ( uint32_t  id,
value,
default_value 
) [inline]

Create a signed integer 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]default_valueThe default value of the element.

Definition at line 88 of file prim_element.h.


Member Function Documentation

template<typename T>
virtual bool tide::PrimitiveElement< T >::equal_ ( PrimitiveElement< T > const &  rhs) [inline, protected, virtual]

Definition at line 168 of file prim_element.h.

template<typename T>
virtual T tide::PrimitiveElement< T >::get_default ( ) const [inline, virtual]

Get the default value.

Definition at line 132 of file prim_element.h.

template<typename T>
virtual bool tide::PrimitiveElement< T >::has_default ( ) const [inline, virtual]

Check if a default value is set.

Definition at line 130 of file prim_element.h.

template<typename T>
virtual uint32_t tide::PrimitiveElement< T >::id ( ) const [inline, virtual]

Get the element's ID.

Reimplemented from tide::Element.

Definition at line 102 of file prim_element.h.

template<typename T>
virtual void tide::PrimitiveElement< T >::id ( uint32_t  id) [inline, virtual]

Set the element's ID.

Parameters:
[in]idThe element's new ID, as an unsigned integer up to 28 bits.

Definition at line 109 of file prim_element.h.

template<typename T>
virtual bool tide::PrimitiveElement< T >::is_default ( ) const [inline, virtual]

Check if this element is at the default value.

If the current value is the same as the default value, this element may not need to be stored when being written.

Definition at line 153 of file prim_element.h.

template<typename T>
tide::PrimitiveElement< T >::operator T ( ) const [inline]

Cast to the stored type.

Definition at line 127 of file prim_element.h.

template<typename T>
virtual PrimitiveElement& tide::PrimitiveElement< T >::operator= ( T const &  rhs) [inline, virtual]

Value assignment operator.

Reimplemented in tide::BinaryElement, tide::DateElement, tide::FloatElement, tide::IntElement, tide::StringElement, and tide::UIntElement.

Definition at line 95 of file prim_element.h.

template<typename T>
virtual T tide::PrimitiveElement< T >::remove_default ( ) [inline, virtual]

Remove the default value.

Returns:
The value of the default that was removed.

Definition at line 143 of file prim_element.h.

template<typename T>
virtual void tide::PrimitiveElement< T >::set_default ( default_value) [inline, virtual]

Set the default value.

Definition at line 134 of file prim_element.h.

template<typename T>
virtual T tide::PrimitiveElement< T >::value ( ) const [inline, virtual]

Get the value.

Definition at line 123 of file prim_element.h.

template<typename T>
virtual void tide::PrimitiveElement< T >::value ( value) [inline, virtual]

Set the value.

Definition at line 125 of file prim_element.h.


Friends And Related Function Documentation

template<typename T>
bool operator== ( PrimitiveElement< T > const &  lhs,
PrimitiveElement< T > const &  rhs 
) [friend]

Equality operator.

Definition at line 157 of file prim_element.h.


Member Data Documentation

template<typename T>
T tide::PrimitiveElement< T >::default_ [protected]

Definition at line 165 of file prim_element.h.

template<typename T>
bool tide::PrimitiveElement< T >::has_default_ [protected]

Definition at line 166 of file prim_element.h.

template<typename T>
T tide::PrimitiveElement< T >::value_ [protected]

Definition at line 164 of file prim_element.h.


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