TypeFuncs.h File Reference


Detailed Description

Templatized functions for various common type operations.

#include <support/SupportDefs.h>
#include <string.h>
#include <new>

Go to the source code of this file.

Generic Type Functions

template<class TYPE>
void BAssign (TYPE *to, const TYPE *from, size_t count)
template<class TYPE>
void BAssign (TYPE *to, const TYPE *from)
template<class TYPE>
int32_t BCompare (const TYPE &v1, const TYPE &v2)
template<class TYPE>
void BConstruct (TYPE *base, size_t count)
template<class TYPE>
void BConstruct (TYPE *base)
template<class TYPE>
void BCopy (TYPE *to, const TYPE *from, size_t count)
template<class TYPE>
void BCopy (TYPE *to, const TYPE *from)
template<class TYPE>
void BDestroy (TYPE *base, size_t count)
template<class TYPE>
void BDestroy (TYPE *base)
template<class TYPE>
bool BLessThan (const TYPE &v1, const TYPE &v2)
template<class TYPE>
void BMoveAfter (TYPE *to, TYPE *from, size_t count)
template<class TYPE>
void BMoveAfter (TYPE *to, TYPE *from)
template<class TYPE>
void BMoveBefore (TYPE *to, TYPE *from, size_t count)
template<class TYPE>
void BMoveBefore (TYPE *to, TYPE *from)
template<class TYPE>
void BReplicate (TYPE *to, const TYPE *protoElement, size_t count)
template<class TYPE>
void BReplicate (TYPE *to, const TYPE *protoElement)
template<class TYPE>
void BSwap (TYPE &v1, TYPE &v2)

Defines

#define B_IMPLEMENT_BASIC_TYPE_FUNCS(TYPE)
#define B_IMPLEMENT_SIMPLE_TYPE_FUNCS(TYPE)

Functions

template<class TYPE>
void BAssign (TYPE **to, TYPE *const *from, size_t count=1)
template<class TYPE>
void BConstruct (TYPE **base, size_t count=1)
template<class TYPE>
void BCopy (TYPE **to, TYPE *const *from, size_t count=1)
template<class TYPE>
void BDestroy (TYPE **base, size_t count=1)
template<class TYPE>
void BMoveAfter (TYPE **to, TYPE **from, size_t count=1)
template<class TYPE>
void BMoveBefore (TYPE **to, TYPE **from, size_t count=1)


Define Documentation

#define B_IMPLEMENT_BASIC_TYPE_FUNCS TYPE   ) 
 

Value:

inline void BConstruct(TYPE* base, size_t count)                                        \
    { (void)base; (void)count; }                                                        \
inline void BDestroy(TYPE* base, size_t count)                                          \
    { (void)base; (void)count; }                                                        \
inline void BCopy(TYPE* to, const TYPE* from, size_t count)                         \
    { if (count == 1) *to = *from; else memcpy(to, from, sizeof(TYPE)*count); }     \
inline void BReplicate(TYPE* to, const TYPE* protoElement, size_t count)                \
    { while (--count != (size_t)-1) { *to = *protoElement; to++; } }                    \
inline void BMoveBefore(TYPE* to, TYPE* from, size_t count)                         \
    { if (count == 1) *to = *from; else memmove(to, from, sizeof(TYPE)*count); }        \
inline void BMoveAfter(TYPE* to, TYPE* from, size_t count)                              \
    { if (count == 1) *to = *from; else memmove(to, from, sizeof(TYPE)*count); }        \
inline void BAssign(TYPE* to, const TYPE* from, size_t count)                           \
    { if (count == 1) *to = *from; else memcpy(to, from, sizeof(TYPE)*count); }     \

#define B_IMPLEMENT_SIMPLE_TYPE_FUNCS TYPE   ) 
 

Value:

inline void BMoveBefore(TYPE* to, TYPE* from, size_t count)                         \
    { memmove(to, from, sizeof(TYPE)*count); }                                          \
inline void BMoveAfter(TYPE* to, TYPE* from, size_t count)                              \
    { memmove(to, from, sizeof(TYPE)*count); }                                          \


Function Documentation

void BAssign TYPE **  to,
TYPE *const *  from,
size_t  count = 1
[inline]
 

void BAssign TYPE *  to,
const TYPE *  from,
size_t  count
[inline]
 

void BAssign TYPE *  to,
const TYPE *  from
[inline]
 

int32_t BCompare const TYPE &  v1,
const TYPE &  v2
[inline]
 

void BConstruct TYPE **  base,
size_t  count = 1
[inline]
 

void BConstruct TYPE *  base,
size_t  count
[inline]
 

void BConstruct TYPE *  base  )  [inline]
 

void BCopy TYPE **  to,
TYPE *const *  from,
size_t  count = 1
[inline]
 

void BCopy TYPE *  to,
const TYPE *  from,
size_t  count
[inline]
 

void BCopy TYPE *  to,
const TYPE *  from
[inline]
 

void BDestroy TYPE **  base,
size_t  count = 1
[inline]
 

void BDestroy TYPE *  base,
size_t  count
[inline]
 

void BDestroy TYPE *  base  )  [inline]
 

bool BLessThan const TYPE &  v1,
const TYPE &  v2
[inline]
 

void BMoveAfter TYPE **  to,
TYPE **  from,
size_t  count = 1
[inline]
 

void BMoveAfter TYPE *  to,
TYPE *  from,
size_t  count
[inline]
 

void BMoveAfter TYPE *  to,
TYPE *  from
[inline]
 

void BMoveBefore TYPE **  to,
TYPE **  from,
size_t  count = 1
[inline]
 

void BMoveBefore TYPE *  to,
TYPE *  from,
size_t  count
[inline]
 

void BMoveBefore TYPE *  to,
TYPE *  from
[inline]
 

void BReplicate TYPE *  to,
const TYPE *  protoElement,
size_t  count
[inline]
 

void BReplicate TYPE *  to,
const TYPE *  protoElement
[inline]
 

void BSwap TYPE &  v1,
TYPE &  v2
[inline]