stdex Additional custom or not Standard C++ covered algorithms

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
stdex::idrec::record< T, T_id, ID, T_size, N_align > Class Template Reference

Helper class for read/write of records to/from memory. More...

`#include <stdex/idrec.hpp>`

## Public Member Functions
| record (T &d)
| Constructs the class.
| record (const T &d)
| Constructs the class.
const record< T, T_id, ID, T_size, N_align > & | operator= (const record< T, T_id, ID, T_size, N_align > &r)
| Assignment operator.

## Static Public Member Functions
static constexpr T_id | id ()
| Returns record id.
static std::streamoff | open (std::ostream &stream)
| Writes record header.
static stdex::stream::fpos_t | open (stdex::stream::basic_file &stream)
| Writes record header.
static std::streamoff | close (std::ostream &stream, std::streamoff start)
| Updates record header.
static stdex::stream::fpos_t | close (stdex::stream::basic_file &stream, stdex::stream::fpos_t start)
| Updates record header.
static bool | find (std::istream &stream, std::streamoff end=(std::streamoff) -1)
| Finds record data.
static bool | find (stdex::stream::basic_file &stream, stdex::stream::fpos_t end=stdex::stream::fpos_max)
| Finds record data.

## Public Attributes
T & | data
| Record data reference.

## Friends
std::ostream & | operator<< (std::ostream &stream, const record< T, T_id, ID, T_size, N_align > r)
| Writes record to a stream.
stdex::stream::basic_file & | operator<< (stdex::stream::basic_file &stream, const record< T, T_id, ID, T_size, N_align > r)
| Writes record to a file.
stdex::stream::basic & | operator<< (stdex::stream::basic &stream, const record< T, T_id, ID, T_size, N_align > r)
| Writes record to a stream.
std::istream & | operator>> (std::istream &stream, record< T, T_id, ID, T_size, N_align > r)
| Reads record from a stream.
stdex::stream::basic_file & | operator>> (stdex::stream::basic_file &stream, record< T, T_id, ID, T_size, N_align > r)
| Reads record from a file.
stdex::stream::basic & | operator>> (stdex::stream::basic &stream, record< T, T_id, ID, T_size, N_align > r)
| Reads record from a stream.

## Detailed Description

template<class T, class T_id, const T_id ID, class T_size, T_size N_align>
class stdex::idrec::record< T, T_id, ID, T_size, N_align >

Helper class for read/write of records to/from memory.

## Constructor & Destructor Documentation

## ◆ record() [1/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

stdex::idrec::record< T, T_id, ID, T_size, N_align >::record | ( | T & | d | ) |
| inline

Constructs the class.

Parameters

  [in] | d | Reference to record data

## ◆ record() [2/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

stdex::idrec::record< T, T_id, ID, T_size, N_align >::record | ( | const T & | d | ) |
| inline

Constructs the class.

Parameters

  [in] | d | Reference to record data

## Member Function Documentation

## ◆ close() [1/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

static std::streamoff stdex::idrec::record< T, T_id, ID, T_size, N_align >::close | ( | std::ostream & | stream,
|  | std::streamoff | start )
| inline static

Updates record header.

Parameters

  [in] | stream | Output stream
  [in] | start | Start position of the record in `stream`

Returns
  Position of the record end in `stream`

## ◆ close() [2/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

static stdex::stream::fpos_t stdex::idrec::record< T, T_id, ID, T_size, N_align >::close | ( | stdex::stream::basic_file & | stream,
|  | stdex::stream::fpos_t | start )
| inline static

Updates record header.

Parameters

  [in] | stream | Output stream
  [in] | start | Start position of the record in `stream`

Returns
  Position of the record end in `stream`

## ◆ find() [1/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

static bool stdex::idrec::record< T, T_id, ID, T_size, N_align >::find | ( | std::istream & | stream,
|  | std::streamoff | end = (std::streamoff)-1 )
| inline static

Finds record data.

Parameters

  [in] | stream | Input stream
  [in] | end | Position limit. Default is -1 (no limit).

Returns
  - `true` when found
  - `false` otherwise

## ◆ find() [2/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

static bool stdex::idrec::record< T, T_id, ID, T_size, N_align >::find | ( | stdex::stream::basic_file & | stream,
|  | stdex::stream::fpos_t | end = stdex::stream::fpos_max )
| inline static

Finds record data.

Parameters

  [in] | stream | Input stream
  [in] | end | Position limit. Default is stdex::stream::fpos_max (no limit).

Returns
  - `true` when found
  - `false` otherwise

## ◆ open() [1/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

static std::streamoff stdex::idrec::record< T, T_id, ID, T_size, N_align >::open | ( | std::ostream & | stream | ) |
| inline static

Writes record header.

Parameters

  [in] | stream | Output stream

Returns
  Position of the record header start in `stream`. Save for later `close` call.

## ◆ open() [2/2]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

static stdex::stream::fpos_t stdex::idrec::record< T, T_id, ID, T_size, N_align >::open | ( | stdex::stream::basic_file & | stream | ) |
| inline static

Writes record header.

Parameters

  [in] | stream | Output stream

Returns
  Position of the record header start in `stream`. Save for later `close` call.

## ◆ operator=()

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

const record< T, T_id, ID, T_size, N_align > & stdex::idrec::record< T, T_id, ID, T_size, N_align >::operator= | ( | const record< T, T_id, ID, T_size, N_align > & | r | ) |
| inline

Assignment operator.

Parameters

  [in] | r | Source record

Returns
  A const reference to this struct

## Friends And Related Symbol Documentation

## ◆ operator<< [1/3]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

std::ostream & operator<< | ( | std::ostream & | stream,
|  | const record< T, T_id, ID, T_size, N_align > | r )
| friend

Writes record to a stream.

Parameters

  [in] | stream | Output stream
  [in] | r | Record

Returns
  The stream `stream`

## ◆ operator<< [2/3]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

stdex::stream::basic & operator<< | ( | stdex::stream::basic & | stream,
|  | const record< T, T_id, ID, T_size, N_align > | r )
| friend

Writes record to a stream.

Parameters

  [in] | stream | Output stream
  [in] | r | Record

Returns
  The stream `stream`

## ◆ operator<< [3/3]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

stdex::stream::basic_file & operator<< | ( | stdex::stream::basic_file & | stream,
|  | const record< T, T_id, ID, T_size, N_align > | r )
| friend

Writes record to a file.

Parameters

  [in] | stream | Output file
  [in] | r | Record

Returns
  The stream `stream`

## ◆ operator>> [1/3]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

std::istream & operator>> | ( | std::istream & | stream,
|  | record< T, T_id, ID, T_size, N_align > | r )
| friend

Reads record from a stream.

Parameters

  [in] | stream | Input stream
  [out] | r | Record

Returns
  The stream `stream`

## ◆ operator>> [2/3]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

stdex::stream::basic & operator>> | ( | stdex::stream::basic & | stream,
|  | record< T, T_id, ID, T_size, N_align > | r )
| friend

Reads record from a stream.

Parameters

  [in] | stream | Input stream
  [out] | r | Record

Returns
  The stream `stream`

## ◆ operator>> [3/3]

template<class T , class T_id , const T_id ID, class T_size , T_size N_align>

stdex::stream::basic_file & operator>> | ( | stdex::stream::basic_file & | stream,
|  | record< T, T_id, ID, T_size, N_align > | r )
| friend

Reads record from a file.

Parameters

  [in] | stream | Input file
  [out] | r | Record

Returns
  The stream `stream`

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

- include/stdex/idrec.hpp