TRF Language Model
|
Dynamic array. More...
#include <wb-vector.h>
Public Member Functions | |
Array (int size=DEFAULE_VECTOR_SIZE) | |
constructor More... | |
Array (Array &array) | |
constructor More... | |
Array (T *pbuf, int n) | |
constructor More... | |
~Array () | |
destructor More... | |
T & | operator[] (int i) |
get the value at position i More... | |
void | SetNum (int n) |
Set Array number, to melloc enough memory. More... | |
int | GetNum () const |
Get Array number. More... | |
void | Add (T t) |
Add a value to the tail of array. More... | |
T & | Add () |
Add a value to the tail of array, example 'a.Add() = t'. More... | |
void | Add (Array< T > &a) |
Add a array to the tail of current array. More... | |
int | Find (T t) |
Find a value and return the position. More... | |
T & | End () |
Get the value at the tail of array. More... | |
void | Clean () |
Clean the array. Just set the top of array to -1 and donot release the memory. More... | |
void | Copy (const Array< T > &array) |
Copy the array to current array. More... | |
void | Copy (const T *pbuf, int n) |
Copy the array to current array. More... | |
void | MemCopy (Array< T > &array) |
using memcpy to copy a array. More... | |
void | operator= (const Array< T > &array) |
overload operator = More... | |
operator T* () | |
overload transite operator More... | |
void | Output (ostream &os) |
output the array More... | |
void | Input (istream &is) |
input the array More... | |
void | Insert (T t) |
insert a value. Avoid repeating More... | |
T | Sum () |
summate all the values in the array More... | |
T | Max (int &idx) |
Get the maximum value. More... | |
T | Min (int &idx) |
Get the minine value. More... | |
Public Member Functions inherited from wb::Vector< T > | |
Vector (int size=DEFAULE_VECTOR_SIZE) | |
constructor, do not init the memeory to zero. More... | |
~Vector () | |
desturctor More... | |
int | Size () const |
get the memory size More... | |
T * | GetBuffer (int i=0) const |
get the buffer pointer More... | |
T & | Get (int i) |
get the value at position i More... | |
int | Size2Bits (int size) |
Transform the size to bit. More... | |
void | Fill (T m) |
set all the values to m More... | |
void | Zero () |
Fill all the memory to ZERO. call 'memset'. More... | |
void | Copy (const Vector< T > &vector) |
Copy a vector to another, using '=' to set values. More... | |
void | MemCopy (Vector< T > &vector) |
Copy a vector to another, using 'memcpy' to set values. More... | |
void | BufferOutside (T *&p_pt) |
Set the buffer pointer to p_pt, and re-init the vector. More... | |
Public Attributes | |
int | m_nTop |
Record the top of the array. More... | |
Additional Inherited Members | |
Protected Attributes inherited from wb::Vector< T > | |
T * | m_pBuffer |
buffer pointer More... | |
int | m_nBits |
bit number of memory size More... | |
Dynamic array.
Definition at line 205 of file wb-vector.h.
|
inline |
constructor
Definition at line 211 of file wb-vector.h.
constructor
Definition at line 216 of file wb-vector.h.
constructor
Definition at line 218 of file wb-vector.h.
destructor
Definition at line 220 of file wb-vector.h.
|
inline |
Add a value to the tail of array.
Definition at line 242 of file wb-vector.h.
|
inline |
Add a value to the tail of array, example 'a.Add() = t'.
Definition at line 244 of file wb-vector.h.
Add a array to the tail of current array.
Definition at line 246 of file wb-vector.h.
|
inline |
Clean the array. Just set the top of array to -1 and donot release the memory.
Definition at line 258 of file wb-vector.h.
Copy the array to current array.
Definition at line 260 of file wb-vector.h.
|
inline |
Copy the array to current array.
Definition at line 266 of file wb-vector.h.
|
inline |
Get the value at the tail of array.
Definition at line 256 of file wb-vector.h.
|
inline |
Find a value and return the position.
Definition at line 248 of file wb-vector.h.
|
inline |
Get Array number.
Definition at line 240 of file wb-vector.h.
|
inline |
input the array
Definition at line 290 of file wb-vector.h.
|
inline |
insert a value. Avoid repeating
Definition at line 298 of file wb-vector.h.
|
inline |
Get the maximum value.
Definition at line 317 of file wb-vector.h.
using memcpy to copy a array.
Definition at line 273 of file wb-vector.h.
|
inline |
Get the minine value.
Definition at line 332 of file wb-vector.h.
|
inline |
overload transite operator
Definition at line 281 of file wb-vector.h.
overload operator =
Definition at line 279 of file wb-vector.h.
|
inline |
get the value at position i
Definition at line 222 of file wb-vector.h.
|
inline |
output the array
Definition at line 283 of file wb-vector.h.
|
inline |
Set Array number, to melloc enough memory.
Definition at line 238 of file wb-vector.h.
|
inline |
summate all the values in the array
Definition at line 308 of file wb-vector.h.
int wb::Array< T >::m_nTop |
Record the top of the array.
Definition at line 208 of file wb-vector.h.