Fabcoin Core  0.16.2
P2P Digital Currency
Public Types | Public Member Functions | Private Attributes | List of all members
dev::vector_ref< _T > Class Template Reference

A modifiable reference to an existing object or vector in memory. More...

#include <vector_ref.h>

Collaboration diagram for dev::vector_ref< _T >:
[legend]

Public Types

using value_type = _T
 
using element_type = _T
 
using mutable_value_type = typename std::conditional< std::is_const< _T >::value, typename std::remove_const< _T >::type, _T >::type
 

Public Member Functions

 vector_ref ()
 
 vector_ref (_T *_data, size_t _count)
 Creates a new vector_ref to point to _count elements starting at _data. More...
 
 vector_ref (typename std::conditional< std::is_const< _T >::value, std::string const *, std::string * >::type _data)
 Creates a new vector_ref pointing to the data part of a string (given as pointer). More...
 
 vector_ref (typename std::conditional< std::is_const< _T >::value, std::vector< typename std::remove_const< _T >::type > const *, std::vector< _T > * >::type _data)
 Creates a new vector_ref pointing to the data part of a vector (given as pointer). More...
 
 vector_ref (typename std::conditional< std::is_const< _T >::value, std::string const &, std::string & >::type _data)
 Creates a new vector_ref pointing to the data part of a string (given as reference). More...
 
 operator bool () const
 
bool contentsEqual (std::vector< mutable_value_type > const &_c) const
 
std::vector< mutable_value_typetoVector () const
 
std::vector< unsigned char > toBytes () const
 
std::string toString () const
 
template<class _T2 >
 operator vector_ref< _T2 > () const
 
 operator vector_ref< _T const > () const
 
_T * data () const
 
size_t count () const
 
size_t size () const
 
bool empty () const
 
vector_ref< _T > next () const
 
vector_ref< _T > cropped (size_t _begin, size_t _count) const
 
vector_ref< _T > cropped (size_t _begin) const
 
void retarget (_T *_d, size_t _s)
 
void retarget (std::vector< _T > const &_t)
 
template<class T >
bool overlapsWith (vector_ref< T > _t) const
 
void copyTo (vector_ref< typename std::remove_const< _T >::type > _t) const
 Copies the contents of this vector_ref to the contents of _t, up to the max size of _t. More...
 
void populate (vector_ref< typename std::remove_const< _T >::type > _t) const
 Copies the contents of this vector_ref to the contents of _t, and zeros further trailing elements in _t. More...
 
void cleanse ()
 Securely overwrite the memory. More...
 
_T * begin ()
 
_T * end ()
 
_T const * begin () const
 
_T const * end () const
 
_T & operator[] (size_t _i)
 
_T const & operator[] (size_t _i) const
 
bool operator== (vector_ref< _T > const &_cmp) const
 
bool operator!= (vector_ref< _T > const &_cmp) const
 
void reset ()
 

Private Attributes

_T * m_data
 
size_t m_count
 

Detailed Description

template<class _T>
class dev::vector_ref< _T >

A modifiable reference to an existing object or vector in memory.

Definition at line 20 of file vector_ref.h.

Member Typedef Documentation

template<class _T>
using dev::vector_ref< _T >::element_type = _T

Definition at line 24 of file vector_ref.h.

template<class _T>
using dev::vector_ref< _T >::mutable_value_type = typename std::conditional<std::is_const<_T>::value, typename std::remove_const<_T>::type, _T>::type

Definition at line 25 of file vector_ref.h.

template<class _T>
using dev::vector_ref< _T >::value_type = _T

Definition at line 23 of file vector_ref.h.

Constructor & Destructor Documentation

template<class _T>
dev::vector_ref< _T >::vector_ref ( )
inline

Definition at line 29 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
dev::vector_ref< _T >::vector_ref ( _T *  _data,
size_t  _count 
)
inline

Creates a new vector_ref to point to _count elements starting at _data.

Definition at line 31 of file vector_ref.h.

template<class _T>
dev::vector_ref< _T >::vector_ref ( typename std::conditional< std::is_const< _T >::value, std::string const *, std::string * >::type  _data)
inline

Creates a new vector_ref pointing to the data part of a string (given as pointer).

Definition at line 33 of file vector_ref.h.

template<class _T>
dev::vector_ref< _T >::vector_ref ( typename std::conditional< std::is_const< _T >::value, std::vector< typename std::remove_const< _T >::type > const *, std::vector< _T > * >::type  _data)
inline

Creates a new vector_ref pointing to the data part of a vector (given as pointer).

Definition at line 35 of file vector_ref.h.

template<class _T>
dev::vector_ref< _T >::vector_ref ( typename std::conditional< std::is_const< _T >::value, std::string const &, std::string & >::type  _data)
inline

Creates a new vector_ref pointing to the data part of a string (given as reference).

Definition at line 37 of file vector_ref.h.

Member Function Documentation

template<class _T>
_T* dev::vector_ref< _T >::begin ( )
inline

Definition at line 93 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
_T const* dev::vector_ref< _T >::begin ( ) const
inline

Definition at line 95 of file vector_ref.h.

template<class _T>
void dev::vector_ref< _T >::cleanse ( )
inline

Securely overwrite the memory.

Note
adapted from OpenSSL's implementation.

Definition at line 74 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
bool dev::vector_ref< _T >::contentsEqual ( std::vector< mutable_value_type > const &  _c) const
inline

Definition at line 43 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
void dev::vector_ref< _T >::copyTo ( vector_ref< typename std::remove_const< _T >::type _t) const
inline

Copies the contents of this vector_ref to the contents of _t, up to the max size of _t.

Definition at line 69 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
size_t dev::vector_ref< _T >::count ( ) const
inline
Returns
the number of elements referenced (not necessarily number of bytes).

Definition at line 53 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
vector_ref<_T> dev::vector_ref< _T >::cropped ( size_t  _begin,
size_t  _count 
) const
inline
Returns
a new vector_ref which is a shifted and shortened view of the original data. If this goes out of bounds in any way, returns an empty vector_ref. If _count is ~size_t(0), extends the view to the end of the data.

Definition at line 62 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
vector_ref<_T> dev::vector_ref< _T >::cropped ( size_t  _begin) const
inline
Returns
a new vector_ref which is a shifted view of the original data (not going beyond it).

Definition at line 64 of file vector_ref.h.

template<class _T>
_T* dev::vector_ref< _T >::data ( ) const
inline

Definition at line 51 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
bool dev::vector_ref< _T >::empty ( ) const
inline

Definition at line 56 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
_T* dev::vector_ref< _T >::end ( )
inline

Definition at line 94 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
_T const* dev::vector_ref< _T >::end ( ) const
inline

Definition at line 96 of file vector_ref.h.

template<class _T>
vector_ref<_T> dev::vector_ref< _T >::next ( ) const
inline
Returns
a new vector_ref pointing at the next chunk of size() elements.

Definition at line 58 of file vector_ref.h.

template<class _T>
dev::vector_ref< _T >::operator bool ( ) const
inlineexplicit

Definition at line 41 of file vector_ref.h.

template<class _T>
dev::vector_ref< _T >::operator vector_ref< _T const > ( ) const
inline

Definition at line 49 of file vector_ref.h.

template<class _T>
template<class _T2 >
dev::vector_ref< _T >::operator vector_ref< _T2 > ( ) const
inlineexplicit

Definition at line 48 of file vector_ref.h.

template<class _T>
bool dev::vector_ref< _T >::operator!= ( vector_ref< _T > const &  _cmp) const
inline

Definition at line 102 of file vector_ref.h.

template<class _T>
bool dev::vector_ref< _T >::operator== ( vector_ref< _T > const &  _cmp) const
inline

Definition at line 101 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
_T& dev::vector_ref< _T >::operator[] ( size_t  _i)
inline

Definition at line 98 of file vector_ref.h.

template<class _T>
_T const& dev::vector_ref< _T >::operator[] ( size_t  _i) const
inline

Definition at line 99 of file vector_ref.h.

template<class _T>
template<class T >
bool dev::vector_ref< _T >::overlapsWith ( vector_ref< T _t) const
inline

Definition at line 67 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
void dev::vector_ref< _T >::populate ( vector_ref< typename std::remove_const< _T >::type _t) const
inline

Copies the contents of this vector_ref to the contents of _t, and zeros further trailing elements in _t.

Definition at line 71 of file vector_ref.h.

template<class _T>
void dev::vector_ref< _T >::reset ( )
inline

Definition at line 108 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
void dev::vector_ref< _T >::retarget ( _T *  _d,
size_t  _s 
)
inline

Definition at line 65 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
void dev::vector_ref< _T >::retarget ( std::vector< _T > const &  _t)
inline

Definition at line 66 of file vector_ref.h.

template<class _T>
size_t dev::vector_ref< _T >::size ( ) const
inline
Returns
the number of elements referenced (not necessarily number of bytes).

Definition at line 55 of file vector_ref.h.

template<class _T>
std::vector<unsigned char> dev::vector_ref< _T >::toBytes ( ) const
inline

Definition at line 45 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
std::string dev::vector_ref< _T >::toString ( ) const
inline

Definition at line 46 of file vector_ref.h.

Here is the caller graph for this function:

template<class _T>
std::vector<mutable_value_type> dev::vector_ref< _T >::toVector ( ) const
inline

Definition at line 44 of file vector_ref.h.

Here is the caller graph for this function:

Member Data Documentation

template<class _T>
size_t dev::vector_ref< _T >::m_count
private

Definition at line 112 of file vector_ref.h.

template<class _T>
_T* dev::vector_ref< _T >::m_data
private

Definition at line 111 of file vector_ref.h.


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