AutoArray< X, Del > Class Template Reference
[Application Framework]

Search Toolkit Book for AutoArray

#include <ncbimisc.hpp>

Inheritance diagram for AutoArray< X, Del >:

Inheritance graph
[legend]
Collaboration diagram for AutoArray< X, Del >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class X, class Del = ArrayDeleter<X>>
class AutoArray< X, Del >

AutoArray --.

"AutoPtr" like class for using with arrays

vector<> template comes with a performance penalty, since it always initializes its content. This template is not a vector replacement, it's a version of AutoPtr<> tuned for array pointers. For convenience it defines array style access operator [] and size based contructor.

See also:
AutoPtr

Definition at line 558 of file ncbimisc.hpp.

Public Types

typedef X element_type
 Define element type.
typedef Del deleter_type
 Alias for template argument.

Public Member Functions

 AutoArray (size_t size)
 Construct the array using C++ new[] operator.
 AutoArray (element_type *p=0)
 AutoArray (element_type *p, const deleter_type &deleter)
 AutoArray (const AutoArray< X, Del > &p)
 ~AutoArray (void)
AutoArray< X, Del > & operator= (const AutoArray< X, Del > &p)
 Assignment operator.
AutoArray< X, Del > & operator= (element_type *p)
 Assignment operator.
 operator bool (void) const
element_typeget (void) const
 Get pointer.
element_typerelease (void)
 Release will release ownership of pointer to caller.
const element_typeoperator[] (size_t pos) const
 array style dereference (returns value)
element_typeoperator[] (size_t pos)
 array style dereference (returns reference)
void reset (element_type *p=0)
 Reset will delete old pointer, set content to new value, and accept ownership upon the new pointer.
void Swap (AutoPtr< X, Del > &a)

Private Member Functions

void operator< (bool) const
 Bool operator for use in if() clause.
void operator> (bool) const
void operator<= (bool) const
void operator>= (bool) const
void operator== (bool) const
void operator!= (bool) const
void operator+ (bool) const
void operator- (bool) const
element_typex_Release (void) const
 Release for const object.

Private Attributes

element_typem_Ptr
pair_base_member< deleter_type,
bool
m_Data
 State info.


Member Typedef Documentation

template<class X, class Del = ArrayDeleter<X>>
typedef Del AutoArray< X, Del >::deleter_type
 

Alias for template argument.

Definition at line 562 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
typedef X AutoArray< X, Del >::element_type
 

Define element type.

Definition at line 561 of file ncbimisc.hpp.


Constructor & Destructor Documentation

template<class X, class Del = ArrayDeleter<X>>
AutoArray< X, Del >::AutoArray size_t  size  )  [inline, explicit]
 

Construct the array using C++ new[] operator.

Note:
In this case you should use ArrayDeleter<> or compatible

Definition at line 568 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
AutoArray< X, Del >::AutoArray element_type p = 0  )  [inline, explicit]
 

Definition at line 572 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
AutoArray< X, Del >::AutoArray element_type p,
const deleter_type deleter
[inline]
 

Definition at line 576 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
AutoArray< X, Del >::AutoArray const AutoArray< X, Del > &  p  )  [inline]
 

Definition at line 581 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
AutoArray< X, Del >::~AutoArray void   )  [inline]
 

Definition at line 587 of file ncbimisc.hpp.


Member Function Documentation

template<class X, class Del = ArrayDeleter<X>>
element_type* AutoArray< X, Del >::get void   )  const [inline]
 

Get pointer.

Definition at line 613 of file ncbimisc.hpp.

Referenced by CBufferedLineReader::GetPosition(), CWigBufferedLineReader::GetPosition(), CBufferedLineReader::x_ReadBuffer(), and CWigBufferedLineReader::x_ReadBuffer().

template<class X, class Del = ArrayDeleter<X>>
AutoArray< X, Del >::operator bool void   )  const [inline]
 

Definition at line 610 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator!= bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator+ bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator- bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator< bool   )  const [private]
 

Bool operator for use in if() clause.

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator<= bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
AutoArray<X, Del>& AutoArray< X, Del >::operator= element_type p  )  [inline]
 

Assignment operator.

Definition at line 604 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
AutoArray<X, Del>& AutoArray< X, Del >::operator= const AutoArray< X, Del > &  p  )  [inline]
 

Assignment operator.

Definition at line 593 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator== bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator> bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::operator>= bool   )  const [private]
 

template<class X, class Del = ArrayDeleter<X>>
element_type& AutoArray< X, Del >::operator[] size_t  pos  )  [inline]
 

array style dereference (returns reference)

Definition at line 626 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
const element_type& AutoArray< X, Del >::operator[] size_t  pos  )  const [inline]
 

array style dereference (returns value)

Definition at line 623 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
element_type* AutoArray< X, Del >::release void   )  [inline]
 

Release will release ownership of pointer to caller.

Definition at line 616 of file ncbimisc.hpp.

Referenced by AutoArray< CS_INT >::reset().

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::reset element_type p = 0  )  [inline]
 

Reset will delete old pointer, set content to new value, and accept ownership upon the new pointer.

Definition at line 630 of file ncbimisc.hpp.

Referenced by AutoArray< CS_INT >::operator=(), and AutoArray< CS_INT >::~AutoArray().

template<class X, class Del = ArrayDeleter<X>>
void AutoArray< X, Del >::Swap AutoPtr< X, Del > &  a  )  [inline]
 

Definition at line 639 of file ncbimisc.hpp.

template<class X, class Del = ArrayDeleter<X>>
element_type* AutoArray< X, Del >::x_Release void   )  const [inline, private]
 

Release for const object.

Definition at line 647 of file ncbimisc.hpp.

Referenced by AutoArray< CS_INT >::AutoArray(), and AutoArray< CS_INT >::operator=().


Member Data Documentation

template<class X, class Del = ArrayDeleter<X>>
pair_base_member<deleter_type, bool> AutoArray< X, Del >::m_Data [mutable, private]
 

State info.

Definition at line 654 of file ncbimisc.hpp.

Referenced by AutoArray< CS_INT >::operator=(), AutoArray< CS_INT >::release(), and AutoArray< CS_INT >::reset().

template<class X, class Del = ArrayDeleter<X>>
element_type* AutoArray< X, Del >::m_Ptr [private]
 

Definition at line 653 of file ncbimisc.hpp.

Referenced by AutoArray< CS_INT >::AutoArray(), AutoArray< CS_INT >::get(), AutoArray< CS_INT >::operator[](), AutoArray< CS_INT >::release(), and AutoArray< CS_INT >::reset().


The documentation for this class was generated from the following file:
Generated on Mon Dec 7 09:49:25 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:22:19 2009 by modify_doxy.py rev. 173732