Classes | Public Types | Public Member Functions | Friends | List of all members
UPtrList< T > Class Template Reference

A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used for subscript bounds checking, etc. More...

Inheritance diagram for UPtrList< T >:
Inheritance graph
[legend]

Classes

class  iterator
 An STL iterator. More...
 

Public Types

typedef T value_type
 Type of values the UPtrList contains. More...
 
typedef Treference
 Type that can be used for storing into UPtrList::value_type objects. More...
 
typedef const Tconst_reference
 Type that can be used for storing into constant UPtrList::value_type. More...
 

Public Member Functions

 UPtrList ()
 Null Constructor. More...
 
 UPtrList (const label)
 Construct with size specified. More...
 
 UPtrList (const Xfer< UPtrList< T > > &)
 Construct by transferring the parameter contents. More...
 
 UPtrList (UPtrList< T > &, bool reUse)
 Construct as copy or re-use as specified. More...
 
label size () const
 Return the number of elements in the UPtrList. More...
 
bool empty () const
 Return true if the UPtrList is empty (ie, size() is zero). More...
 
Tfirst ()
 Return reference to the first element of the list. More...
 
const Tfirst () const
 Return reference to first element of the list. More...
 
Tlast ()
 Return reference to the last element of the list. More...
 
const Tlast () const
 Return reference to the last element of the list. More...
 
void setSize (const label)
 Reset size of UPtrList. This can only be used to set the size. More...
 
void resize (const label)
 Reset size of UPtrList. This can only be used to set the size. More...
 
void clear ()
 Clear the UPtrList, i.e. set size to zero. More...
 
void transfer (UPtrList< T > &)
 Transfer the contents of the argument UPtrList into this. More...
 
Xfer< UPtrList< T > > xfer ()
 Transfer contents to the Xfer container. More...
 
bool set (const label) const
 Is element set. More...
 
Tset (const label, T *)
 Set element. Return old element (can be NULL). More...
 
void reorder (const labelUList &)
 Reorders elements. Ordering does not have to be done in. More...
 
const Toperator[] (const label) const
 Return element const reference. More...
 
Toperator[] (const label)
 Return element reference. More...
 
const Toperator() (const label) const
 Return element const pointer. More...
 
iterator begin ()
 Return an iterator to begin traversing the UPtrList. More...
 
iterator end ()
 Return an iterator to end traversing the UPtrList. More...
 

Friends

class iterator
 
Ostreamoperator (Ostream &, const UPtrList< T > &)
 

Detailed Description

template<class T>
class Foam::UPtrList< T >

A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used for subscript bounds checking, etc.

The element operator [] returns a reference to the object rather than a pointer. Storage is not allocated during construction or use but is supplied to the constructor as an argument.

Source files

Definition at line 52 of file UPtrList.H.

Member Typedef Documentation

typedef T value_type

Type of values the UPtrList contains.

Definition at line 191 of file UPtrList.H.

typedef T& reference

Type that can be used for storing into UPtrList::value_type objects.

Definition at line 194 of file UPtrList.H.

typedef const T& const_reference

Type that can be used for storing into constant UPtrList::value_type.

objects.

Definition at line 198 of file UPtrList.H.

Constructor & Destructor Documentation

UPtrList ( )

Null Constructor.

Definition at line 33 of file UPtrList.C.

UPtrList ( const label  s)
explicit

Construct with size specified.

Definition at line 40 of file UPtrList.C.

UPtrList ( const Xfer< UPtrList< T > > &  lst)

Construct by transferring the parameter contents.

Definition at line 47 of file UPtrList.C.

References UPtrList< T >::transfer().

Here is the call graph for this function:

UPtrList ( UPtrList< T > &  a,
bool  reUse 
)

Construct as copy or re-use as specified.

Definition at line 54 of file UPtrList.C.

Member Function Documentation

Foam::label size ( ) const
inline
bool empty ( ) const
inline

Return true if the UPtrList is empty (ie, size() is zero).

Definition at line 38 of file UPtrListI.H.

T & first ( )
inline

Return reference to the first element of the list.

Definition at line 45 of file UPtrListI.H.

const T & first ( ) const
inline

Return reference to first element of the list.

Definition at line 52 of file UPtrListI.H.

T & last ( )
inline

Return reference to the last element of the list.

Definition at line 59 of file UPtrListI.H.

const T & last ( ) const
inline

Return reference to the last element of the list.

Definition at line 66 of file UPtrListI.H.

void setSize ( const label  newSize)

Reset size of UPtrList. This can only be used to set the size.

of an empty UPtrList, extend a UPtrList, remove entries from the end of a UPtrList.

Definition at line 63 of file UPtrList.C.

References UPtrList< T >::clear(), List< T >::setSize(), and UPtrList< T >::size().

Here is the call graph for this function:

void resize ( const label  newSize)
inline

Reset size of UPtrList. This can only be used to set the size.

of an empty UPtrList, extend a UPtrList, remove entries from the end of a UPtrList.

Definition at line 73 of file UPtrListI.H.

References setSize().

Here is the call graph for this function:

void clear ( )

Clear the UPtrList, i.e. set size to zero.

Definition at line 89 of file UPtrList.C.

References List< T >::clear().

Referenced by UPtrList< T >::setSize().

Here is the call graph for this function:

Here is the caller graph for this function:

void transfer ( UPtrList< T > &  a)

Transfer the contents of the argument UPtrList into this.

UPtrList and annul the argument list.

Definition at line 96 of file UPtrList.C.

References List< T >::transfer().

Referenced by UPtrList< T >::UPtrList().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::Xfer< Foam::UPtrList< T > > xfer ( )
inline

Transfer contents to the Xfer container.

Definition at line 96 of file UPtrListI.H.

References Foam::xferMove().

Here is the call graph for this function:

bool set ( const label  i) const
inline
T * set ( const label  i,
T ptr 
)
inline

Set element. Return old element (can be NULL).

No checks on new element.

Definition at line 87 of file UPtrListI.H.

References T.

void reorder ( const labelUList oldToNew)

Reorders elements. Ordering does not have to be done in.

ascending or descending order. Reordering has to be unique. (is shuffle)

Definition at line 103 of file UPtrList.C.

References Foam::abort(), Foam::FatalError, FatalErrorIn, forAll, Foam::nl, List< T >::size(), UPtrList< T >::size(), UList< T >::size(), Foam::T(), and List< T >::transfer().

Here is the call graph for this function:

const T & operator[] ( const label  i) const
inline

Return element const reference.

Definition at line 105 of file UPtrListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

Here is the call graph for this function:

T & operator[] ( const label  i)
inline

Return element reference.

Definition at line 121 of file UPtrListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

Here is the call graph for this function:

const T * operator() ( const label  i) const
inline

Return element const pointer.

Definition at line 137 of file UPtrListI.H.

Foam::UPtrList< T >::iterator begin ( )
inline

Return an iterator to begin traversing the UPtrList.

Definition at line 291 of file UPtrListI.H.

Referenced by LUscalarMatrix::LUscalarMatrix().

Here is the caller graph for this function:

Foam::UPtrList< T >::iterator end ( )
inline

Return an iterator to end traversing the UPtrList.

Definition at line 298 of file UPtrListI.H.

Friends And Related Function Documentation

friend class iterator
friend

Definition at line 204 of file UPtrList.H.

Ostream& operator ( Ostream ,
const UPtrList< T > &   
)
friend

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