OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

PtrList< 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...

Collaboration diagram for PtrList< T >:

List of all members.


Classes

class  iterator
 An STL-conforming iterator. More...

Public Types

typedef T value_type
 Type of values the PtrList contains.
typedef T & reference
 Type that can be used for storing into PtrList::value_type objects.
typedef const T & const_reference
 Type that can be used for storing into constant PtrList::value_type.

Public Member Functions

 PtrList ()
 Null Constructor.
 PtrList (const label)
 Construct with length specified.
 PtrList (const PtrList< T > &)
 Copy constructor.
template<class CloneArg >
 PtrList (const PtrList< T > &, const CloneArg &)
 Copy constructor with additional argument for clone.
 PtrList (const Xfer< PtrList< T > > &)
 Construct by transferring the parameter contents.
 PtrList (PtrList< T > &, bool reUse)
 Construct as copy or re-use as specified.
 PtrList (const SLPtrList< T > &)
 Construct as copy of SLPtrList<T>.
template<class INew >
 PtrList (Istream &, const INew &)
 Construct from Istream using given Istream constructor class.
 PtrList (Istream &)
 Construct from Istream using default Istream constructor class.
 ~PtrList ()
label size () const
 Return the number of elements in the PtrList.
bool empty () const
 Return true if the PtrList is empty (ie, size() is zero).
void setSize (const label)
 Reset size of PtrList. This can only be used to set the size.
void resize (const label)
 Reset size of PtrList. This can only be used to set the size.
void clear ()
 Clear the PtrList, i.e. set size to zero deleting all the.
void transfer (PtrList< T > &)
 Transfer the contents of the argument PtrList into this PtrList.
Xfer< PtrList< T > > xfer ()
 Transfer contents to the Xfer container.
bool set (const label) const
 Is element set.
autoPtr< T > set (const label, T *)
 Set element. Return old element (can be NULL).
autoPtr< T > set (const label, const autoPtr< T > &)
autoPtr< T > set (const label, const tmp< T > &)
void reorder (const UList< label > &)
 Reorders elements. Ordering does not have to be done in.
const T & operator[] (const label) const
 Return element const reference.
T & operator[] (const label)
 Return element reference.
const T * operator() (const label) const
 Return element const pointer.
PtrList< T > & operator= (const PtrList< T > &)
 Assignment.
iterator begin ()
 Return an iterator to begin traversing the PtrList.
iterator end ()
 Return an iterator to end traversing the PtrList.

Protected Member Functions

template<class INew >
void read (Istream &, const INew &inewt)
 Read from Istream using given Istream constructor class.

Friends

class iterator
Istreamoperator>> (Istream &, PtrList< T > &)
 Read List from Istream, discarding contents of existing List.
Ostreamoperator (Ostream &, const PtrList< T > &)

Detailed Description

template<class T>
class Foam::PtrList< 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 to the pointer.

Source files

Definition at line 93 of file PtrList.H.


Member Typedef Documentation

typedef T value_type

Type of values the PtrList contains.

Definition at line 230 of file PtrList.H.

typedef T& reference

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

Definition at line 233 of file PtrList.H.

typedef const T& const_reference

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

objects.

Definition at line 239 of file PtrList.H.


Constructor & Destructor Documentation

PtrList (  )  [inline]

Null Constructor.

Definition at line 26 of file PtrList.C.

PtrList ( const label  s  )  [inline, explicit]

Construct with length specified.

Definition at line 33 of file PtrList.C.

PtrList ( const PtrList< T > &  a  )  [inline]

Copy constructor.

Definition at line 40 of file PtrList.C.

PtrList ( const PtrList< T > &  a,
const CloneArg &  cloneArg 
) [inline]

Copy constructor with additional argument for clone.

Definition at line 53 of file PtrList.C.

PtrList ( const Xfer< PtrList< T > > &  lst  )  [inline]

Construct by transferring the parameter contents.

Definition at line 65 of file PtrList.C.

References forAll.

PtrList ( PtrList< T > &  a,
bool  reUse 
) [inline]

Construct as copy or re-use as specified.

Definition at line 72 of file PtrList.C.

References PtrList< T >::transfer().

Here is the call graph for this function:

PtrList ( const SLPtrList< T > &  sll  )  [inline]

Construct as copy of SLPtrList<T>.

Definition at line 96 of file PtrList.C.

PtrList ( Istream is,
const INew inewt 
) [inline]

Construct from Istream using given Istream constructor class.

Definition at line 144 of file PtrListIO.C.

PtrList ( Istream is  )  [inline]

Construct from Istream using default Istream constructor class.

Definition at line 151 of file PtrListIO.C.

~PtrList (  )  [inline]

Definition at line 119 of file PtrList.C.


Member Function Documentation

Foam::label size (  )  const [inline]

Return the number of elements in the PtrList.

Definition at line 26 of file PtrListI.H.

Referenced by refinementSurfaces::refinementSurfaces(), and ensightParts::size().

Here is the caller graph for this function:

bool empty (  )  const [inline]

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

Definition at line 33 of file PtrListI.H.

void setSize ( const label  newSize  )  [inline]

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

of an empty PtrList, extend a PtrList, remove entries from the end of a PtrList. If the entries are non-empty they are deleted.

Definition at line 134 of file PtrList.C.

Referenced by GAMGAgglomeration::continueAgglomerating(), spray::evolve(), procLduMatrix::procLduMatrix(), and Foam::ReadFields().

Here is the caller graph for this function:

void resize ( const label  newSize  )  [inline]

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

of an empty PtrList, extend a PtrList, remove entries from the end of a PtrList. If the entries are non-empty they are deleted.

Definition at line 40 of file PtrListI.H.

void clear (  )  [inline]

Clear the PtrList, i.e. set size to zero deleting all the.

allocated entries.

Reimplemented in functionObjectList, ZoneMesh< ZoneType, MeshType >, ZoneMesh< faceZone, polyMesh >, ZoneMesh< pointZone, polyMesh >, and ZoneMesh< cellZone, polyMesh >.

Definition at line 176 of file PtrList.C.

Referenced by PtrList< T >::reorder().

Here is the caller graph for this function:

void transfer ( PtrList< T > &  a  )  [inline]

Transfer the contents of the argument PtrList into this PtrList.

and annull the argument list.

Definition at line 191 of file PtrList.C.

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

Here is the caller graph for this function:

Foam::Xfer< Foam::PtrList< T > > xfer (  )  [inline]

Transfer contents to the Xfer container.

Definition at line 87 of file PtrListI.H.

bool set ( const label  i  )  const [inline]

Foam::autoPtr< T > set ( const label  i,
T *  ptr 
) [inline]

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

No checks on new element.

Definition at line 54 of file PtrListI.H.

Foam::autoPtr< T > set ( const label  i,
const autoPtr< T > &  aptr 
) [inline]

Definition at line 66 of file PtrListI.H.

Foam::autoPtr< T > set ( const label  i,
const tmp< T > &  t 
) [inline]

Definition at line 77 of file PtrListI.H.

void reorder ( const UList< label > &  oldToNew  )  [inline]

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

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

Definition at line 199 of file PtrList.C.

References PtrList< T >::clear(), 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 96 of file PtrListI.H.

References Foam::xferMove().

Here is the call graph for this function:

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

Return element reference.

Definition at line 110 of file PtrListI.H.

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

Return element const pointer.

Definition at line 124 of file PtrListI.H.

Foam::PtrList< T > & operator= ( const PtrList< T > &  a  )  [inline]

Assignment.

Definition at line 249 of file PtrList.C.

Foam::PtrList< T >::iterator begin (  )  [inline]

Return an iterator to begin traversing the PtrList.

Definition at line 278 of file PtrListI.H.

Foam::PtrList< T >::iterator end (  )  [inline]

Return an iterator to end traversing the PtrList.

Reimplemented in functionObjectList, sampledSets, and sampledSurfaces.

Definition at line 285 of file PtrListI.H.

References UList< T >::begin().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class iterator [friend]

Definition at line 245 of file PtrList.H.

Istream& operator>> ( Istream ,
PtrList< T > &   
) [friend]

Read List from Istream, discarding contents of existing List.

Ostream& operator ( Ostream ,
const PtrList< T > &   
) [friend]


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd