6 #ifndef ZEROBUF_VECTOR_H
7 #define ZEROBUF_VECTOR_H
9 #include <zerobuf/BaseVector.h>
31 void push_back(
const T& value );
33 {
return Super::_parent->template getDynamic< T >( Super::_index ); }
37 void _resize(
const size_t size )
38 { Super::_parent->updateAllocation( Super::_index, size ); }
39 void copyBuffer( uint8_t* data,
size_t size );
43 template<
class T >
inline
48 template<
class T >
inline
51 const size_t size_ = Super::_getSize();
52 const T* oldPtr = data();
53 T* newPtr =
reinterpret_cast< T*
>(
54 Super::_parent->updateAllocation( Super::_index, size_ +
sizeof( T )));
55 if( oldPtr != newPtr )
56 ::memcpy( newPtr, oldPtr, size_ );
58 newPtr[ size_ /
sizeof(T) ] = value;
61 template<
class T >
inline
62 void Vector< T >::copyBuffer( uint8_t* data_,
size_t size )
64 void* to = Super::_parent->updateAllocation( Super::_index, size );
65 ::memcpy( to, data_, size );
Allocator base class and interface.