Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsList< Type, allocator > Class Template Reference

a list as a PsType More...

#include <PsList.h>

Inheritance diagram for PsList< Type, allocator >:

Inheritance graph
[legend]
Collaboration diagram for PsList< Type, allocator >:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsList ()
 default constructor

 PsList (const int n, const Type &initialValue)
 constructor with initial values

 PsList (const list< Type, allocator > &l)
 copy from stl list constructor

 PsList (const PsList< Type > &l)
 copy constructor

virtual ~PsList ()
 destructor

virtual PsPolatorNTcreatePolator (void)
 create a polator to conform tp PsType

virtual void pack (PsOutgoingSynchronisationMessage &out) const
 insert the list in a stream

virtual void unpack (PsIncomingSynchronisationMessage &in)
 extract a list from a stream

virtual void insertInStream (ostream &=cout) const
 insert the list in an output stream

virtual void extract (istream &=cin)
 extraction the list from an input stream

virtual PsList< Type, allocator > & operator= (const PsList< Type, allocator > &)
 assign the value of an other list to this list


Detailed Description

template<typename Type, typename allocator = STL_ALLOC<Type>>
class PsList< Type, allocator >

a list as a PsType

Author:
Siames
Version:
1.1 1.0 -> 1.1 by David Margery : usage of the new standard compliant allocators 1.1 -> 2.0 by David Margery : suppressed the iterator data member for thread safety

Definition at line 40 of file PsList.h.


Constructor & Destructor Documentation

template<typename Type, typename allocator = STL_ALLOC<Type>>
PsList< Type, allocator >::PsList   [inline]
 

default constructor

Definition at line 46 of file PsList.h.

00047    {
00048    }

template<typename Type, typename allocator = STL_ALLOC<Type>>
PsList< Type, allocator >::PsList const int    n,
const Type &    initialValue
[inline]
 

constructor with initial values

Definition at line 54 of file PsList.h.

00054                                                   : list<Type, allocator >(n,initialValue) 
00055 #endif
00056    {
00057    };

template<typename Type, typename allocator = STL_ALLOC<Type>>
PsList< Type, allocator >::PsList const list< Type, allocator > &    l [inline]
 

copy from stl list constructor

Definition at line 63 of file PsList.h.

00063 : list<Type, allocator >(l) {};

template<typename Type, typename allocator = STL_ALLOC<Type>>
PsList< Type, allocator >::PsList const PsList< Type > &    l [inline]
 

copy constructor

Definition at line 70 of file PsList.h.

00070 : list<Type, allocator >(l) {};

template<typename Type, typename allocator = STL_ALLOC<Type>>
virtual PsList< Type, allocator >::~PsList   [inline, virtual]
 

destructor

Definition at line 74 of file PsList.h.

00074 {}


Member Function Documentation

template<typename Type, typename allocator = STL_ALLOC<Type>>
virtual PsPolatorNT* PsList< Type, allocator >::createPolator void    [inline, virtual]
 

create a polator to conform tp PsType

Implements PsType.

Definition at line 77 of file PsList.h.

00078    {
00079       return (PsPolatorNT *) new PsPolator< PsList<Type> >() ;
00080    } ;

template<typename Type, typename allocator>
void PsList< Type, allocator >::extract istream &    = cin [inline, virtual]
 

extraction the list from an input stream

Implements PsFlowable.

Definition at line 117 of file PsList.h.

00117                                                           {
00118    int nbElements ;
00119    Type elem ;
00120    clear () ;
00121    in >> nbElements ;
00122    for (int j = 0 ; j < nbElements ; j ++) {
00123       in >> elem ;
00124       push_back (elem) ;
00125    }
00126 }

template<typename Type, typename allocator>
void PsList< Type, allocator >::insertInStream ostream &    = cout const [inline, virtual]
 

insert the list in an output stream

Implements PsFlowable.

Definition at line 104 of file PsList.h.

00104                                                                         {
00105    out << size () << " " ;
00106 #ifdef _TYPENAMENOTIMPLICIT
00107    typename  PsList <Type,allocator>::
00108 #endif
00109       const_iterator i = begin () ;
00110    while (i != end ()) {
00111       out << *i << " " ;
00112       i ++ ;
00113    }
00114 }

template<typename Type, typename allocator>
PsList< Type, allocator > & PsList< Type, allocator >::operator= const PsList< Type, allocator > &    [inline, virtual]
 

assign the value of an other list to this list

Definition at line 162 of file PsList.h.

00163 {
00164 #ifdef _OLDALLOCATORS
00165   list <Type, STL_ALLOC>::operator = (p) ; // TDTD DANGER resolved on 1999/9/8
00166 #else
00167   list <Type, allocator >::operator = (p) ; // TDTD DANGER resolved on 1999/9/8
00168 #endif
00169   return *this ;
00170 }

template<typename Type, typename allocator>
void PsList< Type, allocator >::pack PsOutgoingSynchronisationMessage   out const [virtual]
 

insert the list in a stream

Reimplemented from PsFlowable.

Definition at line 129 of file PsList.h.

00130 {
00131    out << size () ;
00132 #ifdef _TYPENAMENOTIMPLICIT
00133    typename  PsList <Type,allocator>::const_iterator i = begin () ;
00134 #else
00135    const_iterator i = begin () ;
00136 #endif
00137    while (i != end ()) 
00138       {
00139          out << *i ;
00140          i ++ ;
00141       }
00142    
00143 }

template<typename Type, typename allocator>
void PsList< Type, allocator >::unpack PsIncomingSynchronisationMessage   in [virtual]
 

extract a list from a stream

Reimplemented from PsFlowable.

Definition at line 146 of file PsList.h.

00147 {
00148    size_t numberOfElements ;
00149    in >> numberOfElements ;
00150    resize (numberOfElements) ;
00151    for (typename PsList <Type,allocator>::iterator i = begin() ; i != end() ; ++i)
00152       {
00153          (*i).unpack ( in ) ; 
00154       }
00155 }


The documentation for this class was generated from the following file:
logo OpenMask

Documentation generated on Mon Nov 25 15:26:08 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001