ArrayAppendCache< T > Class Template Reference

#include <streamconversion_impl_helper.h>

详细描述

template<typename T>
class maxon::ArrayAppendCache< T >

Helper to Append efficiently to WritableArrayInterface<> by caching several append calls and writing them back in blocks Without this caching mechanism calling Append directly can slow down by a factor of 4 or even more! Usage:

FastArrayAppend<UChar> dst(xdst); // xdst is the WritableArrayInterface of type UChar for ( auto ch : src ) { iferr (dst.Append(ch)) return err; } iferr (dst.Finalize()) // tell the FastArrayAppend that we are finished and remaning elements in the cache should be copied as well return err;

公共成员函数

MAXON_IMPLICIT   ArrayAppendCache ( WritableArrayInterface < Generic > &destination)
  ArrayAppendCache ()
MAXON_ATTRIBUTE_FORCE_INLINE Result < void >  Append (const T &ch)
MAXON_ATTRIBUTE_FORCE_INLINE Result < void >  Finalize ()
Int   GetCount () const

Private Attributes

Int   _tempPos
_tempArray [ DEFAULT_APPENDSIZE ]
WritableArrayInterface < T > *  _destination

构造函数 & 析构函数文档编制

◆  ArrayAppendCache() [1/2]

MAXON_IMPLICIT ArrayAppendCache ( WritableArrayInterface < Generic > &  destination )

◆  ArrayAppendCache() [2/2]

ArrayAppendCache ( )

成员函数文档编制

◆  Append()

MAXON_ATTRIBUTE_FORCE_INLINE Result <void> Append ( const T &  ch )

◆  Finalize()

MAXON_ATTRIBUTE_FORCE_INLINE Result <void> Finalize ( )

◆  GetCount()

Int GetCount ( ) const

Member Data Documentation

◆  _tempPos

Int _tempPos
private

◆  _tempArray

T _tempArray[ DEFAULT_APPENDSIZE ]
private

◆  _destination

WritableArrayInterface <T>* _destination
private
maxon::src
const T & src
定义: apibase.h:2525
iferr
#define iferr(...)
定义: errorbase.h:380