PLearn 0.1
|
#include <Array_decl.h>
Public Types | |
typedef T * | iterator |
Public Member Functions | |
Array (int the_size=0, int extra_space=10) | |
Array (const T &elem1) | |
Array (const T &elem1, const T &elem2) | |
Array (const Array< T > &other) | |
Array (const TVec< T > &other) | |
Array (const vector< T > &other) | |
operator bool () const | |
To allow if(v) statements. | |
bool | operator! () const |
To allow if(!v) statements. | |
Array< T > | subArray (int start, int len) |
void | clear () |
void | operator= (const Array< T > &other) |
void | operator= (const TVec< T > &other) |
NOTE: operator= COPIES THE TVec STRUCTURE BUT NOT THE DATA (use operator<< to copy data) | |
void | operator= (const vector< T > &other) |
void | view (const TVec< T > &other) |
Makes this array a shared view of the given TVec. | |
void | print (ostream &out) const |
C++ stream output. | |
int | findFirstOccurence (const T &elem) |
void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Deep copy of an array is not the same as for a TVec, because the shallow copy automatically creates a new storage. | |
void | write (ostream &out_) const |
void | read (istream &in_) |
operator char * () const | |
used by Hash (VERY DIRTY: TO BE REMOVED [Pascal]) | |
size_t | byteLength () const |
Definition at line 62 of file Array_decl.h.
typedef T* PLearn::Array< T >::iterator |
Reimplemented from PLearn::TVec< T >.
Reimplemented in PLearn::VarArray.
Definition at line 76 of file Array_decl.h.
PLearn::Array< T >::Array | ( | int | the_size = 0 , |
int | extra_space = 10 |
||
) | [inline, explicit] |
Definition at line 78 of file Array_decl.h.
: TVec<T>(the_size+extra_space) { length_ = the_size; }
PLearn::Array< T >::Array | ( | const T & | elem1 | ) | [inline] |
Definition at line 82 of file Array_decl.h.
: TVec<T>(1) { (*this)[0] = elem1; }
PLearn::Array< T >::Array | ( | const T & | elem1, |
const T & | elem2 | ||
) | [inline] |
Definition at line 86 of file Array_decl.h.
: TVec<T>(2) { (*this)[0] = elem1; (*this)[1] = elem2; }
PLearn::Array< T >::Array | ( | const Array< T > & | other | ) | [inline] |
PLearn::Array< T >::Array | ( | const TVec< T > & | other | ) | [inline] |
Definition at line 103 of file Array_decl.h.
: TVec<T>(other.copy()) {}
PLearn::Array< T >::Array | ( | const vector< T > & | other | ) | [inline] |
size_t PLearn::Array< T >::byteLength | ( | ) | const [inline] |
Reimplemented from PLearn::TVec< T >.
Definition at line 292 of file Array_decl.h.
{ return this->size()*sizeof(T); }
void PLearn::Array< T >::clear | ( | ) | [inline] |
Definition at line 135 of file Array_decl.h.
Referenced by PLearn::LocalizedFeaturesLayerVariable::build_(), and PLearn::rebalanceNClasses().
{ length_ = 0; }
int PLearn::Array< T >::findFirstOccurence | ( | const T & | elem | ) | [inline] |
void PLearn::Array< T >::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) |
Deep copy of an array is not the same as for a TVec, because the shallow copy automatically creates a new storage.
Reimplemented from PLearn::TVec< T >.
Reimplemented in PLearn::VarArray.
Definition at line 222 of file Array_impl.h.
References PLearn::deepCopyField(), and i.
Referenced by PLearn::deepCopyField().
{ // Shallow copy of an array, contrarily to TVec, already makes a shallow copy of the elements, so we // don't want to call deepCopyField(storage, copies) as TVec does, but simply deepCopyField() // of each of the storage's elements. if (storage.isNotNull()) for (int i = 0; i < storage->size(); i++) deepCopyField(storage->data[i], copies); }
PLearn::Array< T >::operator bool | ( | ) | const [inline] |
PLearn::Array< T >::operator char * | ( | ) | const [inline] |
used by Hash (VERY DIRTY: TO BE REMOVED [Pascal])
Reimplemented from PLearn::TVec< T >.
Definition at line 287 of file Array_decl.h.
bool PLearn::Array< T >::operator! | ( | ) | const [inline] |
To allow if(!v) statements.
Reimplemented from PLearn::TVec< T >.
Definition at line 120 of file Array_decl.h.
{ return length_==0; }
void PLearn::Array< T >::operator= | ( | const Array< T > & | other | ) | [inline] |
void PLearn::Array< T >::operator= | ( | const vector< T > & | other | ) | [inline] |
void PLearn::Array< T >::operator= | ( | const TVec< T > & | other | ) | [inline] |
void PLearn::Array< T >::print | ( | ostream & | out | ) | const [inline] |
void PLearn::Array< T >::read | ( | istream & | in_ | ) | [inline] |
Reimplemented in PLearn::VarArray.
Definition at line 280 of file Array_decl.h.
Array<T> PLearn::Array< T >::subArray | ( | int | start, |
int | len | ||
) | [inline] |
void PLearn::Array< T >::view | ( | const TVec< T > & | other | ) | [inline] |
Makes this array a shared view of the given TVec.
Definition at line 163 of file Array_decl.h.
{ TVec<T>::operator=(other); }
void PLearn::Array< T >::write | ( | ostream & | out_ | ) | const [inline] |
Reimplemented in PLearn::VarArray.
Definition at line 264 of file Array_decl.h.
Referenced by PLearn::VMatrix::saveStats().
{
PStream out(&out_);
out << *this;
}