uTL
micro Template library
utl::out_dev< impl_t, data_t, streamsize > Class Template Reference

Abstract base classes for output devices. More...

#include <out_dev.h>

Public Types

using type = out_dev_t
 Export type as identity meta-function. More...
 
using data_type = data_t
 
using pointer_type = data_t *
 

Public Member Functions

Common output device interface
size_t put (const data_t &data)
 Put interface. This function should send a single data_t object to device. More...
 
size_t put (const data_t *data, size_t n)
 Put interface. This function should send a stream of data_t objects to device. More...
 
Stream operator << interface
template<typename _Src_t >
out_dev_toperator<< (_Src_t &src)
 Template operator<< implementation for for all by value/ref parameters. More...
 
template<typename _Src_t >
out_dev_toperator<< (_Src_t *src)=delete
 Overload to disallow pointer types as source. More...
 
out_dev_toperator<< (const data_t &src)
 Overload for single data_t object. More...
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 

Protected Member Functions

Constructor / Destructor
 ~out_dev ()=default
 Allow destructor from derived only. More...
 
 out_dev ()=default
 A default constructor from derived only. More...
 
 out_dev (const out_dev_t &)=delete
 No copies. More...
 
out_dev_toperator= (const out_dev_t &)=delete
 

Private Types

using out_dev_t = out_dev< impl_t, data_t, streamsize >
 class type syntactic sugar More...
 

Private Member Functions

 _CRTP_IMPL (impl_t)
 
Common output device interface requirements
size_t put_ (const data_t &data)
 
size_t put_ (const data_t *data, size_t n)
 

STL-like Output iterator interface

using iterator = outdev_it< out_dev_t, data_t *, streamsize >
 Iterator. More...
 
using const_iterator = outdev_it< const out_dev_t, data_t *, streamsize >
 Const iterator. More...
 
iterator begin () noexcept
 .begin implementation More...
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 

Detailed Description

template<typename impl_t, typename data_t, size_t streamsize = 0>
class utl::out_dev< impl_t, data_t, streamsize >

Abstract base classes for output devices.

Template base class for output devices. using CRTP

This class force a common interface for output devices. By using this common interface the class implements

  • Stream-like inserting operator
  • Output iterator
  • Const output iterator to inherit to implementation.
Parameters
impl_tThe CRTP type (the derived/implementation class typename).
data_tThe devices base type of data
streamsizeThe number of elements to indicate eos.
  • None or 0 Stream only. No iterator as begin() now equals end().

Definition at line 54 of file out_dev.h.

Member Typedef Documentation

◆ const_iterator

template<typename impl_t , typename data_t , size_t streamsize = 0>
using utl::out_dev< impl_t, data_t, streamsize >::const_iterator = outdev_it <const out_dev_t, data_t*, streamsize>

Const iterator.

Definition at line 153 of file out_dev.h.

◆ data_type

template<typename impl_t , typename data_t , size_t streamsize = 0>
using utl::out_dev< impl_t, data_t, streamsize >::data_type = data_t

Export types as input device concept demands

Definition at line 61 of file out_dev.h.

◆ iterator

template<typename impl_t , typename data_t , size_t streamsize = 0>
using utl::out_dev< impl_t, data_t, streamsize >::iterator = outdev_it <out_dev_t, data_t*, streamsize>

Iterator.

Definition at line 152 of file out_dev.h.

◆ out_dev_t

template<typename impl_t , typename data_t , size_t streamsize = 0>
using utl::out_dev< impl_t, data_t, streamsize >::out_dev_t = out_dev <impl_t, data_t, streamsize>
private

class type syntactic sugar

Definition at line 56 of file out_dev.h.

◆ pointer_type

template<typename impl_t , typename data_t , size_t streamsize = 0>
using utl::out_dev< impl_t, data_t, streamsize >::pointer_type = data_t*

Definition at line 62 of file out_dev.h.

◆ type

template<typename impl_t , typename data_t , size_t streamsize = 0>
using utl::out_dev< impl_t, data_t, streamsize >::type = out_dev_t

Export type as identity meta-function.

Definition at line 64 of file out_dev.h.

Constructor & Destructor Documentation

◆ ~out_dev()

template<typename impl_t , typename data_t , size_t streamsize = 0>
utl::out_dev< impl_t, data_t, streamsize >::~out_dev ( )
protecteddefault

Allow destructor from derived only.

◆ out_dev() [1/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
utl::out_dev< impl_t, data_t, streamsize >::out_dev ( )
protecteddefault

A default constructor from derived only.

◆ out_dev() [2/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
utl::out_dev< impl_t, data_t, streamsize >::out_dev ( const out_dev_t )
protecteddelete

No copies.

Member Function Documentation

◆ _CRTP_IMPL()

template<typename impl_t , typename data_t , size_t streamsize = 0>
utl::out_dev< impl_t, data_t, streamsize >::_CRTP_IMPL ( impl_t  )
private

◆ begin() [1/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
iterator utl::out_dev< impl_t, data_t, streamsize >::begin ( )
inlinenoexcept

.begin implementation

Definition at line 156 of file out_dev.h.

◆ begin() [2/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
const_iterator utl::out_dev< impl_t, data_t, streamsize >::begin ( ) const
inlinenoexcept

Definition at line 157 of file out_dev.h.

◆ cbegin()

template<typename impl_t , typename data_t , size_t streamsize = 0>
const_iterator utl::out_dev< impl_t, data_t, streamsize >::cbegin ( ) const
inlinenoexcept

Definition at line 158 of file out_dev.h.

◆ cend()

template<typename impl_t , typename data_t , size_t streamsize = 0>
const_iterator utl::out_dev< impl_t, data_t, streamsize >::cend ( ) const
inlinenoexcept

Definition at line 163 of file out_dev.h.

◆ end() [1/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
iterator utl::out_dev< impl_t, data_t, streamsize >::end ( )
inlinenoexcept

.end implementation

Definition at line 161 of file out_dev.h.

◆ end() [2/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
const_iterator utl::out_dev< impl_t, data_t, streamsize >::end ( ) const
inlinenoexcept

Definition at line 162 of file out_dev.h.

◆ operator<<() [1/3]

template<typename impl_t , typename data_t , size_t streamsize = 0>
template<typename _Src_t >
out_dev_t& utl::out_dev< impl_t, data_t, streamsize >::operator<< ( _Src_t &  src)
inline

Template operator<< implementation for for all by value/ref parameters.

Note
In the case _Src_t size is not an exact multiple of data_t size the write data will be truncated and there may be data loss.
Parameters
srcReference to source data
Returns
Reference to this device for chaining

Definition at line 131 of file out_dev.h.

◆ operator<<() [2/3]

template<typename impl_t , typename data_t , size_t streamsize = 0>
template<typename _Src_t >
out_dev_t& utl::out_dev< impl_t, data_t, streamsize >::operator<< ( _Src_t *  src)
delete

Overload to disallow pointer types as source.

◆ operator<<() [3/3]

template<typename impl_t , typename data_t , size_t streamsize = 0>
out_dev_t& utl::out_dev< impl_t, data_t, streamsize >::operator<< ( const data_t &  src)
inline

Overload for single data_t object.

Definition at line 142 of file out_dev.h.

◆ operator=()

template<typename impl_t , typename data_t , size_t streamsize = 0>
out_dev_t& utl::out_dev< impl_t, data_t, streamsize >::operator= ( const out_dev_t )
protecteddelete

No copy assignments

◆ put() [1/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
size_t utl::out_dev< impl_t, data_t, streamsize >::put ( const data_t &  data)
inline

Put interface. This function should send a single data_t object to device.

Parameters
dataThe data to send
Returns
The number of transmitted data items
Note
A successful call should return 1

Definition at line 99 of file out_dev.h.

◆ put() [2/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
size_t utl::out_dev< impl_t, data_t, streamsize >::put ( const data_t *  data,
size_t  n 
)
inline

Put interface. This function should send a stream of data_t objects to device.

Parameters
dataPointer to buffer indenting write to device.
nThe number of data of type data_t to send
Returns
The number of transmitted items.

Definition at line 111 of file out_dev.h.

◆ put_() [1/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
size_t utl::out_dev< impl_t, data_t, streamsize >::put_ ( const data_t &  data)
inlineprivate

Definition at line 80 of file out_dev.h.

◆ put_() [2/2]

template<typename impl_t , typename data_t , size_t streamsize = 0>
size_t utl::out_dev< impl_t, data_t, streamsize >::put_ ( const data_t *  data,
size_t  n 
)
inlineprivate

Definition at line 81 of file out_dev.h.


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