NCBI C++ ToolKit
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
CVectorWrap< T > Class Template Reference

Search Toolkit Book for CVectorWrap

A vector or pointer based sequence wrapper. More...

#include <algo/blast/dbindex/dbindex.hpp>

+ Inheritance diagram for CVectorWrap< T >:

Public Types

typedef const Tconst_iterator
 Iterator type pointing to const data. More...
 
Declarations forwarded from TVector.
typedef TVector::size_type size_type
 
typedef TVector::value_type value_type
 
typedef TVector::reference reference
 
typedef TVector::const_reference const_reference
 

Public Member Functions

 CVectorWrap (size_type sz=0, T v=T())
 Object constructor. More...
 
void SetPtr (T *base, size_type sz)
 Make the object hold an external sequence. More...
 
reference operator[] (size_type n)
 Indexing operator. More...
 
const_reference operator[] (size_type n) const
 Indexing operator. More...
 
void resize (size_type n, T v=T())
 Change the size of the sequence. More...
 
size_type size () const
 Get the sequence size. More...
 
const_iterator begin () const
 Get the start of the sequence. More...
 
const_iterator end () const
 Get the end of the sequence. More...
 

Private Types

typedef std::vector< TTVector
 Sequence type being wrapped. More...
 

Private Attributes

Tbase_
 Pointer to the first element of the sequence. More...
 
TVector data_
 std::vector object wrapped by this object. More...
 
bool vec_
 Flag indicating whether it is a wrapper or a holder of external sequence. More...
 
size_type size_
 Size of the external sequence. More...
 

Detailed Description

template<typename T>
class CVectorWrap< T >

A vector or pointer based sequence wrapper.

Serves as either a std::vector wrapper or holds a constant size sequence pointed to by an external pointer.

Definition at line 317 of file dbindex.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef const T* CVectorWrap< T >::const_iterator

Iterator type pointing to const data.

Definition at line 332 of file dbindex.hpp.

◆ const_reference

template<typename T >
typedef TVector::const_reference CVectorWrap< T >::const_reference

Definition at line 328 of file dbindex.hpp.

◆ reference

template<typename T >
typedef TVector::reference CVectorWrap< T >::reference

Definition at line 327 of file dbindex.hpp.

◆ size_type

template<typename T >
typedef TVector::size_type CVectorWrap< T >::size_type

Definition at line 325 of file dbindex.hpp.

◆ TVector

template<typename T >
typedef std::vector< T > CVectorWrap< T >::TVector
private

Sequence type being wrapped.

Definition at line 319 of file dbindex.hpp.

◆ value_type

template<typename T >
typedef TVector::value_type CVectorWrap< T >::value_type

Definition at line 326 of file dbindex.hpp.

Constructor & Destructor Documentation

◆ CVectorWrap()

template<typename T >
CVectorWrap< T >::CVectorWrap ( size_type  sz = 0,
T  v = T() 
)
inline

Object constructor.

Initializes the object as a std::vector wrapper.

Parameters
sz[I] initial size
v[I] initial element value

Definition at line 339 of file dbindex.hpp.

Member Function Documentation

◆ begin()

template<typename T >
const_iterator CVectorWrap< T >::begin ( ) const
inline

Get the start of the sequence.

Returns
iterator pointing to the beginning of the sequence.

Definition at line 390 of file dbindex.hpp.

Referenced by CSubjectMap::getRCIdOffByLIdOff(), and CSubjectMap::MapSubjOff().

◆ end()

template<typename T >
const_iterator CVectorWrap< T >::end ( ) const
inline

Get the end of the sequence.

Returns
iterator pointing to past the end of the sequence.

Definition at line 395 of file dbindex.hpp.

◆ operator[]() [1/2]

template<typename T >
reference CVectorWrap< T >::operator[] ( size_type  n)
inline

Indexing operator.

Parameters
n[I] index
Returns
reference to the n-th element

Definition at line 358 of file dbindex.hpp.

◆ operator[]() [2/2]

template<typename T >
const_reference CVectorWrap< T >::operator[] ( size_type  n) const
inline

Indexing operator.

Parameters
n[I] index
Returns
reference to constant value of the n-th element.

Definition at line 365 of file dbindex.hpp.

◆ resize()

template<typename T >
void CVectorWrap< T >::resize ( size_type  n,
T  v = T() 
)
inline

Change the size of the sequence.

Only works when the object holds a std::vector.

Parameters
n[I] new sequence size
v[I] initial value for newly created elements

Definition at line 373 of file dbindex.hpp.

◆ SetPtr()

template<typename T >
void CVectorWrap< T >::SetPtr ( T base,
size_type  sz 
)
inline

Make the object hold an external sequence.

Parameters
base[I] pointer to the external sequence
sz[I] size of the external sequence

Definition at line 347 of file dbindex.hpp.

Referenced by COffsetData< iterator_t >::COffsetData(), COffsetData_Base::COffsetData_Base(), CSubjectMap::CSubjectMap(), CSubjectMap::Load(), and CSubjectMap::SetSeqDataFromMap().

◆ size()

template<typename T >
size_type CVectorWrap< T >::size ( ) const
inline

Member Data Documentation

◆ base_

template<typename T >
T* CVectorWrap< T >::base_
private

◆ data_

template<typename T >
TVector CVectorWrap< T >::data_
private

std::vector object wrapped by this object.

Definition at line 401 of file dbindex.hpp.

Referenced by CVectorWrap< TWord >::CVectorWrap(), CVectorWrap< TWord >::end(), CVectorWrap< TWord >::resize(), and CVectorWrap< TWord >::size().

◆ size_

template<typename T >
size_type CVectorWrap< T >::size_
private

Size of the external sequence.

Definition at line 403 of file dbindex.hpp.

Referenced by CVectorWrap< TWord >::end(), CVectorWrap< TWord >::SetPtr(), and CVectorWrap< TWord >::size().

◆ vec_

template<typename T >
bool CVectorWrap< T >::vec_
private

Flag indicating whether it is a wrapper or a holder of external sequence.

Definition at line 402 of file dbindex.hpp.

Referenced by CVectorWrap< TWord >::end(), CVectorWrap< TWord >::resize(), CVectorWrap< TWord >::SetPtr(), and CVectorWrap< TWord >::size().


The documentation for this class was generated from the following file:
Modified on Fri Sep 20 14:57:11 2024 by modify_doxy.py rev. 669887