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

PsNameServerT< STLallocator > Class Template Reference

templated name server this class is templated by the allocator used for allocation of it's internal data. More...

#include <PsNameServerT.h>

Inheritance diagram for PsNameServerT< STLallocator >:

Inheritance graph
[legend]
Collaboration diagram for PsNameServerT< STLallocator >:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsNameServerT ()
 default constructor.

 PsNameServerT (const PsNameServer::CanonicalRepresentationType *)
 construction of a name server conformant to a canonical representation

virtual ~PsNameServerT ()
 destruction

virtual long getIdentifier (const PsString &)
 get the id corresponding to a string if the string is unknown to the name server, a new id will be added

virtual long getSystemIdentifier (const PsString &)
 get the id corresponding to a string the string should correspond to a reserverd string

virtual long getIdentifierAsFrom (const PsString &, long *nextId)
 get the id corresponding to a string, using a specified nextId counter used to implement getIdentifier and getSystemIdentifier

virtual const PsStringgetStringAssociatedTo (PsName::idType id) const
 get the string associated to an id

void * operator new (size_t)
 redefine new so that the nameserver is located in the same memory space than it's data structures and their elements

void operator delete (void *ptr, size_t n)
 redefine delete 'cause new was redefined

virtual void created (PsName::idType id, PsName *)
 a new PsName of id id was created

virtual void deleted (PsName::idType id, PsName *)
 a PsName of id id was deleted

CanonicalRepresentationTypegetCanonicalRepresentation () const
 get the canonical representation once used, the result should be deleted

virtual const list< PsName * > & getNamesOfId (PsName::idType) const
 get a list of pointers to the PsNames corresponding to an id


Protected Types

typedef hash_map< PsString,
long, PsString_hash,equal_to<
PsString >, STLallocator<
pair< PsString, long > > > 
correspondenceContainerType
 reference data structure type

typedef map< long, typename
correspondenceContainerType::iterator,
less< long >, STLallocator<
pair< const long, typename
correspondenceContainerType::iterator > > > 
fastStringAccessTableType
 fast access data structure type

typedef hash_map< PsName::idType,
int, hash< PsName::idType >,
equal_to< PsName::idType >,
STLallocator< pair< PsName::idType,
int > > > 
referenceCountingContainerType
 reference counting data structure type

typedef hash_map< PsName::idType,
list< PsName * > *, hash<
PsName::idType >, equal_to<
PsName::idType >, STLallocator<
pair< PsName::idType, int > > > 
placeOfNamesContainerType
 reference counting data structure type


Protected Methods

virtual void lock () const
 lock data in a multithread environment

virtual void unlock () const
 unlock data in a multithread environment


Protected Attributes

PsnMutexLock _ourDataLock
 the lock for multi-threaded environements

long _nextIdentifier
 nextIdentifier to use

long _nextSystemIdentifier
 next System Identifier to use

fastStringAccessTableType _fastStringAccessTable
 fast access data structure

correspondenceContainerType _stringToIdCorrespondenceContainer
 table holding String - id correspondance

referenceCountingContainerType _tableNbInstances
 table holding reference counting

placeOfNamesContainerType _idToNamesUsingIdContainer
 table holding the list of PsNames memory spaces using a given id


Detailed Description

template<template< typename T > class STLallocator>
class PsNameServerT< STLallocator >

templated name server this class is templated by the allocator used for allocation of it's internal data.

Therefore, it comes in two flavours, depending of the type of allocators used by the underlying standard library.

Author:
David Margery
Version:
2.0 : version working with old or new allocators

Definition at line 36 of file PsNameServerT.h.


Member Typedef Documentation

template<template< typename T > class STLallocator>
typedef hash_map<PsString,long, PsString_hash ,equal_to<PsString>,STLallocator<pair <PsString,long> > > PsNameServerT< STLallocator >::correspondenceContainerType [protected]
 

reference data structure type

Definition at line 131 of file PsNameServerT.h.

template<template< typename T > class STLallocator>
typedef map<long, typename correspondenceContainerType::iterator,less<long>,STLallocator<pair<const long, typename correspondenceContainerType::iterator> > > PsNameServerT< STLallocator >::fastStringAccessTableType [protected]
 

fast access data structure type

Definition at line 134 of file PsNameServerT.h.

template<template< typename T > class STLallocator>
typedef hash_map<PsName::idType, list<PsName *> *, hash<PsName::idType>,equal_to<PsName::idType>,STLallocator<pair<PsName::idType,int> > > PsNameServerT< STLallocator >::placeOfNamesContainerType [protected]
 

reference counting data structure type

Definition at line 140 of file PsNameServerT.h.

template<template< typename T > class STLallocator>
typedef hash_map<PsName::idType, int, hash<PsName::idType>,equal_to<PsName::idType>,STLallocator<pair<PsName::idType,int> > > PsNameServerT< STLallocator >::referenceCountingContainerType [protected]
 

reference counting data structure type

Definition at line 137 of file PsNameServerT.h.


Constructor & Destructor Documentation

template<template< typename T > class STLallocator>
PsNameServerT< STLallocator >::PsNameServerT  
 

default constructor.

Definition at line 165 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_fastStringAccessTable, PsName::_maxReservedId, PsNameServerT< STLallocator >::_nextIdentifier, PsNameServerT< STLallocator >::_nextSystemIdentifier, PsNameServerT< STLallocator >::_stringToIdCorrespondenceContainer, PsNameServerT< STLallocator >::_tableNbInstances, map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::clear(), map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::insert(), hash_map< Key, T, HashFcn, EqualKey, Alloc >::insert(), and hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::insert().

00167 {
00168    //cerr<<"PsNameServerT<STLallocator>:"<<this<<":PsNameServerT() "<<endl;
00169    _nextIdentifier = PsName::_maxReservedId + 1 ;
00170    _nextSystemIdentifier = 1 ;
00171 
00172    // keep id 0 reserved and associated to the string "Uninitialised PsName"
00173    _tableNbInstances.insert (referenceCountingContainerType::value_type(0, 0) );
00174 #ifdef _TYPENAMENOTIMPLICIT
00175    typename correspondenceContainerType::iterator i=(_stringToIdCorrespondenceContainer.insert(typename correspondenceContainerType::value_type(PsString("Uninitialised PsName"),0))).first;
00176    _fastStringAccessTable.clear();
00177    _fastStringAccessTable.insert(pair<const long, typename correspondenceContainerType::iterator>(0,i));
00178 #else
00179    correspondenceContainerType::iterator i=(_stringToIdCorrespondenceContainer.insert(correspondenceContainerType::value_type(PsString("Uninitialised PsName"),0))).first;   
00180    _fastStringAccessTable.clear();
00181    _fastStringAccessTable.insert(pair<const long, correspondenceContainerType::iterator>(0,i));
00182 #endif

template<template< typename T > class STLallocator>
PsNameServerT< STLallocator >::PsNameServerT const PsNameServer::CanonicalRepresentationType  
 

construction of a name server conformant to a canonical representation

Definition at line 191 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_fastStringAccessTable, PsNameServerT< STLallocator >::_nextIdentifier, PsNameServerT< STLallocator >::_stringToIdCorrespondenceContainer, PsNameServerT< STLallocator >::_tableNbInstances, list< Type, allocator >::begin(), list< Type, allocator >::end(), map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::insert(), and hash_map< Key, T, HashFcn, EqualKey, Alloc >::insert().

00193 {
00194    //cerr<<"PsNameServerT<STLallocator>:"<<this<<":PsNameServerT(const PsNameServer::CanonicalRepresentationType * canonicalRepresentation)"<<endl;
00195     for ( CanonicalRepresentationType::const_iterator i = canonicalRepresentation->begin() ;
00196          i != canonicalRepresentation->end() ;
00197          i++ )
00198       {
00199          //(*i) is < <PsName::idType,PsString> , numberOfInstances> therefore
00200          //(*i).first.first is the id,
00201          //(*i).first.second is the associated string
00202          //(*i).second is the number of instances of PsNames with id as id
00203 
00204          //first create an entry is the hash_table for the associated string
00205 #ifdef _TYPENAMENOTIMPLICIT
00206          typename correspondenceContainerType::iterator ii=(_stringToIdCorrespondenceContainer.insert(typename correspondenceContainerType::value_type((*i).first.second,(*i).first.first))).first;
00207          // then reference that entry in the iterator table 
00208          _fastStringAccessTable.insert(pair<const long, typename correspondenceContainerType::iterator>((*i).first.first,ii));   
00209 #else
00210          correspondenceContainerType::iterator ii=(_stringToIdCorrespondenceContainer.insert(correspondenceContainerType::value_type((*i).first.second,(*i).first.first))).first;
00211          // then reference that entry in the iterator table 
00212          _fastStringAccessTable.insert(pair<const long, correspondenceContainerType::iterator>((*i).first.first,ii));    
00213 #endif
00214          //then take care of keeping care of the number of copies of id in the system
00215          _tableNbInstances[(*i).first.first] = (*i).second ;
00216 
00217          //cerr<<"PsNameServerT<STLallocator>::PsNameServerT "<<(*i).second<<" references to "<<(*i).first.first<<endl;
00218 
00219          //try and find a reasonnable next id
00220          _nextIdentifier = (*i).first.first + 1 ;
00221       }

template<template< typename T > class STLallocator>
PsNameServerT< STLallocator >::~PsNameServerT   [virtual]
 

destruction

Definition at line 229 of file PsNameServerT.h.

00231 {
00232    //nothing to do   


Member Function Documentation

template<template< typename T > class STLallocator>
void PsNameServerT< STLallocator >::created PsName::idType    id,
PsName  
[virtual]
 

a new PsName of id id was created

Implements PsNameServer.

Reimplemented in PsPvmNameServer.

Definition at line 386 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_idToNamesUsingIdContainer, PsNameServerT< STLallocator >::_tableNbInstances, hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::end(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::end(), hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::find(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::find(), pair< iterator, bool >::first, PsName::idType, hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::insert(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::insert(), PsNameServerT< STLallocator >::lock(), and PsNameServerT< STLallocator >::unlock().

00388 {
00389    lock() ;
00390 #ifdef _TYPENAMENOTIMPLICIT
00391    typename
00392 #endif
00393    referenceCountingContainerType::iterator i = _tableNbInstances.find(id);
00394    if ( i == _tableNbInstances.end() ) 
00395       {
00396          i =  _tableNbInstances.insert(referenceCountingContainerType::value_type(id,1)).first;
00397       }
00398    else 
00399       {
00400          ++(*i).second;
00401       }
00402    // do the same for _idToNamesUsingIdContainer
00403 #ifdef _TYPENAMENOTIMPLICIT
00404    typename
00405 #endif
00406    placeOfNamesContainerType::iterator j = _idToNamesUsingIdContainer.find(id);
00407    if ( j == _idToNamesUsingIdContainer.end() ) 
00408       {
00409          j = _idToNamesUsingIdContainer.insert(placeOfNamesContainerType::value_type(id,new list<PsName *>() ) ).first ;
00410       }
00411    assert ( (*j).second != NULL ) ;
00412    (*j).second->push_front( name ) ;
00413 
00414    unlock() ;
00415    //cerr<<"PsNameServerT<"<<this<<">::created called for "<<getStringAssociatedTo(id)<<" "<<name<<" of id "<<id<<" with "<<(*i).second<<" instances now and "<<(*j).second->size( )<<" registred PsNames"<< endl;

template<template< typename T > class STLallocator>
void PsNameServerT< STLallocator >::deleted PsName::idType    id,
PsName  
[virtual]
 

a PsName of id id was deleted

Implements PsNameServer.

Reimplemented in PsPvmNameServer.

Definition at line 422 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_fastStringAccessTable, PsNameServerT< STLallocator >::_idToNamesUsingIdContainer, PsNameServerT< STLallocator >::_nextIdentifier, PsNameServerT< STLallocator >::_stringToIdCorrespondenceContainer, PsNameServerT< STLallocator >::_tableNbInstances, map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::end(), list< T, Alloc >::end(), hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::end(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::end(), hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::erase(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::erase(), map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::erase(), hash_map< Key, T, HashFcn, EqualKey, Alloc >::erase(), list< T, Alloc >::erase(), map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::find(), hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::find(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::find(), PsName::idType, PsNameServerT< STLallocator >::lock(), and PsNameServerT< STLallocator >::unlock().

00424 {
00425    //cerr<<"PsNameServerT<"<<this<<">::deleted called for "<<getStringAssociatedTo(id)<<" "<<name<<" of id "<<id;
00426    lock() ;
00427 
00428 #ifdef _TYPENAMENOTIMPLICIT
00429    typename
00430 #endif
00431    referenceCountingContainerType::iterator i = _tableNbInstances.find(id);
00432 
00433    assert ( i != _tableNbInstances.end() ) ; 
00434 
00435    //cerr<<" with "<<(*i).second<<" instances left "<<&((*i).second)<<endl;
00436    --(*i).second;
00437    
00438    //must remove name from _idToNamesUsingIdContainer, once
00439 #ifdef _TYPENAMENOTIMPLICIT
00440    typename
00441 #endif
00442    placeOfNamesContainerType::iterator j = _idToNamesUsingIdContainer.find(id);
00443    if ( j != _idToNamesUsingIdContainer.end() ) 
00444       {
00445          assert ((*j).second != NULL ) ; //assert because otherwise it would meen a problem has occured
00446          //cerr<<"PsNameServerT<"<<this<<">::deleted " <<(*j).second->size()<<" PsNames referenced"<<endl;
00447          list<PsName *>::iterator k = (*j).second->begin() ;
00448          while ( *k != name ) 
00449             {
00450                assert ( k != (*j).second->end() ) ;
00451                ++k ;
00452             }
00453          
00454          assert ( k != (*j).second->end() ) ; //assert because otherwise it would meen a problem has occured
00455          
00456          (*j).second->erase ( k ) ;
00457       }
00458    else
00459       {
00460          //there has been a problem
00461          assert ( false ) ;
00462       }
00463    
00464    //keep the string associated to id 0
00465    if( ( (*i).second <= 0) && ( id != 0 ) ) 
00466       {
00467          //cerr<<"PsNameServerT<"<<">::deleting "<<getStringAssociatedTo(id)<<endl;
00468          
00469 
00470          //if a string correponds, delete it
00471          if ( _fastStringAccessTable.find(id) != _fastStringAccessTable.end() )
00472             {
00473                _stringToIdCorrespondenceContainer.erase(_fastStringAccessTable[id]);
00474                _fastStringAccessTable.erase(_fastStringAccessTable.find(id));
00475             }
00476 
00477          _tableNbInstances.erase(i);
00478          
00479          assert ((*j).second != NULL ) ; //assert because otherwise it would meen a problem has occured
00480          delete (*j).second ;
00481          _idToNamesUsingIdContainer.erase (j) ;
00482          
00483          assert ( _tableNbInstances.find(id) == _tableNbInstances.end() ) ;
00484          
00485          if (id==_nextIdentifier-1) 
00486             {
00487                _nextIdentifier=_nextIdentifier-1;
00488             }
00489       }
00490 
00491    unlock() ;

template<template< typename T > class STLallocator>
PsNameServer::CanonicalRepresentationType * PsNameServerT< STLallocator >::getCanonicalRepresentation   const [virtual]
 

get the canonical representation once used, the result should be deleted

Implements PsNameServer.

Definition at line 330 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_stringToIdCorrespondenceContainer, PsNameServerT< STLallocator >::_tableNbInstances, hash_map< Key, T, HashFcn, EqualKey, Alloc >::begin(), PsNameServer::CanonicalRepresentationType, hash_map< Key, T, HashFcn, EqualKey, Alloc >::end(), hash_map< PsName::idType, int, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::find(), list< Type, allocator >::push_back(), pair< T1, T2 >::second, and list< Type, allocator >::sort().

00332 {
00333    PsNameServer::CanonicalRepresentationType * canonicalRepresentation = new PsNameServer::CanonicalRepresentationType () ;
00334 #ifdef _TYPENAMENOTIMPLICIT
00335    typename
00336 #endif
00337    PsNameServerT<STLallocator>::correspondenceContainerType::const_iterator i;
00338    for (i=_stringToIdCorrespondenceContainer.begin(); i!=_stringToIdCorrespondenceContainer.end();i++) 
00339       {
00340          canonicalRepresentation->push_back(PsPair<PsPair<PsName::idType,PsString>, int>(PsPair<PsName::idType,PsString>((*i).second,(*i).first),(*(_tableNbInstances.find((*i).second))).second)) ;
00341       }
00342    canonicalRepresentation->sort() ;
00343    return canonicalRepresentation ;

template<template< typename T > class STLallocator>
PsName::idType PsNameServerT< STLallocator >::getIdentifier const PsString   [virtual]
 

get the id corresponding to a string if the string is unknown to the name server, a new id will be added

Implements PsNameServer.

Definition at line 241 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_nextIdentifier, PsNameServerT< STLallocator >::getIdentifierAsFrom(), and PsName::idType.

00243 {
00244    PsName::idType res;
00245    //cerr<<this<<" "<<_nextIdentifier<<" ";
00246    res = getIdentifierAsFrom(name, &_nextIdentifier) ;
00247    //cerr<<"("<<res<<","<<name<<") added to name server "<<_nextIdentifier<<endl;
00248    return res;

template<template< typename T > class STLallocator>
PsName::idType PsNameServerT< STLallocator >::getIdentifierAsFrom const PsString  ,
long *    nextId
[virtual]
 

get the id corresponding to a string, using a specified nextId counter used to implement getIdentifier and getSystemIdentifier

Reimplemented in PsPvmNameServer.

Definition at line 276 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_fastStringAccessTable, PsNameServerT< STLallocator >::_stringToIdCorrespondenceContainer, hash_map< Key, T, HashFcn, EqualKey, Alloc >::end(), hash_map< Key, T, HashFcn, EqualKey, Alloc >::find(), pair< T1, T2 >::first, PsName::idType, hash_map< Key, T, HashFcn, EqualKey, Alloc >::insert(), PsNameServerT< STLallocator >::lock(), and PsNameServerT< STLallocator >::unlock().

Referenced by PsNameServerT< STLallocator >::getIdentifier(), and PsNameServerT< STLallocator >::getSystemIdentifier().

00277                                                                                        {
00278 
00279 #ifdef _TYPENAMENOTIMPLICIT
00280    typename
00281 #endif
00282    correspondenceContainerType::iterator i = _stringToIdCorrespondenceContainer.find( name );
00283 
00284    if (i == _stringToIdCorrespondenceContainer.end()) 
00285       {
00286          //we are going to change the values contained in the PsNameServer
00287          lock() ; 
00288 
00289          i = _stringToIdCorrespondenceContainer.find( name ) ; //name might have been added by an other process
00290 
00291          if (i == _stringToIdCorrespondenceContainer.end() ) //we have to add name
00292             { 
00293 
00294 #ifdef _TYPENAMENOTIMPLICIT
00295                pair<typename correspondenceContainerType::iterator,bool> res = _stringToIdCorrespondenceContainer.insert(typename correspondenceContainerType::value_type(name,*nextId)) ;
00296 #else
00297                pair<correspondenceContainerType::iterator,bool> res = _stringToIdCorrespondenceContainer.insert(correspondenceContainerType::value_type(name,*nextId)) ;
00298 #endif
00299  
00300                _fastStringAccessTable[*nextId] = res.first ;
00301 
00302                *nextId = *nextId + 1 ;
00303                
00304                i = res.first ;
00305          }
00306 
00307          unlock() ;
00308       }
00309    return (*i).second;

template<template< typename T > class STLallocator>
const list< PsName * > & PsNameServerT< STLallocator >::getNamesOfId PsName::idType    const [virtual]
 

get a list of pointers to the PsNames corresponding to an id

Implements PsNameServer.

Definition at line 521 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_idToNamesUsingIdContainer, hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::end(), hash_map< PsName::idType, list< PsName * > *, hash< PsName::idType >, equal_to< PsName::idType >, STLallocator< pair< PsName::idType, int > > >::find(), and PsName::idType.

00523 {
00524 #ifdef _TYPENAMENOTIMPLICIT
00525    typename
00526 #endif
00527    placeOfNamesContainerType::const_iterator j = _idToNamesUsingIdContainer.find(id);
00528 
00529    assert ( j != _idToNamesUsingIdContainer.end() ) ; 
00530 
00531    assert ( (*j).second != NULL ) ;
00532 
00533    return *(*j).second ;

template<template< typename T > class STLallocator>
const PsString & PsNameServerT< STLallocator >::getStringAssociatedTo PsName::idType    id const [virtual]
 

get the string associated to an id

Implements PsNameServer.

Reimplemented in PsPvmNameServer.

Definition at line 317 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_fastStringAccessTable, PsNameServerT< STLallocator >::_nextIdentifier, map< long, typename correspondenceContainerType::iterator, less< long >, STLallocator< pair< const long, typename correspondenceContainerType::iterator > > >::find(), and PsName::idType.

00319 {
00320    assert ( id<_nextIdentifier) ;
00321    //assert ( _fastStringAccessTable.find(id) != _fastStringAccessTable.end() ) ;
00322    return  (*(*_fastStringAccessTable.find(id)).second).first ;

template<template< typename T > class STLallocator>
PsName::idType PsNameServerT< STLallocator >::getSystemIdentifier const PsString   [virtual]
 

get the id corresponding to a string the string should correspond to a reserverd string

Implements PsNameServer.

Definition at line 257 of file PsNameServerT.h.

References PsName::_maxReservedId, PsNameServerT< STLallocator >::_nextSystemIdentifier, PsNameServerT< STLallocator >::getIdentifierAsFrom(), and PsName::idType.

00259 {
00260 
00261    PsName::idType result = getIdentifierAsFrom(name, &_nextSystemIdentifier) ;
00262    // this assertion could fail if a PsName corresponding to a reserved id was staticaly created
00263    assert ( result <= PsName::_maxReservedId ) ;
00264    //this would fail if more reserved Id's are created than originaly planned for
00265    assert ( _nextSystemIdentifier <= PsName::_maxReservedId ) ;
00266 
00267    return result ;

template<template< typename T > class STLallocator>
void PsNameServerT< STLallocator >::lock   const [protected, virtual]
 

lock data in a multithread environment

Implements PsNameServer.

Definition at line 500 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_ourDataLock, and PsnMutexLock::protect().

Referenced by PsNameServerT< STLallocator >::created(), PsNameServerT< STLallocator >::deleted(), and PsNameServerT< STLallocator >::getIdentifierAsFrom().

00502 {
00503    _ourDataLock.protect() ;

template<template< typename T > class STLallocator>
void PsNameServerT< STLallocator >::operator delete void *    ptr,
size_t    n
 

redefine delete 'cause new was redefined

Definition at line 374 of file PsNameServerT.h.

00376 {
00377    STLallocator<PsNameServerT<STLallocator> > anAllocator;
00378    anAllocator.deallocate((PsNameServerT<STLallocator> *)ptr,n);

template<template< typename T > class STLallocator>
void * PsNameServerT< STLallocator >::operator new size_t   
 

redefine new so that the nameserver is located in the same memory space than it's data structures and their elements

Definition at line 357 of file PsNameServerT.h.

00359 {
00360    STLallocator<PsNameServerT<STLallocator> > anAllocator;
00361    return anAllocator.allocate(size);

template<template< typename T > class STLallocator>
void PsNameServerT< STLallocator >::unlock   const [protected, virtual]
 

unlock data in a multithread environment

Implements PsNameServer.

Definition at line 511 of file PsNameServerT.h.

References PsNameServerT< STLallocator >::_ourDataLock, and PsnMutexLock::unprotect().

Referenced by PsNameServerT< STLallocator >::created(), PsNameServerT< STLallocator >::deleted(), and PsNameServerT< STLallocator >::getIdentifierAsFrom().

00513 {
00514    _ourDataLock.unprotect() ;


Member Data Documentation

template<template< typename T > class STLallocator>
fastStringAccessTableType PsNameServerT< STLallocator >::_fastStringAccessTable [protected]
 

fast access data structure

Definition at line 145 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::deleted(), PsNameServerT< STLallocator >::getIdentifierAsFrom(), PsNameServerT< STLallocator >::getStringAssociatedTo(), and PsNameServerT< STLallocator >::PsNameServerT().

template<template< typename T > class STLallocator>
placeOfNamesContainerType PsNameServerT< STLallocator >::_idToNamesUsingIdContainer [protected]
 

table holding the list of PsNames memory spaces using a given id

Definition at line 154 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::created(), PsNameServerT< STLallocator >::deleted(), and PsNameServerT< STLallocator >::getNamesOfId().

template<template< typename T > class STLallocator>
long PsNameServerT< STLallocator >::_nextIdentifier [protected]
 

nextIdentifier to use

Definition at line 108 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::deleted(), PsNameServerT< STLallocator >::getIdentifier(), PsNameServerT< STLallocator >::getStringAssociatedTo(), and PsNameServerT< STLallocator >::PsNameServerT().

template<template< typename T > class STLallocator>
long PsNameServerT< STLallocator >::_nextSystemIdentifier [protected]
 

next System Identifier to use

Definition at line 112 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::getSystemIdentifier(), and PsNameServerT< STLallocator >::PsNameServerT().

template<template< typename T > class STLallocator>
PsnMutexLock PsNameServerT< STLallocator >::_ourDataLock [mutable, protected]
 

the lock for multi-threaded environements

Definition at line 104 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::lock(), and PsNameServerT< STLallocator >::unlock().

template<template< typename T > class STLallocator>
correspondenceContainerType PsNameServerT< STLallocator >::_stringToIdCorrespondenceContainer [protected]
 

table holding String - id correspondance

Definition at line 148 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::deleted(), PsNameServerT< STLallocator >::getCanonicalRepresentation(), PsNameServerT< STLallocator >::getIdentifierAsFrom(), and PsNameServerT< STLallocator >::PsNameServerT().

template<template< typename T > class STLallocator>
referenceCountingContainerType PsNameServerT< STLallocator >::_tableNbInstances [protected]
 

table holding reference counting

Definition at line 151 of file PsNameServerT.h.

Referenced by PsNameServerT< STLallocator >::created(), PsNameServerT< STLallocator >::deleted(), PsNameServerT< STLallocator >::getCanonicalRepresentation(), and PsNameServerT< STLallocator >::PsNameServerT().


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

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

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