stdex
Additional templates and function helpers for Microsoft Active Template Library
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
stdex::idrec::record< T, T_ID, T_SIZE, ALIGN > Class Template Reference

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

Public Member Functions

 record (T &d)
 Constructs the class. More...
 
 record (const T &d)
 Constructs the class. More...
 
const record< T, T_ID, T_SIZE, ALIGN > & operator= (const record< T, T_ID, T_SIZE, ALIGN > &r)
 Assignment operator. More...
 

Static Public Member Functions

static std::streamoff open (std::ostream &stream)
 Writes record header. More...
 
static std::streamoff close (std::ostream &stream, std::streamoff start)
 Updates record header. More...
 
static bool find (std::istream &stream, std::streamoff end=(std::streamoff) -1)
 Finds record data. More...
 

Public Attributes

T & data
 Record data reference.
 

Static Public Attributes

static const T_ID id
 Record id.
 

Detailed Description

template<class T, class T_ID, class T_SIZE, unsigned int ALIGN>
class stdex::idrec::record< T, T_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 , class T_SIZE , unsigned int ALIGN>
stdex::idrec::record< T, T_ID, T_SIZE, ALIGN >::record ( T &  d)
inline

Constructs the class.

Parameters
[in]dReference to record data

◆ record() [2/2]

template<class T , class T_ID , class T_SIZE , unsigned int ALIGN>
stdex::idrec::record< T, T_ID, T_SIZE, ALIGN >::record ( const T &  d)
inline

Constructs the class.

Parameters
[in]dReference to record data

Member Function Documentation

◆ close()

template<class T , class T_ID , class T_SIZE , unsigned int ALIGN>
static std::streamoff stdex::idrec::record< T, T_ID, T_SIZE, ALIGN >::close ( std::ostream &  stream,
std::streamoff  start 
)
inlinestatic

Updates record header.

Parameters
[in]streamOutput stream
[in]startStart position of the record in stream
Returns
Position of the record end in stream

◆ find()

template<class T , class T_ID , class T_SIZE , unsigned int ALIGN>
static bool stdex::idrec::record< T, T_ID, T_SIZE, ALIGN >::find ( std::istream &  stream,
std::streamoff  end = (std::streamoff)-1 
)
inlinestatic

Finds record data.

Parameters
[in]streamInput stream
[in]endPosition limit. Default is -1 (no limit).
Returns
  • true when found
  • false otherwise

◆ open()

template<class T , class T_ID , class T_SIZE , unsigned int ALIGN>
static std::streamoff stdex::idrec::record< T, T_ID, T_SIZE, ALIGN >::open ( std::ostream &  stream)
inlinestatic

Writes record header.

Parameters
[in]streamOutput stream
Returns
Position of the record header start in stream. Save for later close call.

◆ operator=()

template<class T , class T_ID , class T_SIZE , unsigned int ALIGN>
const record< T, T_ID, T_SIZE, ALIGN > & stdex::idrec::record< T, T_ID, T_SIZE, ALIGN >::operator= ( const record< T, T_ID, T_SIZE, ALIGN > &  r)
inline

Assignment operator.

Parameters
[in]rSource record
Returns
A const reference to this struct

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