#include <PsMap.h>
Inheritance diagram for PsMap< index, objectType >:


Public Methods | |
| PsMap () | |
| constructor | |
| virtual | ~PsMap () |
| destructor | |
| void | addObjectWithIndex (const index &nomObj, objectType refObj) |
| easy insertion | |
| objectType | getObjectOfIndex (const index &nomObj) const |
| easy find | |
| virtual void | insertInStream (ostream &=cout) const |
| insert the map in an output stream | |
| virtual void | extract (istream &=cin) |
| extraction of the map from an input stream | |
| virtual void | pack (PsOutgoingSynchronisationMessage &out) const |
| insert the map in a stream | |
| virtual void | unpack (PsIncomingSynchronisationMessage &in) |
| extract a map from a stream | |
| virtual PsPolatorNT * | createPolator (void) |
| create a polator to conform tp PsType | |
Definition at line 36 of file PsMap.h.
|
|||||||||
|
constructor
Definition at line 42 of file PsMap.h.
00043 {}
|
|
|||||||||
|
destructor
Definition at line 45 of file PsMap.h.
00046 {}
|
|
||||||||||||||||
|
easy insertion
Definition at line 48 of file PsMap.h.
00050 {
00051 insert (pair<const index, objectType>(nomObj,refObj)) ;
|
|
||||||||||
|
create a polator to conform tp PsType
Implements PsType. Definition at line 85 of file PsMap.h.
00087 {
00088 return new PsPolator< PsMap<index,objectType> >() ;
|
|
||||||||||
|
extraction of the map from an input stream
Implements PsFlowable. Definition at line 110 of file PsMap.h.
00112 {
00113 int nbElements ;
00114 index ind ;
00115 objectType elem ;
00116 clear () ;
00117 in >> nbElements ;
00118 for (int j = 0 ; j < nbElements ; j ++) {
00119 in >> ind >> elem ;
00120 insert (pair<const index, objectType>(ind,elem)) ;
00121
00122 }
|
|
||||||||||
|
easy find
Definition at line 54 of file PsMap.h.
00056 {
00057 #ifdef _TYPENAMENOTIMPLICIT
00058 typename PsMap<index, objectType>::const_iterator i;
00059 #else
00060 const_iterator i;
00061 #endif
00062 i=find(nomObj);
00063 if (i==end())
00064 {
00065 return NULL;
00066 }
00067 else
00068 {
00069 return (*i).second;
00070 }
|
|
||||||||||
|
insert the map in an output stream
Implements PsFlowable. Definition at line 94 of file PsMap.h.
00095 {
00096 out << size () << " " ;
00097 #ifdef _TYPENAMENOTIMPLICIT
00098 typename PsMap<index, objectType>::const_iterator i = begin () ;
00099 #else
00100 const_iterator i = begin () ;
00101 #endif
00102 while (i != end ())
00103 {
00104 out << (*i).first <<" "<< (*i).second <<" ";
00105 ++ i ;
00106 }
|
|
||||||||||
|
insert the map in a stream
Reimplemented from PsFlowable. Definition at line 125 of file PsMap.h.
00127 {
00128 out << size () ;
00129 #ifdef _TYPENAMENOTIMPLICIT
00130 typename PsMap<index, objectType>::
00131 #endif
00132 const_iterator i = begin () ;
00133 while (i != end ()) {
00134 out << (*i).first << (*i).second ;
00135 ++ i ;
00136 }
|
|
||||||||||
|
extract a map from a stream
Reimplemented from PsFlowable. Definition at line 139 of file PsMap.h. References map< index, objectType, less< index >, STL_ALLOC< pair< const index, objectType > > >::value_type.
00141 {
00142 size_t numberOfElements ;
00143 in>>numberOfElements ;
00144 index ind ;
00145 objectType obj ;
00146 for (int i= 0 ; i < numberOfElements ; ++i)
00147 {
00148 in>>ind>>obj;
00149 insert( PsMap::value_type(ind,obj) ) ;
00150 }
|
| Documentation generated on Mon Nov 25 15:26:08 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |