Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm::detail::vector< T, Allocator > Class Template Reference

#include <vector.hpp>

Inheritance diagram for sysio::vm::detail::vector< T, Allocator >:

Public Member Functions

constexpr vector (Allocator &allocator, size_t size=0)
 
constexpr vector (const vector &mv)=delete
 
constexpr vector (vector &&mv)=default
 
constexpr vectoroperator= (vector &&mv)=default
 
constexpr void resize (size_t size)
 
template<typename U , typename = std::enable_if_t<std::is_same_v<T, std::decay_t<U>>, int>>
constexpr void push_back (U &&val)
 
constexpr void emplace_back (T &&val)
 
constexpr void back ()
 
constexpr void pop_back ()
 
constexpr Tat (size_t i)
 
constexpr Tat (size_t i) const
 
constexpr Tat_no_check (size_t i)
 
constexpr Tat_no_check (size_t i) const
 
constexpr Toperator[] (size_t i) const
 
constexpr Toperator[] (size_t i)
 
constexpr Traw () const
 
constexpr size_t size () const
 
constexpr void set (T *data, size_t size, size_t index=-1)
 
constexpr void copy (T *data, size_t size)
 
constexpr vector (Allocator &allocator, size_t size=0)
 
constexpr vector (const vector &mv)=delete
 
constexpr vector (vector &&mv)=default
 
constexpr vectoroperator= (vector &&mv)=default
 
constexpr void resize (size_t size)
 
template<typename U , typename = std::enable_if_t<std::is_same_v<T, std::decay_t<U>>, int>>
constexpr void push_back (U &&val)
 
constexpr void emplace_back (T &&val)
 
constexpr void back ()
 
constexpr void pop_back ()
 
constexpr Tat (size_t i)
 
constexpr Tat (size_t i) const
 
constexpr Tat_no_check (size_t i)
 
constexpr Tat_no_check (size_t i) const
 
constexpr Toperator[] (size_t i) const
 
constexpr Toperator[] (size_t i)
 
constexpr Traw () const
 
constexpr size_t size () const
 
constexpr void set (T *data, size_t size, size_t index=-1)
 
constexpr void copy (T *data, size_t size)
 

Detailed Description

template<typename T, typename Allocator>
class sysio::vm::detail::vector< T, Allocator >

Definition at line 14 of file vector.hpp.

Constructor & Destructor Documentation

◆ vector() [1/6]

template<typename T , typename Allocator >
sysio::vm::detail::vector< T, Allocator >::vector ( Allocator & allocator,
size_t size = 0 )
inlineconstexpr

Definition at line 16 of file vector.hpp.

16 :
17 _size(size),
18 _allocator(&allocator),
19 _data(allocator.template alloc<T>( _size )) {
20 }
constexpr size_t size() const
Definition vector.hpp:78
bip::allocator< T, pinnable_mapped_file::segment_manager > allocator
Definition chainbase.hpp:56

◆ vector() [2/6]

template<typename T , typename Allocator >
sysio::vm::detail::vector< T, Allocator >::vector ( const vector< T, Allocator > & mv)
constexprdelete

◆ vector() [3/6]

template<typename T , typename Allocator >
sysio::vm::detail::vector< T, Allocator >::vector ( vector< T, Allocator > && mv)
constexprdefault

◆ vector() [4/6]

template<typename T , typename Allocator >
sysio::vm::detail::vector< T, Allocator >::vector ( Allocator & allocator,
size_t size = 0 )
inlineconstexpr

Definition at line 16 of file vector.hpp.

16 :
17 _size(size),
18 _allocator(&allocator),
19 _data(allocator.template alloc<T>( _size )) {
20 }

◆ vector() [5/6]

template<typename T , typename Allocator >
sysio::vm::detail::vector< T, Allocator >::vector ( const vector< T, Allocator > & mv)
constexprdelete

◆ vector() [6/6]

template<typename T , typename Allocator >
sysio::vm::detail::vector< T, Allocator >::vector ( vector< T, Allocator > && mv)
constexprdefault

Member Function Documentation

◆ at() [1/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at ( size_t i)
inlineconstexpr

Definition at line 57 of file vector.hpp.

57 {
58 SYS_VM_ASSERT( i < _size, wasm_vector_oob_exception, "vector read out of bounds" );
59 return _data[i];
60 }
#define SYS_VM_ASSERT(expr, exc_type, msg)
Definition exceptions.hpp:8
Here is the caller graph for this function:

◆ at() [2/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at ( size_t i)
inlineconstexpr

Definition at line 57 of file vector.hpp.

57 {
58 SYS_VM_ASSERT( i < _size, wasm_vector_oob_exception, "vector read out of bounds" );
59 return _data[i];
60 }

◆ at() [3/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at ( size_t i) const
inlineconstexpr

Definition at line 62 of file vector.hpp.

62 {
63 SYS_VM_ASSERT( i < _size, wasm_vector_oob_exception, "vector read out of bounds" );
64 return _data[i];
65 }

◆ at() [4/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at ( size_t i) const
inlineconstexpr

Definition at line 62 of file vector.hpp.

62 {
63 SYS_VM_ASSERT( i < _size, wasm_vector_oob_exception, "vector read out of bounds" );
64 return _data[i];
65 }

◆ at_no_check() [1/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at_no_check ( size_t i)
inlineconstexpr

Definition at line 67 of file vector.hpp.

67 {
68 return _data[i];
69 }

◆ at_no_check() [2/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at_no_check ( size_t i)
inlineconstexpr

Definition at line 67 of file vector.hpp.

67 {
68 return _data[i];
69 }

◆ at_no_check() [3/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at_no_check ( size_t i) const
inlineconstexpr

Definition at line 71 of file vector.hpp.

71 {
72 return _data[i];
73 }

◆ at_no_check() [4/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::at_no_check ( size_t i) const
inlineconstexpr

Definition at line 71 of file vector.hpp.

71 {
72 return _data[i];
73 }

◆ back() [1/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::back ( )
inlineconstexpr

Definition at line 48 of file vector.hpp.

48 {
49 return _data[_index];
50 }

◆ back() [2/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::back ( )
inlineconstexpr

Definition at line 48 of file vector.hpp.

48 {
49 return _data[_index];
50 }

◆ copy() [1/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::copy ( T * data,
size_t size )
inlineconstexpr

Definition at line 80 of file vector.hpp.

80 {
81 resize(size);
82 std::copy_n(data, size, _data);
83 _index = size-1;
84 }
constexpr void resize(size_t size)
Definition vector.hpp:26
Here is the call graph for this function:

◆ copy() [2/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::copy ( T * data,
size_t size )
inlineconstexpr

Definition at line 80 of file vector.hpp.

80 {
81 resize(size);
82 std::copy_n(data, size, _data);
83 _index = size-1;
84 }
Here is the call graph for this function:

◆ emplace_back() [1/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::emplace_back ( T && val)
inlineconstexpr

Definition at line 41 of file vector.hpp.

41 {
42 // if the vector is unbounded don't assert
43 if ( _index >= _size )
44 resize( _size * 2 );
45 _data[_index++] = std::move(val);
46 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ emplace_back() [2/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::emplace_back ( T && val)
inlineconstexpr

Definition at line 41 of file vector.hpp.

41 {
42 // if the vector is unbounded don't assert
43 if ( _index >= _size )
44 resize( _size * 2 );
45 _data[_index++] = std::move(val);
46 }
Here is the call graph for this function:

◆ operator=() [1/2]

template<typename T , typename Allocator >
vector & sysio::vm::detail::vector< T, Allocator >::operator= ( vector< T, Allocator > && mv)
constexprdefault

◆ operator=() [2/2]

template<typename T , typename Allocator >
vector & sysio::vm::detail::vector< T, Allocator >::operator= ( vector< T, Allocator > && mv)
constexprdefault

◆ operator[]() [1/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::operator[] ( size_t i)
inlineconstexpr

Definition at line 76 of file vector.hpp.

76{ return at(i); }
constexpr T & at(size_t i)
Definition vector.hpp:57
Here is the call graph for this function:

◆ operator[]() [2/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::operator[] ( size_t i)
inlineconstexpr

Definition at line 76 of file vector.hpp.

76{ return at(i); }
Here is the call graph for this function:

◆ operator[]() [3/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::operator[] ( size_t i) const
inlineconstexpr

Definition at line 75 of file vector.hpp.

75{ return at(i); }
Here is the call graph for this function:

◆ operator[]() [4/4]

template<typename T , typename Allocator >
T & sysio::vm::detail::vector< T, Allocator >::operator[] ( size_t i) const
inlineconstexpr

Definition at line 75 of file vector.hpp.

75{ return at(i); }
Here is the call graph for this function:

◆ pop_back() [1/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::pop_back ( )
inlineconstexpr

Definition at line 52 of file vector.hpp.

52 {
53 SYS_VM_ASSERT( _index >= 0, wasm_vector_oob_exception, "vector pop out of bounds" );
54 _index--;
55 }

◆ pop_back() [2/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::pop_back ( )
inlineconstexpr

Definition at line 52 of file vector.hpp.

52 {
53 SYS_VM_ASSERT( _index >= 0, wasm_vector_oob_exception, "vector pop out of bounds" );
54 _index--;
55 }

◆ push_back() [1/2]

template<typename T , typename Allocator >
template<typename U , typename = std::enable_if_t<std::is_same_v<T, std::decay_t<U>>, int>>
void sysio::vm::detail::vector< T, Allocator >::push_back ( U && val)
inlineconstexpr

Definition at line 35 of file vector.hpp.

35 {
36 // if the vector is unbounded don't assert
37 if ( _index >= _size )
38 resize( _size * 2 );
39 _data[_index++] = std::forward<U>(val);
40 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_back() [2/2]

template<typename T , typename Allocator >
template<typename U , typename = std::enable_if_t<std::is_same_v<T, std::decay_t<U>>, int>>
void sysio::vm::detail::vector< T, Allocator >::push_back ( U && val)
inlineconstexpr

Definition at line 35 of file vector.hpp.

35 {
36 // if the vector is unbounded don't assert
37 if ( _index >= _size )
38 resize( _size * 2 );
39 _data[_index++] = std::forward<U>(val);
40 }
Here is the call graph for this function:

◆ raw() [1/2]

template<typename T , typename Allocator >
T * sysio::vm::detail::vector< T, Allocator >::raw ( ) const
inlineconstexpr

Definition at line 77 of file vector.hpp.

77{ return _data; }

◆ raw() [2/2]

template<typename T , typename Allocator >
T * sysio::vm::detail::vector< T, Allocator >::raw ( ) const
inlineconstexpr

Definition at line 77 of file vector.hpp.

77{ return _data; }

◆ resize() [1/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::resize ( size_t size)
inlineconstexpr

Definition at line 26 of file vector.hpp.

26 {
27 if (size > _size) {
28 _data = _allocator->template alloc<T>( size );
29 } else {
30 _allocator->template reclaim<T>( _data + size, _size - size );
31 }
32 _size = size;
33 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize() [2/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::resize ( size_t size)
inlineconstexpr

Definition at line 26 of file vector.hpp.

26 {
27 if (size > _size) {
28 _data = _allocator->template alloc<T>( size );
29 } else {
30 _allocator->template reclaim<T>( _data + size, _size - size );
31 }
32 _size = size;
33 }
Here is the call graph for this function:

◆ set() [1/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::set ( T * data,
size_t size,
size_t index = -1 )
inlineconstexpr

Definition at line 79 of file vector.hpp.

79{ _size = size; _data = data; _index = index == -1 ? size - 1 : index; }
Here is the call graph for this function:

◆ set() [2/2]

template<typename T , typename Allocator >
void sysio::vm::detail::vector< T, Allocator >::set ( T * data,
size_t size,
size_t index = -1 )
inlineconstexpr

Definition at line 79 of file vector.hpp.

79{ _size = size; _data = data; _index = index == -1 ? size - 1 : index; }
Here is the call graph for this function:

◆ size() [1/2]

template<typename T , typename Allocator >
size_t sysio::vm::detail::vector< T, Allocator >::size ( ) const
inlineconstexpr

Definition at line 78 of file vector.hpp.

78{ return _size; }
Here is the caller graph for this function:

◆ size() [2/2]

template<typename T , typename Allocator >
size_t sysio::vm::detail::vector< T, Allocator >::size ( ) const
inlineconstexpr

Definition at line 78 of file vector.hpp.

78{ return _size; }

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