00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #ifndef PsNameHEADER 00019 #define PsNameHEADER 00020 00021 class PsString; 00022 #include <PsType.h> 00023 00024 #ifdef _HASHMAPNOTSTD 00025 #include <ext/hash_map> 00026 using namespace __gnu_cxx ; 00027 #else 00028 #include <hash_map> 00029 #endif 00030 00031 class PsNameServer; 00032 class PsPolatorNT; 00033 #include <string> 00034 00044 class PsName : public PsType { 00045 public: 00048 PsName(); 00049 00050 00053 PsName(const PsString &); 00054 00055 00058 PsName(const char * ); 00059 00060 00063 PsName(const string & ); 00064 00065 00068 PsName(const PsName &); 00069 00070 00073 virtual ~PsName(); 00074 00077 virtual PsPolatorNT * createPolator(void); 00078 00079 00082 virtual const char * getCString() const; 00083 00084 00087 virtual const PsString & getPsString() const; 00088 00089 00092 virtual void insertInStream(ostream & out) const; 00093 00094 00097 virtual void extract(istream & in); 00098 00099 00101 virtual void unpack (PsIncomingSynchronisationMessage &) ; 00102 00103 00105 virtual void pack (PsOutgoingSynchronisationMessage &) const ; 00106 00107 00111 00114 virtual PsName & operator = (const PsName &); 00115 00116 00119 virtual PsName & operator = (const PsString &); 00120 00121 00124 virtual PsName & operator = (const char * ); 00125 00126 00129 virtual PsName & operator = (const string &); 00130 00131 00134 inline friend bool operator == (const PsName & first , const PsName & second) 00135 { 00136 return first._identifier == second._identifier; 00137 } 00138 00139 00142 inline friend bool operator != (const PsName & first , const PsName & second) 00143 { 00144 return first._identifier != second._identifier; 00145 } 00146 00147 00151 friend int operator < (const PsName &Source1, const PsName &Source2); 00152 00153 00157 friend int operator > (const PsName &Source1, const PsName &Source2); 00158 00159 00163 friend int operator <= (const PsName &Source1, const PsName &Source2); 00164 00165 00169 friend int operator >= (const PsName &Source1, const PsName &Source2); 00170 00171 00172 00174 00175 00179 static PsNameServer * getNameServer () ; 00180 00181 00185 static void setNameServer(PsNameServer * ) ; 00186 00187 00190 typedef long idType; 00191 00192 00194 static const idType _maxReservedId ; 00195 00196 00198 struct hashFunctionObject { 00199 size_t operator ()(const PsName & nom) const 00200 { 00201 //dont't hash on _identifiers, because they might change, breaking all hash maps 00202 static hash<const char *> H; 00203 return H(nom.getCString() ); 00204 } 00205 }; 00206 friend struct hashFunctionObject ; 00207 00208 00210 struct equalToFunctionObject { 00211 bool operator () (const PsName & nom1, const PsName & nom2) const 00212 { 00213 return nom1._identifier == nom2._identifier ; 00214 } 00215 } ; 00216 00217 friend struct equalToFunctionObject ; 00218 00220 struct lessThanFunctionObject { 00221 bool operator () (const PsName & nom1, const PsName & nom2) const { 00222 return nom1._identifier < nom2._identifier ; 00223 } 00224 } ; 00225 friend struct lessThanFunctionObject ; 00226 00227 protected: 00228 friend class PsNameServer ; 00229 00234 virtual void changeId ( idType oldId, idType newId ) ; 00235 00237 static PsNameServer * _nameServer ; 00238 00241 explicit PsName( idType ) ; 00242 00243 00245 friend class PsnOutputOffsetTable; 00246 00247 00250 idType _identifier; 00251 00252 }; 00253 00259 bool operator == (const PsName &, const PsName &); 00260 00261 00264 bool operator != (const PsName &, const PsName &); 00265 00266 00267 00271 int operator < (const PsName &Source1, const PsName &Source2); 00272 00273 00277 int operator > (const PsName &Source1, const PsName &Source2); 00278 00279 00283 int operator <= (const PsName &Source1, const PsName &Source2); 00284 00285 00289 int operator >= (const PsName &Source1, const PsName &Source2); 00290 00291 00293 #endif 00294 00295
| Documentation generated on Mon Nov 25 15:25:00 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |