Loading...
Searching...
No Matches
stdex::idrec::record< T, T_ID, ID, T_SIZE, 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, ALIGN > & | operator= (const record< T, T_ID, ID, T_SIZE, ALIGN > &r)
| Assignment operator.

## Static Public Member Functions

static const T_ID | id ()
| Returns record id.
static std::streamoff | open (std::ostream &stream)
| Writes record header.
static stdex::stream::foff_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::foff_t | close (stdex::stream::basic_file &stream, stdex::stream::foff_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::foff_t end=stdex::stream::foff_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, 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, ALIGN > r)
| Writes record to a file.
stdex::stream::basic & | operator<< (stdex::stream::basic &stream, const record< T, T_ID, ID, T_SIZE, ALIGN > r)
| Writes record to a stream.
std::istream & | operator>> (std::istream &stream, record< T, T_ID, ID, T_SIZE, ALIGN > r)
| Reads record from a stream.
stdex::stream::basic_file & | operator>> (stdex::stream::basic_file &stream, record< T, T_ID, ID, T_SIZE, ALIGN > r)
| Reads record from a file.
stdex::stream::basic & | operator>> (stdex::stream::basic &stream, record< T, T_ID, ID, T_SIZE, ALIGN > r)
| Reads record from a stream.

## Detailed Description

template<class T, class T_ID, const T_ID ID, class T_SIZE, T_SIZE ALIGN>
class stdex::idrec::record< T, T_ID, ID, T_SIZE, 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 ALIGN>

stdex::idrec::record< T, T_ID, ID, T_SIZE, 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 ALIGN>

stdex::idrec::record< T, T_ID, ID, T_SIZE, 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 ALIGN>

static std::streamoff stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::close | ( | std::ostream & | stream,
|  | std::streamoff | start
| ) |  |

inlinestatic

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 ALIGN>

static stdex::stream::foff_t stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::close | ( | stdex::stream::basic_file & | stream,
|  | stdex::stream::foff_t | start
| ) |  |

inlinestatic

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 ALIGN>

static bool stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::find | ( | std::istream & | stream,
|  | std::streamoff | end = `(std::streamoff)-1`
| ) |  |

inlinestatic

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 ALIGN>

static bool stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::find | ( | stdex::stream::basic_file & | stream,
|  | stdex::stream::foff_t | end = `stdex::stream::foff_max`
| ) |  |

inlinestatic

Finds record data.

Parameters

  [in] | stream | Input stream
  [in] | end | Position limit. Default is -1 (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 ALIGN>

static std::streamoff stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::open | ( | std::ostream & | stream | ) |

inlinestatic

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 ALIGN>

static stdex::stream::foff_t stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::open | ( | stdex::stream::basic_file & | stream | ) |

inlinestatic

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 ALIGN>

const record< T, T_ID, ID, T_SIZE, ALIGN > & stdex::idrec::record< T, T_ID, ID, T_SIZE, ALIGN >::operator= | ( | const record< T, T_ID, ID, T_SIZE, 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 ALIGN>

std::ostream & operator<< | ( | std::ostream & | stream,
|  | const record< T, T_ID, ID, T_SIZE, 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 ALIGN>

stdex::stream::basic & operator<< | ( | stdex::stream::basic & | stream,
|  | const record< T, T_ID, ID, T_SIZE, 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 ALIGN>

stdex::stream::basic_file & operator<< | ( | stdex::stream::basic_file & | stream,
|  | const record< T, T_ID, ID, T_SIZE, 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 ALIGN>

std::istream & operator>> | ( | std::istream & | stream,
|  | record< T, T_ID, ID, T_SIZE, 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 ALIGN>

stdex::stream::basic & operator>> | ( | stdex::stream::basic & | stream,
|  | record< T, T_ID, ID, T_SIZE, 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 ALIGN>

stdex::stream::basic_file & operator>> | ( | stdex::stream::basic_file & | stream,
|  | record< T, T_ID, ID, T_SIZE, 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